Introduction
There are multiple instances in which you will need to locate the IP address of your Linux server. You can find the private and public IP addresses of your Linux server; it depends on how you are searching. In the article, we will explain the usage of the "ifconfig" command on your Linux Server.
Procedure
Via the command line, you will enter the following:
ifconfig
The system will display all network connections – including connected, disconnected, and virtual. Look for the one labeled UP, BROADCAST, RUNNING, MULTICAST to find your IP address. This lists both IPv4 and IPv6 addresses.
Here is an example of what the output of the ifconfig command will display;
# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1458
inet 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.180
inet6 fe80::f816:3eff:fec9:428e prefixlen 64 scopeid 0x20<link>
inet6 2620:0:28a4:a093:f816:3eff:fec9:428e prefixlen 64 scopeid 0x0<global>
ether fa:16:3e:c9:42:8e txqueuelen 1000 (Ethernet)
RX packets 1368130 bytes 3003847321 (2.7 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 631292 bytes 86834879 (82.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2140297 bytes 336546027 (320.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2140297 bytes 336546027 (320.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
More details on the ifconfig command can also be reviewed here;
Comments
0 comments
Article is closed for comments.