ubuntu 16.04 修正网卡与ifname对应关系

一台工控机,含有6个网口,但是名称  enp3s0 等等与网口顺序对应不起来。

现在修改脚本 /etc/udev/rules.d/70-persistent-net.rules ,如果文件不存在,可以创建,

内容如下:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:1c:22:1f:1a:eb", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:1c:22:1f:1a:f5", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:1c:22:1f:1a:ff", KERNEL=="eth*", NAME="eth2"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:1c:22:1f:1b:00", KERNEL=="eth*", NAME="eth3"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:1c:22:1f:1b:f0", KERNEL=="eth*", NAME="eth4"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:1c:22:1f:1b:ff", KERNEL=="eth*", NAME="eth5"

最后执行 reboot 即可。

posted @ 2018-09-29 19:44  hbg-rohens  阅读(794)  评论(0编辑  收藏  举报