linux6.x修改网卡名称

1:修改/etc/udev/rules.d/70-persistent-net.rules

将eth6 改为eth0

注意:只需要修改name即可,不需要修改kernel

[root@itpux ~]# vi /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:4f:5b:58", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
2:重命名网卡配置文件

需要ifcfg-eth0文件重命名为ifcfg-em1
[root@itpux network-scripts]# mv ifcfg-Auto_eth6 ifcfg-eth0

3:编辑网卡配置文件

1.将名称修改过来
2.并把uuid删除(如果没有就不用)

[root@itpux network-scripts]# vi ifcfg-eth0 
HWADDR=00:0C:29:4F:5B:58
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.51
PREFIX=24
GATEWAY=192.168.1.51
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=eth0
#UUID=b1e0320a-6374-468e-aacc-50272cfdf25d
ONBOOT=yes
4:重启服务器,重启之后网卡名称已经修改过来,网络正常
[root@itpux ~]# shutdown -r 0
[root@itpux ~]# ip a
1: lo:  mtu 16436 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
2: eth0:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:4f:5b:58 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.51/24 brd 192.168.1.255 scope global eth0
    inet6 fe80::20c:29ff:fe4f:5b58/64 scope link 
       valid_lft forever preferred_lft forever
3: pan0:  mtu 1500 qdisc noop state DOWN 
    link/ether 0a:34:e1:ef:90:a1 brd ff:ff:ff:ff:ff:ff

你可能感兴趣的:(linux6.x修改网卡名称)