How do I get all interface and associate IP address like following
[root@centso ]# ifconfig
enp3s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet addr:10.5.2.10 Bcast:10.5.7.255 Mask:255.255.248.0
inet6 fe80::e611:5bff:feea:5e50 prefixlen 64 scopeid 0x20<link>
ether e4:11:5b:ea:5e:50 txqueuelen 1000 (Ethernet)
RX packets 638000416 bytes 763371981799 (710.9 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 16607280 bytes 9787019600 (9.1 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp3s0f1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether e4:11:5b:ea:5e:52 txqueuelen 1000 (Ethernet)
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
enp4s0f0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether e4:11:5b:ea:5e:44 txqueuelen 1000 (Ethernet)
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
enp4s0f1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether e4:11:5b:ea:5e:46 txqueuelen 1000 (Ethernet)
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
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 1 (Local Loopback)
RX packets 45015 bytes 4371658 (4.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 45015 bytes 4371658 (4.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I want output like following, also I believe there is a command ip link
or something does that but didn't recall, also some machine has nic name different like enoX
or ethX
enp3s0f0: 10.5.2.10
enp3s0f1:
enp4s0f0:
enp4s0f1:
ifconfig
, useip addr
instead, it will show you additional IPv4 addresses that may have been associated to an interface.ifconfig
only gives you the primary IPv4 address.