如何更改Linux网卡名称

最近更换了公司服务器的一块网卡。系统是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

转载于:https://my.oschina.net/u/193989/blog/652590

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值