先初始化VM,
桥接模式:
[root@out network-scripts]# cat ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=b4a417df-1494-4e18-9aee-8b257c1e529e
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.1.189
NETMASK=255.255.255.0
GETWAY=192.168.1.1
DNS1=114.114.114.114
[root@out network-scripts]# pwd
/etc/sysconfig/network-scripts
NAT方式:
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
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
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=8cd534f0-b002-4480-99a2-cf066790fe72
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.68.128
GATEWAY=192.168.68.2
NETMASK=255.255.255.0
DNS1=114.114.114.114
[root@localhost ~]#