virtualbox 上的虚拟机设置,先桥接
[root@localhost network-scripts]# cat ifcfg-enp0s3
TYPE=Ethernet
PROXY_METHOD=none
NETMASK=255.255.255.0
IPADDR=192.168.43.88
BROADCAST=192.168.43.255
GATEWAY=192.168.43.110
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=enp0s3
UUID=88ed467d-91f4-4e8b-adcf-e8f4379bc35e
DEVICE=enp0s3
ONBOOT=yes
DNS1=192.168.43.110
DNS2=8.8.8.8
192.168.43.110 是主机的dns 使用route 命令获取
lingzhang@lingzhang-e470:~/.config$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.43.110 0.0.0.0 UG 600 0 0 wlp5s0
192.168.43.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp5s0
[root@localhost network-scripts]# cat /etc/resolv.conf
Generated by NetworkManager
nameserver 192.168.43.110
nameserver 8.8.8.8
网友评论