一、
ip addresssudo nano /etc/netplan/50-cloud-init.yaml
修改前:
修改后:
====================================================================
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:ethernets:enp0s3:dhcp4: noaddresses: [192.168.31.142/24]optional: trueroutes:- to: defaultvia: 192.168.31.1nameservers:addresses: [114.114.114.114,8.8.8.8]version: 2
====================================================================
sudo netplan apply #生效