Display IP address information using the IFCONFIG command in Linux

Home > Search > Linux commands
  by

The ifconfig command without any options will display information about all of the active interfaces being used.

[root@server1 ~]$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 192.168.0.101 netmask 255.255.255.0 broadcast 192.168.0.255
    inet6 fe80::20c:29ff:fe03:2e90 prefixlen 64 scopeid 0x20<link>
    ether 00:12:13:1a:b4:c2 txqueuelen 1000 (Ethernet)
    RX packets 7858997 bytes 654953014 (624.6 MiB)
    RX errors 0 dropped 248 overruns 0 frame 0
    TX packets 10466 bytes 126679 (1.2 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.255.255.0
    inet6 ::1 prefixlen 128 scopeid 0x10<host>
    loop txqueuelen 0 (Local Loopback)
    RX packets 1544 bytes 275726 (269.2 MiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 1544 bytes 275726 (269.2 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 


Show all

The -a (all) option can be used to display information about active and inactive interfaces.

[root@server1 ~]$ ifconfig -a

 


Specific interface

Appending the interface name can be used to only show information for a certain interface.

[root@server1 ~]$ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 192.168.0.101 netmask 255.255.255.0 broadcast 192.168.0.255
    inet6 fe80::20c:29ff:fe03:2e90 prefixlen 64 scopeid 0x20<link>
    ether 00:12:13:1a:b4:c2 txqueuelen 1000 (Ethernet)
    RX packets 7858997 bytes 654953014 (624.6 MiB)
    RX errors 0 dropped 248 overruns 0 frame 0
    TX packets 10466 bytes 126679 (1.2 MiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 


Bring interface up or down

The up or down option can  be used to bring an interface up or down.

[root@server1 ~]$ ifconfig eth0 up
[root@server1 ~]$ ifconfig eth0 down

 


Change IP address, subnet mask, broadcast

The IP address, subnet mask, or broadcast address of an interface can temporarily be changed. This is not permanent.

[root@server1 ~]$ ifconfig eth0 192.168.0.10
[root@server1 ~]$ ifconfig eth0 netmask 255.255.255.0
[root@server1 ~]$ ifconfig eth0 broadcast 192.168.0.255

 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments