1.nat
2. only host
auto lo
iface lo inet loopback
auto enp0s3
iface enp0s3 inet dhcp
auto enp0s8
iface enp0s8 inet static
address 192.168.56.12
netmask 255.255.255.0
#不要gateway ,用nat 走外网上网
3 /etc/resolv.conf
nameserver 127.0.1.1
1.nat
2. only host
auto lo
iface lo inet loopback
auto enp0s3
iface enp0s3 inet dhcp
auto enp0s8
iface enp0s8 inet static
address 192.168.56.12
netmask 255.255.255.0
#不要gateway ,用nat 走外网上网
3 /etc/resolv.conf
nameserver 127.0.1.1
原文:https://www.cnblogs.com/anjunact/p/8323469.html