vim /etc/network/interfaces
修改配置文件
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.200 # local IP Address
gateway 192.168.0.1
netmask 255.255.255.0
dns-nameservers 8.8.8.8 # specify dns server
vim /etc/netplan/50-cloud-init.yaml
修改配置文件
network:
ethernets:
eth0:
dhcp4: false
addresses: [192.168.0.200/24]
gateway4: 192.168.0.1
nameservers:
addresses: [8.8.8.8]