在Ubuntu20.04中已经不使用/etc/networks/interface来配置网络了,而是使用netplan配置网络:
# cat /etc/netplan/00-installer-config.yaml
这是DHCP配置IP:
# This is the network config written by 'subiquity'
network:
ethernets:
ens18:
dhcp4: true
version: 2
这是固定IP:
network:
ethernets:
ens18:
addresses: [172.18.176.239/24]
dhcp4: no
optional: true
gateway4: 172.18.176.254
nameservers:
addresses: [114.114.114.114]
version: 2