Ubuntu20配置仅主机网络,使虚拟机与物理机网络联通且配置固定IP
进入终端:vim /etc/netplan/01-network-manager-all.yaml
修改为:
network:
ethernets:
enp0s8:
addresses: [192.168.138.108/24]
dhcp4: false
optional: true
gateway4: 192.168.138.1
nameservers:
addresses: [192.168.138.1,114.114.114.114]
version: 2
renderer: NetworkManager
注:
网卡:enp0s8
要固定的IP:192.168.138.108
改静态:dhcp4: false
网关:gateway4: 192.168.138.1