设备上有 2 个网卡, 在设置也区别了 eth0 和 eth1, 直到设置 eth0 无效时才发现有了问题.
克隆后在 ifconfig 时候发现网卡名字 eth3 或者 eth4 而不是默认的 eth0
这个解决, 不知算不算彻底, 至少, 使用到目前为止, 网卡名称始终为 eth0 和 eth1
Linux 中, 网卡设备和 mac 地址等信息在 / etc/udev/rules.d/70-persistent-net.rules 文件中, 如果这个文件已经存在一个 eth0, 若下次在不同的设备上启动, 将添加新的 eth1-- 而不管 eth0 有没有效.
下面是这个文件的示例:
解决:
1,
关机时把 / etc/udev/rules.d/70-persistent-net.rules 清空 (以免下次拷贝系统时出现问题).
启动时把 / etc/udev/rules.d/70-persistent-net.rules 清空.
清空命令: echo ""> /etc/udev/rules.d/70-persistent-net.rules
2, 这个 CentOS 系统没发现这个文件 这个不确定是否真的没有
在 / lib/udev/write_net_rules 文件中, 把 RULES_FIL 路径改为其它不存在的目录:
- RULES_FILE='/etc/udev/not_rules.d/70-persistent-net.rules'
- 3,
在 / lib/udev/rules.d/75-persistent-net-generator.rules 文件中, 注释掉下面内容:
- device name whitelist
- #KERNEL!="eth|ath|wlan[0-9]|msh|ra|sta|ctc|lcs|hsi*", \
此段内容需要搜索一下注视掉即可 #GOTO="persistent_net_generator_end"
来源: http://www.bubuko.com/infodetail-2724557.html