两台linux,交换硬盘后执行ifconfig发现没有eth0和eth1,反而有eth2和eth3,其中eth2(对应eth0)为有效网卡,eth3(eth1)未配置。network-script目录下只有eth0(192.168.1.176)和eth1的配置文件,ifconfig显示eth2为dhcp自动分配的ip(192.168.1.254)。
解决方法:/etc/udev/rules.d/70-persistent-net.rules中需要做相应修改,记下ifconfig命令给出的mac,其为当前网卡的mac。在network-script目录下配置文件中的mac为该硬盘之前所在机器的mac,对当前机器无效。
删除/etc/udev/rules.d/70-persistent-net.rules中eth2和eth3的对应内容,更改eth0和eth1的mac为当前机器的mac。更改network-script目录下的mac,重启服务(我是重启机器的)。(另外,根据网上介绍,直接delete掉/etc/udev/rules.d/70-persistent-net.rules文件,更改network-script下的配置文件,重启,系统会自动生成/etc/udev/rules.d/70-persistent-net.rules文件)