1、调整网卡名称
[root@web01 ~]# cd /etc/sysconfig/network-scripts/ #<==进入网卡文件目录。
[root@web01 network-scripts]# mv ifcfg-ens192 ifcfg-eth0 #<==进重命名网卡名称。
2、编辑网卡的配置信息
[root@web01 network-scripts]# cat ifcfg-eth0 #<==修改后的结果如下。
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0 #<==修改为eth0
UUID=97353b57-69ae-4bec-ba7f-8e3e9efefddf
DEVICE=eth0 #<==修改为eth0
ONBOOT=yes
IPADDR=192.168.1.171
PREFIX=24
GATEWAY=192.168.1.254
DNS1=114.114.114.114
3、修改并生成grub配置
[root@web01 network-scripts]# cat /etc/sysconfig/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb net.ifnames=0 biosdevname=0 quiet" #<==×××底纹内容是添加的。
GRUB_DISABLE_RECOVERY="true"
[root@web01 network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg #<==生成grub启动菜单。
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-c69b09bdfae54d4593a619b6176aa1f3
Found initrd image: /boot/initramfs-0-rescue-c69b09bdfae54d4593a619b6176aa1f3.img
done
4.验证是否修改结果
[root@web01 network-scripts]# reboot
[root@web01 network-scripts]# ifconfig #<==再次查看网卡信息
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.171 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::52fb:33f0:b2ed:4b7b prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:a5:66:0a txqueuelen 1000 (Ethernet)
RX packets 1487 bytes 118823 (116.0 KiB)
RX errors 0 dropped 1 overruns 0 frame 0
TX packets 78 bytes 7849 (7.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0