最近更換了公司服務器的一塊網卡。系統是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