1、重命名并修改网卡配置文件,将"NAME"参数更为我们熟悉的“eth*”,这里我将其改为"eth0"
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# mv ifcfg-eno16777736 ifcfg-eth0
[root@localhost network-scripts]# vim ifcfg-eth0
HWADDR=:0C::BA::E3
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eth0 #修改此参数,和文件名称ifcfg-eth0保持一致
UUID=a937a6e4-f70d--b617-ea0b53cab76e
ONBOOT=yes
2、修改grub文件/etc/sysconfig/grub,在“GRUB_CMDLINE_LINUX”参数行中添加“net.ifnames=0 biosdevname=0”
[root@localhost network-scripts]# vim /etc/sysconfig/grub
GRUB_TIMEOUT=
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/root vconsole.keymap=us vconsole.font=latarcyrheb-sun16 crashkernel=auto net.ifnames=0 biosdevname=0 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
3、重新生成grub配置并更新内核参数:
运行命令:”grub2-mkconfig -o /boot/grub2/grub.cfg“
[root@localhost network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfgGenerating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.-.el7.x86_64
Found initrd image: /boot/initramfs-3.10.-.el7.x86_64.img
Found linux image: /boot/vmlinuz--rescue-e5dec78a32184af9be1ffa5acfa5efbb
Found initrd image: /boot/initramfs--rescue-e5dec78a32184af9be1ffa5acfa5efbb.img
done
4、重启系统后,ifconfig查看:
[root@localhost ~]# ifconfig
eth0: flags=<UP,BROADCAST,MULTICAST> mtu
ether :0c::ba::e3 txqueuelen (Ethernet)
RX packets bytes (47.0 KiB)
RX errors dropped overruns frame
TX packets bytes (0.0 B)
TX errors dropped overruns carrier collisions eth1: flags=<UP,BROADCAST,RUNNING,MULTICAST> mtu
ether :0c::ba::ed txqueuelen (Ethernet)
RX packets bytes (1.8 MiB)
RX errors dropped overruns frame
TX packets bytes (0.0 B)
TX errors dropped overruns carrier collisions
5、为了双重保险起见建议使用udev规则管理,在”/etc/udev/rules.d“目录中创建一个网卡规则”70-net.rules“,并写入下面的语句:
ACTION=="add",SUBSYSTEM=="net",DRIVERS=="*",ATTR{address}=="00:0c:29:ba:53:e3",ATTR{type}=="1",KERNEL=="eth*",NAME="eth0"
[root@localhost ~]# cd /etc/udev/rules.d/
[root@localhost rules.d]# vim -net.rules
ACTION=="add",SUBSYSTEM=="net",DRIVERS=="*",ATTR{address}=="00:0c:29:ba:53:e3",ATTR{type}=="",KERNEL=="eth*",NAME="eth0"
[root@localhost rules.d]# udevadm trigger