10.20 Debian如何更改网卡名 https://scz.617.cn/unix/200707131049.txt Q: 在VMware中装了Debian 4.0,当时网卡名是eth0,后来将虚拟机文件移动到另一个目 录中,网卡名变成了eth1。此时若将虚拟机文件移动回原目录,网卡名恢复成eth0。 有什么办法在虚拟机文件离开原目录的情况下继续保持网卡名为eth0吗。 A: # cd /etc # grep -R eth1 * udev/rules.d/z25_persistent-net.rules:SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:0c:29:23:03:f3", NAME="eth1" # more udev/rules.d/z25_persistent-net.rules # This file was automatically generated by the /lib/udev/write_net_rules # program, probably run by the persistent-net-generator.rules rules file. # # You can modify it, as long as you keep each rule on a single line. # MAC addresses must be written in lowercase. # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:0c:29:01:45:95", NAME="eth0" # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:0c:29:23:03:f3", NAME="eth1" 编辑/etc/udev/rules.d/z25_persistent-net.rules文件,删除eth0相应的两行,再 将eth1更名为eth0,重启使之生效。 另一个方案需要在console上操作: # ifconfig eth1 down # ip link set eth1 name eth0 # ifconfig eth0 up 这个方案是热生效的,但重启后就没了。建议使用第一种方案。