1

I am new to netplan and Ubuntu 18.04 , and am trying to set up a VM host using qemu/libvert. The issue is with creating a netplan yaml file that meets our needs and works

  • Interface eno1 is a management interface. It works fine in the configuration below.
  • Interface eno2 will be a dedicated trunk to provide connectivity to the VMs with the rest of the network with a .1Q trunk.
  • The interface the VMs will access is a trunk with 4 seperate .1Q tagged vlans.
  • Each VM needs direct access to the network using a local IP address (to the VM) assigned to the appropriate bridge/vlan.
  • No NAT on the network interfaces of the host.
  • As a network engineer, I still belive a "bridge" is Layer 2. No need for an IP address (which also implies traffic will be NAT'ed on the interface)

The bridging/vlan examples at https://netplan.io/examples give me an error message:

Invalid YAML at //etc/netplan/01-netcfg.yaml line 24 column 5: did not find expected key

System details:

  • OS: Ubuntu 18.04 LTS
  • netplan: netplan/bionic 1.10.1-5build1 amd64
  • qemu/kvm: qemu-kvm/bionic-updates,now 1:2.11+dfsg-1ubuntu7.4 amd64 [installed] qemu-kvm/bionic-security 1:2.11+dfsg-1ubuntu7.3 amd64 qemu-kvm/bionic 1:2.11+dfsg-1ubuntu7 amd64

Any help would be appreciated.

/etc/netplan/01-netcfg.yaml contents:

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      addresses:
        - 192.168.xxx.7/24
      gateway4: 192.168.xxx.1
      nameservers:
        addresses:
          - 192.168.xxx.3
          - 9.9.9.9
    eno2: {}

  bridges:
    br20:
      dhcp4: no
      dhcp6: no
      interfaces: [ vlan20 ] <<=This is line 24 in the error message
     br50:
      dhcp4: no
      dhcp6: no
      interfaces: [ vlan50 ]
     br90:
      dhcp4: no
      dhcp6: no
      interfaces: [ vlan90 ]
     br100:
      dhcp4: no
      dhcp6: no
      interfaces: [ vlan100 ]

  vlans:
    vlan1:
      dhcp4: no
      dhcp6: no
      accept-ra: no
      id: 1
      link: eno2
    vlan20:
      dhcp4: no
      dhcp6: no
      accept-ra: no
      id: 20
      link: eno2
    vlan50:
      dhcp4: no
      dhcp6: no
      accept-ra: no
      id: 50
      link: eno2
    vlan90:
      dhcp4: no
      dhcp6: no
      accept-ra: no
      id: 90
      link: eno2
    vlan100:
      dhcp4: no
      dhcp6: no
      accept-ra: no
      id: 100
      link: eno2
1

br50, br90 and br100 are all indented one space too many. They need to line up with br20 like:

  bridges:
    br20:
      dhcp4: no
      dhcp6: no
      interfaces: [ vlan20 ]
    br50:
      dhcp4: no
      dhcp6: no
      interfaces: [ vlan50 ]
    br90:
      dhcp4: no
      dhcp6: no
      interfaces: [ vlan90 ]
    br100:
      dhcp4: no
      dhcp6: no
      interfaces: [ vlan100 ]
  • Thanks Stephen! That worked. I thought I had already worked through the yaml indentation issues (stupid yaml...). Removed the spaces and it worked. I appreciate your quick reply. – Confused Guy Jul 8 '18 at 17:57
  • As for YAML, it it is actually a very nice ML. Suggest using an editor that is YAML aware. It can show these issues immediately. – Stephen Rauch Jul 8 '18 at 18:01
  • Of course. Where were my manners... Thanks again! – Confused Guy Jul 9 '18 at 3:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.