查看网络服务运行状态
sudo systemctl status systemd-networkd
查看当前ip地址
ifconfig
修改网络配置
sudo vim /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
enp2s0:
dhcp4: true
version: 2
改为
# This is the network config written by 'subiquity'
network:
ethernets:
enp2s0:
dhcp4: no
addresses: [192.168.1.232/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.8.4]
version: 2
测试配置是否生效
sudo netplan try
应用新的网络配置
sudo netplan apply