红联Linux门户
Linux帮助

ifconfig命令显示HCA卡IP地址的问题

发布时间:2016-09-06 15:11:47来源:linux网站作者:msdnchina
[root@rac1 ~]# ifconfig -a  
enp3s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  
inet 192.168.100.101  netmask 255.255.255.0  broadcast 192.168.100.255  
inet6 fe80::ec4:7aff:feac:3cc8  prefixlen 64  scopeid 0x20<link>  
ether 0c:c4:7a:ac:3c:c8  txqueuelen 1000  (Ethernet)  
RX packets 1708659  bytes 1055516580 (1006.6 MiB)  
RX errors 0  dropped 1856  overruns 0  frame 0  
TX packets 783834  bytes 183429513 (174.9 MiB)  
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  
device memory 0xc7620000-c7640000   
enp3s0f0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  
inet 192.168.100.107  netmask 255.255.255.0  broadcast 192.168.100.255  
ether 0c:c4:7a:ac:3c:c8  txqueuelen 1000  (Ethernet)  
device memory 0xc7620000-c7640000   
enp3s0f1: flags=4098<BROADCAST,MULTICAST>  mtu 1500  
ether 0c:c4:7a:ac:3c:c9  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  
device memory 0xc7600000-c7620000   
ib0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 2044  
inet 10.10.10.101  netmask 255.255.255.0  broadcast 10.10.10.255  
inet6 fe80::7efe:9003:91:7ed1  prefixlen 64  scopeid 0x20<link>  
Infiniband hardware address can be incorrect! Please read BUGS section in ifconfig(8).--------->注意此处! 
infiniband 80:00:00:48:FE:80:00:00:00:00:00:00:00:00:00:00:00:00:00:00  txqueuelen 256  (InfiniBand)  
RX packets 152742  bytes 16275415 (15.5 MiB)  
RX errors 0  dropped 0  overruns 0  frame 0  
TX packets 197013  bytes 15793636 (15.0 MiB)  
TX errors 0  dropped 11 overruns 0  carrier 0  collisions 0  
ib1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 2044  
inet 1.1.1.101  netmask 255.255.255.0  broadcast 1.1.1.255  
inet6 fe80::7efe:9003:91:7ed2  prefixlen 64  scopeid 0x20<link>  
Infiniband hardware address can be incorrect! Please read BUGS section in ifconfig(8).--------->注意此处! 
infiniband 80:00:00:49:FE:80:00:00:00:00:00:00:00:00:00:00:00:00:00:00  txqueuelen 256  (InfiniBand)  
RX packets 28753040  bytes 27216942068 (25.3 GiB)  
RX errors 0  dropped 0  overruns 0  frame 0  
TX packets 25737856  bytes 21898064798 (20.3 GiB)  
TX errors 0  dropped 13 overruns 0  carrier 0  collisions 0  
ib1:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 2044  
inet 169.254.85.174  netmask 255.255.0.0  broadcast 169.254.255.255  
Infiniband hardware address can be incorrect! Please read BUGS section in ifconfig(8).--------->注意此处!       
infiniband 80:00:00:49:FE:80:00:00:00:00:00:00:00:00:00:00:00:00:00:00  txqueuelen 256  (InfiniBand) 
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 3296963  bytes 3310546982 (3.0 GiB)  
RX errors 0  dropped 0  overruns 0  frame 0  
TX packets 3296963  bytes 3310546982 (3.0 GiB)  
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  
[root@rac1 ~]#  
 
后来查了查mellanox官网的文章,原来需要用ip addr show命令来显示HCA的IP地址,如下:
[root@rac1 ~]# ip addr show  
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: enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000  
link/ether 0c:c4:7a:ac:3c:c8 brd ff:ff:ff:ff:ff:ff  
inet 192.168.100.101/24 brd 192.168.100.255 scope global enp3s0f0  
valid_lft forever preferred_lft forever  
inet 192.168.100.107/24 brd 192.168.100.255 scope global secondary enp3s0f0:1  
valid_lft forever preferred_lft forever  
inet6 fe80::ec4:7aff:feac:3cc8/64 scope link  
valid_lft forever preferred_lft forever  
3: enp3s0f1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000  
link/ether 0c:c4:7a:ac:3c:c9 brd ff:ff:ff:ff:ff:ff  
4: ib0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP qlen 256  
link/infiniband 80:00:00:48:fe:80:00:00:00:00:00:00:7c:fe:90:03:00:91:7e:d1 brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff  
inet 10.10.10.101/24 brd 10.10.10.255 scope global ib0  
valid_lft forever preferred_lft forever  
inet6 fe80::7efe:9003:91:7ed1/64 scope link  
valid_lft forever preferred_lft forever  
5: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP qlen 256  
link/infiniband 80:00:00:49:fe:80:00:00:00:00:00:00:7c:fe:90:03:00:91:7e:d2 brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff  
inet 1.1.1.101/24 brd 1.1.1.255 scope global ib1  
valid_lft forever preferred_lft forever  
inet 169.254.85.174/16 brd 169.254.255.255 scope global ib1:1  
valid_lft forever preferred_lft forever  
inet6 fe80::7efe:9003:91:7ed2/64 scope link  
valid_lft forever preferred_lft forever  
[root@rac1 ~]#  
 
原因是:
ifconfig is obsolete according to Red Hat, also it shows the followng message when running it when IPoIB interfaces exists:  
Ifconfig uses the ioctl access method to get the full address information, which limits hardware addresses to 8 bytes.  
Because Infiniband address has 20 bytes, only the first 8 bytes are displayed correctly.  
Ifconfig is obsolete! For replacement check ip.
 
本文永久更新地址:http://www.linuxdiyf.com/linux/23939.html