1、进入网卡配置目录
[root@hadoop99 ~]# cd /etc/sysconfig/network-scripts/
2、修改NAT网卡的配置
[root@hadoop99 network-scripts]# mv ifcfg-ens33 ifcfg-eth0
[root@hadoop99 network-scripts]# vim ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
#BOOTPROTO=dhcp
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
#UUID=49451c22-564e-4763-8e8d-731203edea13
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.2.99
NETMASK=255.255.255.0
GATEWAY=192.168.2.2
DNS1=8.8.8.8
DNS2=114.114.114.114
3、修改仅主机网卡的配置
[root@hadoop99 network-scripts]# cp ifcfg-eth0 ifcfg-eth1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
#BOOTPROTO=dhcp
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=eth1
#UUID=49451c22-564e-4763-8e8d-731203edea13
DEVICE=eth1
ONBOOT=yes
IPADDR=192.168.246.99
NETMASK=255.255.255.0
4、修改 grub文件
[root@hadoop99 ~]# vim /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="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"
敲黑板 :
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0
"
5、重新生成新的 grub.cfg 配置文件
[root@hadoop99 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
也可以在开机安装操作系统的时候,直接设置参数,按Tab键 输入net.ifnames=0 biosdevname=0