[root@centos6 ~]# sed -i 's/eth0/eth-DB1/;s/eth1/eth-DB2/' /etc/udev/rules.d/70-persistent-net.rules #第一步:通过sed处理 文件名字更改
root@centos6 ~]# cat /etc/udev/rules.d/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 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ad:7b:c1", ATTR{type}=="1", KERNEL=="eth*", NAME="eth-DB1"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ad:7b:cb", ATTR{type}=="1", KERNEL=="eth*", NAME="eth-DB2"
[root@centos6 ~]# #第二步:修改配置文件中的设备name
sed -i 's/eth0/eth-DB1/g' /etc/sysconfig/network-scripts/ifcfg-eth0
[root@centos6 ~]# #第三步:修改配置文件中的设备name
sed -i 's/eth1/eth-DB2/g' /etc/sysconfig/network-scripts/ifcfg-eth1
[root@centos6 ~]# modprobe -r e1000 #卸载驱动模块或重启机器
###############################通过桌面终端查看验证############################
[root@centos6 ~]# modprobe e1000 #重新加载驱动模块
[root@centos6 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
8: eth-DB1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 #验证说明配置文件已更改
link/ether 00:0c:29:ad:7b:c1 brd ff:ff:ff:ff:ff:ff
inet 192.168.100.128/24 brd 192.168.100.255 scope global eth-DB1
inet6 fe80::20c:29ff:fead:7bc1/64 scope link
valid_lft forever preferred_lft forever
9: eth-DB2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 #验证说明配置文件已更改
link/ether 00:0c:29:ad:7b:cb brd ff:ff:ff:ff:ff:ff
inet 172.18.253.115/16 brd 172.18.255.255 scope global eth-DB2
inet6 fe80::20c:29ff:fead:7bcb/64 scope link
valid_lft forever preferred_lft forever