ubuntu 18_04 LTS 网络计划

ubuntu 18_04 LTS 网络计划
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled} network:

network:
    ethernets:
        eno1:
            addresses:
            - 10.10.6.50/24
            dhcp4: false
            gateway4: 10.10.6.1
            nameservers:
                addresses:
                - 8.8.8.8
                - 8.8.4.4
                search: []
        enp3s2:
            dhcp4: false
  bridges:
    br0:
      dhcp4: false
      interfaces:
        - enp3s2
            addresses:
            - 10.10.7.50/24
    version: 2

当我运行时sudo netplan apply 出现以下错误

//etc/netplan/50-cloud-init.yaml 第 17 行第 2 列的 YAML 无效:未找到预期的密钥

我想要的只是创建一个可以工作的桥接网络但却无法使用 yaml,有人可以帮忙吗?

答案1

一些建议:

1) “version: 2” 必须与 “ethernets” 在同一层级。我习惯将其添加为 network 之后的第一行:

2)在两个配置(eno1 和 br0)上添加“dhcp6:false”

相关内容