一、查看IP、子网掩码、网关
- 虚拟网络编辑器
- NAT中获取
- 取消勾选DHCP
二、查看DNS
虚拟机DNS与Windows设置相同
三、配置linux
[root@lhs800 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
BOOTPROTO="static" #静态IP
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="8b52d56b-9c53-4a7a-86ba-259a6870f2d4"
DEVICE="ens33"
ONBOOT="yes"
IPADDR=192.168.28.129 #IP地址
GATEWAY=192.168.28.2 #网关
NETMASK=255.255.255.0 #子网掩码
DNS1=223.5.5.5 #DNS
四、测试
[root@lhs800 ~]# ping www.baidu.com
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=128 time=6.13 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=3 ttl=128 time=11.6 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=4 ttl=128 time=5.89 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=5 ttl=128 time=8.23 ms
^C
--- www.a.shifen.com ping statistics ---
6 packets transmitted, 4 received, 33% packet loss, time 5009ms
rtt min/avg/max/mdev = 5.896/7.984/11.667/2.312 ms