确定物理网口对应的名称
在一台ubuntu的机器上,有四个物理网口,我想知道每个网口对应的MAC地址。使用ip a可以看到网口的MAC地址和名称,比如列出了ens1f0, ens1f1, ens4f0, ens4f1。
原来的网卡interface都是eth开头,后来改成了enp, ens等。
Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: eno1)
Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ens1)
Names incorporating physical/geographical location of the connector of the hardware (example: enp2s0)
Names incorporating the interfaces’s MAC address (example: enx78e7d1ea46da)
Classic, unpredictable kernel-native ethX naming (example: eth0)
那么如何确定机器上的ens1f0对应的哪个物理网口呢,可以用ethtool来实现,ethtool是用于查询及设置网卡参数的命令。用ethtool -p enos1f1,看哪个网口在闪灯,就能确定这个物理网口对应的名称。记得不要插网线。
1
|
ethtool -p|--identify DEVNAME Show visible port identification (e.g. blinking)
|
如果没有一个网口亮灯,很可能是因为网口不支持,则可以尝试ethtool -t enosf1f1,大概在4秒之后,网口的灯会亮,这个时候就可以确定enos1f1对应的具体的物理网口了。
1
|
ethtool -t|--test DEVNAME Execute adapter self test
|
很简单的一个命令,知道了就很简单,不知道就很难想到。