1、静态ip
/etc/netplan# vi 00-installer-config.yaml
设置ip如下
# This is the network config written by ‘subiquity‘ network: ethernets: enp0s3: dhcp4: false addresses: [192.168.137.122/24] optional: true gateway4: 192.168.137.1 nameservers: addresses: [114.114.114.114] version: 2
2、动态
把dhcp4改成true即可
3、然后使生效
sudo netplan apply
4、查看网关方法
route -n