Ubuntu从18.04开始有了大的版本改动,网络配置有些不一样。
找到网路配置修改的yaml:
cd /etc/netplan boonya@boonya-VirtualBox:/etc/netplan$ ls 01-network-manager-all.yaml boonya@boonya-VirtualBox:/etc/netplan$ sudo vi 01-network-manager-all.yaml
添加静态IP:
# Let NetworkManager manage all devices on this system network: ethernets: enp0s3: dhcp4: no addresses: [192.168.0.10/24] gateway4: 192.168.0.1 nameservers: addresses: [192.168.0.1,61.139.2.69] version: 2 renderer: NetworkManager
使网路配置生效:
sudo netplan apply
本人博客园地址:Ubuntu20.04设置静态IP - boonya - 博客园