最近更换了公司服务器的一块网卡。系统是CentOS6.2系统,更换网卡后默认识别,一次点亮。网卡却是能正常工做了,可原来的代理服务器等不能用了。想一想当年配置那个代理服务器费了好大功夫,仍是更换新网卡的名称比较省事。 shell
一、停掉要修改的网卡 服务器
ifdown eth2
二、cd /etc/udev/rules.d 网络
修改文件:vi 70-persistent-net.rules spa
# 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" 代理
三、修改网卡2的网络配置文件,修改DEVICE为eth1 rest
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
四、从新加载网卡 code
ifup eth1五、从新启动网络
service network restart
若是不行,执行重启大法。从新加载全部配置。 ip
shutdown -r now