环境:
Os:18.04.1
1.备份配置文件
root@11g:~# cd /etc/netplan
root@11g:/etc/netplan#
root@11g:/etc/netplan# cp 01-network-manager-all.yaml bak_01-network-manager-all.yaml
2.配置静态ip
# Let NetworkManager manage all devices on this system network: ethernets: enp0s3: addresses: [192.168.56.101/24] gateway4: 192.168.56.1 dhcp4: no dhcp6: no nameservers: addresses: [8.8.8.8,8.8.4.4] optional: true version: 2
3.配置完成后,应用命令:
root@11g:/etc/netplan# netplan apply /etc/netplan/01-network-manager-all.yaml:12:4: Invalid YAML: inconsistent indentation: version: 2 ^
我这里上格式问题,调整后再次执行,最后文件内如如下:
root@11g:/etc/netplan# more 01-network-manager-all.yaml # Let NetworkManager manage all devices on this system network: ethernets: enp0s3: addresses: [192.168.56.101/24] gateway4: 192.168.56.1 dhcp4: no dhcp6: no nameservers: addresses: [8.8.8.8,8.8.4.4] optional: true version: 2
标签:11g,netplan,network,8.8,配置,网络,etc,ubuntu,addresses From: https://www.cnblogs.com/hxlasky/p/18278294