我按照说明操作,但是没有效果。
这是我的原始00-installer-config.yaml
文件:
# This is the network config written by 'subiquity'
network:
ethernets:
enp2s0:
dhcp4: true
enxc21a33ea90c1:
dhcp4: true
version: 2
...编辑之后的样子如下:
# This is the network config written by 'subiquity'
network:
ethernets:
enp2s0:
dhcp4: no
enxc21a33ea90c1:
dhcp4: no
version: 2
renderer: NetworkManager
bridges:
br0:
interfaces: [enp2s0]
addresses: [192.168.8.108/24]
nameservers:
addresses: [8.8.8.8,4.4.4.4]
运行后出现此错误sudo netplan apply
:
/etc/netplan/00-installer-config.yaml:11:15: Error in network definition: expected mapping (check indentation)
br0:
有人能指出哪里出了问题吗?
答案1
Netplan(使用 YAML)对缩进很挑剔。尝试像这样格式化文件,看看是否有效:
# This is the network config written by 'subiquity'
network:
ethernets:
enp2s0:
dhcp4: no
enxc21a33ea90c1:
dhcp4: no
version: 2
renderer: NetworkManager
bridges:
br0:
interfaces: [enp2s0]
dhcp4: no
addresses: [192.168.8.108/24]
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
br0:
我发现的主要错误是和之间缺少缩进interfaces:
。
此外,并不是说辅助 Google DNS 是8.8.4.4
。 也不是4.4.4.4
。