手机版 收藏 导航

How to get the IP address of a Linux server

原创   www.link114.cn   2024-01-01 11:47:08

How to get the IP address of a Linux server

The "ip" command is a powerful tool for managing network interfaces and configurations. To get the IP address of your Linux server, you can use the following command:

ip addr show

This will display all the network interfaces on your server, including their IP addresses.

Another common way to find the IP address is by using the "ifconfig" command. This command provides detailed information about your network interfaces, including the IP address. To use it, simply run:

ifconfig

The IP address will be displayed under the "inet" field for each active network interface.

If you have configured your Linux server with a hostname that resolves to an IP address, you can use the "hostname" command to retrieve the associated IP address:

hostname -I

This command will display the IP address(es) associated with the hostname.

If you're using a distribution that utilizes NetworkManager, you can use the "nmcli" command to get the IP address:

nmcli device show

This will provide detailed information about your network devices, including their IP addresses.