先运行ip a
查看网卡:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope hostvalid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:b9:87:76 brd ff:ff:ff:ff:ff:ffinet 192.168.150.101/24 brd 192.168.150.255 scope global noprefixroute ens33valid_lft forever preferred_lft foreverinet6 fe80::e786:b4d3:d70b:b118/64 scope link noprefixroutevalid_lft forever preferred_lft forever
运行cat /etc/sysconfig/network-scripts/ifcfg-ens33
得到网卡ens33
的配置:
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
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="ens33"
UUID="3290a5da-7376-4b46-8101-58241a14dd1b"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="192.168.150.101"
PREFIX="24"
GATEWAY="192.168.150.2"
DNS1="192.168.150.2"
IPV6_PRIVACY="no"
注意其中的GATEWAY="192.168.150.2"
。
控制虚拟机所在主机的网络连接,将 V8 的网关设置为和 GATEWAY 一致,将首选 DNS 设置为和 DNS1 一致:
修改后就能够 ping 通了。