Linux网络配置基础:RHEL6 操作系统更换网卡

如Linux服务器网卡故障更换网卡,或者服务器其他硬件故障,直接把硬盘拆下放到其他服务器上使用时。
都是网卡硬件发生变化,对应的是网卡mac地址改变。
此时系统启动起来后,网络是无法正常使用的。
涉及到一个文件
/etc/udev/rules.d/70-persistent-net.rules


[root@rhel64 ~]# cat /etc/udev/rules.d/70-persistent-net.rules


[root@rhel64 ~]# poweroff
关闭操作系统,修改虚拟机网卡mac地址,模拟更换网卡硬件







启动虚拟机,CRT已经无法远程连接,使用控制台图形化界面登陆管理


[root@rhel64 ~]# ifconfig
[root@rhel64 ~]# ifocnfig -a


[root@rhel64 ~]# service network restart
[root@rhel64 ~]# ifup eth0
报错:Device eth0 does not seem to be present,delaying initialization.



[root@rhel64 ~]# cat /etc/udev/rules.d/70-persistent-net.rules


[root@rhel64 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0


【解决方法】
手动修改网卡eth0配置文件,使用ifconfig -a查询出来的新mac地址替换旧mac


修改/etc/udev/rules.d/70-persistent-net.rules文件,注释或删除掉eth0对应行
将新mac地址对应的eth1更改为eth0

[root@rhel64 ~]# cat /etc/udev/rules.d/70-persistent-net.rules


重启操作系统验证
[root@rhel64 ~]#reboot
[root@rhel64 ~]# ifconfig

网络已经恢复,CRT可以远程连接


也可以只修改eth0网卡配置文件对应HWADDR,
直接删除/etc/udev/rules.d/70-persistent-net.rules文件,重启操作系统后此文件会自动生成。

[root@rhel64 ~]# cat /etc/udev/rules.d/70-persistent-net.rules

猜你喜欢

转载自www.linuxidc.com/Linux/2017-03/142094.htm