打开文件地址:sudo vim /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
eno1:
dhcp4: false
addresses: [192.168.0.112/24]
optional: true
routes:
- to: default
via: 192.168.0.1
nameservers:
addresses: [192.168.0.1]
将静态ip地址修改为: 192.168.0.112
重启网卡
sudo netplan apply
或重启机器
sudo reboot