Just after CentOS installation, as a normal UNIX guy, I launched “ifconfig -a” command to discover what IP address, my DHCP gave me… And I was terribly disappointed : one of the most often used commands by system admins has been omitted by CentOS ? How to display IP addresses ?

The basic CentOS command :

[root@pc36 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:04:dc:99 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.22/24 brd 192.168.1.255 scope global dynamic ens160
valid_lft 83919sec preferred_lft 83919sec
inet6 fe80::20c:29ff:fe04:dc99/64 scope link
valid_lft forever preferred_lft forever

“ip”, why not “ipconfig” like Windows command, stupid, isn’t it ?

Hopefully, you can install the traditional “ifconfig” command :

[root@pc36 ~]# yum install net-tools

Then, you got it :

[root@pc36 ~]# ifconfig -a
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.22 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::20c:29ff:fe04:dc99 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:04:dc:99 txqueuelen 1000 (Ethernet)
RX packets 84672 bytes 124244458 (118.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 51672 bytes 3955079 (3.7 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 0 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 

PDF24    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *


*