玉米糊 发表于 2014-11-27 14:35:49

ubuntu系统修改MAC后eth0和eth1顺序改变解决

昨天用tar的方法把我的电脑给还原成刚安装是的样子,因为是用别的电脑的备份进行还原的,所以网络接口总得eth0被之前的的电脑的网卡占用了,所以我要修改一下,把之前的网卡接口删掉.其实修改起来很简单只要修改一下/etc/udev/rules.d/70-persistent-net.rules文件就行了.70-persistent-net.rules主要是一下内容:# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:1c.0/0000:13:00.0 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:37:01:4c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:1c.1/0000:14:00.0 (iwl3945)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1f:3c:be:a1
通过这个我们可以看出需要修改的只是以subsystem开头的内容,只要把不需要的网卡的那行删除或注销掉就行了,那么如何得知那个是没用的网卡哪?很简单,看ATTR{address}== 后面的mac地址,只要mac地址是你需呀废除的网卡的mac你就可以删除它,或者注销掉他,注销之后修改要使用的网卡的NAME改成NAME="eth0".
重启之后原来的eth1什么的就会变成eth0了.
页: [1]
查看完整版本: ubuntu系统修改MAC后eth0和eth1顺序改变解决