最近更换了公司服务器的一块网卡。系统是CentOS6.2系统,更换网卡后默认识别,一次点亮。网卡倒是能正常工作了,可原来的代理服务器等不能用了。想想当年配置那个代理服务器费了好大功夫,还是更换新网卡的名称比较省事。
1、停掉要修改的网卡
ifdown eth2
2、cd /etc/udev/rules.d
修改文件:vi 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:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="18:a9:05:33:61:04", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:20:07:f0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
文件中很清晰的列出了,你已有的网卡配置。由于原来的网卡不用了,直接删掉。把新的网卡名字改成了"eth1"
3、修改网卡2的网络配置文件,修改DEVICE为eth1
cd /etc/sysconfig/network-scripts/
mv ifcfg-Auth_eth2 ifcfg-eth1
vi ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
BOOTPROTO=none
IPADDR=xxx.xxx.xxx.xxx
PREFIX=29
GATEWAY=xxx.xxx.xxx.xxx
DNS1=xxx.xxx.xxx.xxx
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth1"
UUID=eb46f9f8-ed7f-44ea-845a-8402c3babd72
ONBOOT=yes
HWADDR=00:E0:4C:20:07:F0
LAST_CONNECT=1459820491
4、重新加载网卡
ifup eth1
5、重新启动网络
service network restart
如果不行,执行重启大法。重新加载所有配置。
shutdown -r now