I need to convert our ifupdown setup which uses apt-get vlan and bridge-utils to Netplan but have been unable to get the same setup using Netplan. Here's the current /etc/network/interfaces config which needs to be converted:

# The loopback network interface
auto lo
iface lo inet loopback

# Mainframe network interface
auto standard
iface standard inet static
        address 172.16.0.6
        netmask 255.255.254.0
        network 172.16.0.0
        broadcast 172.16.1.255
        dns-nameservers 10.0.0.244
        dns-search example.com
        bridge_ports eno1
        post-up route add default gw 172.16.0.1
        pre-down route del default

# Printers network interface
auto vlan5
iface vlan5 inet manual
        address 0.0.0.0
        vlan-raw-device eno1
auto printers
        iface printers  inet manual
        address 0.0.0.0
        bridge_ports vlan5

# Game network interface
auto vlan4
iface vlan4 inet manual
       address 0.0.0.0
       vlan-raw-device eno1
auto gaming
        iface gaming inet manual
        address 0.0.0.0
        bridge_ports vlan4
  • I have a hard time understanding the intent of either your ifupdown or your netplan config. The 'standard' interface is reasonably straightforward, but the vlans are unclear. why are these 'manual'? why are you declaring an address 0.0.0.0? Why are you then using 172.16.0.0/23 as an address on vlan.1 in the netplan config? (Which is not a valid host address, it is a network address) – slangasek Sep 26 at 23:54
  • @slangasek, it's something I inherited. I think the idea is that we want all the containers attached to that bridge to be able to have an IP within that CIDR and for traffic to be tagged with a VLAN to enable it to through the switches correctly. A container attached to bridge printers should not be able to listen or assign itself an IP or a VLAN that is associated with gaming. – mrheroux Sep 27 at 15:22
  • That explains the rationale for use of multiple interfaces, but doesn't explain it at a level that clarifies what the expected resulting network config is. With the interfaces marked 'manual' in /etc/network/interfaces, this file provides an incomplete picture of the actual network configuration (addresses, etc). – slangasek Sep 28 at 19:17
  • There are no modifications being made using manual unless vlan or bridge-utlis automagically does so. I literally install those apt gets and use this file and everything works fine. -- So perhaps, manual is unnecessary @slangasek – mrheroux Sep 28 at 19:36
  • Please attach output of the command ip addr show when things are working fine. – slangasek Sep 29 at 20:17

I believe this config matches the intent of the /etc/network/interfaces file. It does not match the names of the vlan interfaces as shown in the screenshot; it is unclear why your vlans are named 'vlan2' and 'vlan3' in the screenshot but 'vlan4' and 'vlan5' in the e/n/i.

network:
    version: 2
    renderer: networkd
    ethernets:
         eno1:
            dhcp4: no
    bridges:
        # standard network 
        standard:
            interfaces: [eno1]
            addresses: [172.16.0.6/23]
            gateway4: 172.16.0.1
            nameservers:
                search: [example.com]
                addresses: [10.0.0.244]
        printers:
            interfaces: [vlan5]
        gaming:
            interfaces: [vlan4]
    vlans:
        vlan5:
            id: 5
            link: eno1
        vlan4:
            id: 4
            link: eno1

You should double-check what the vlan IDs are on your existing interfaces with ip -d link show vlan2 | grep 'vlan protocol' (and the same for vlan3) and adjust the id values above to match what is required for each interface.

up vote 0 down vote accepted

In Ubuntu 18.04 there is currently a bug with creating anonymous (without IPs) bridges in Netplan. You have to create /etc/systemd/network/br{#}.network file for each bridge, e.g.:

[Match]
Name=gaming

[Network]
LinkLocalAddressing=no
IPv6AcceptRA=no

Next, create a netplan file, e.g. /etc/netplan/50-cloud-init.yaml, containing the following:

network:
    version: 2
    renderer: networkd
    ethernets:
         eno1:
                 dhcp4: no
                 dhcp6: no
    bridges:
        # standard network 
        standard:
                addresses:
                       - 172.16.0.6/23
                gateway4: 172.16.0.1
                routes:
                        - to: 0.0.0.0/0
                          via: 172.16.0.1
                nameservers:
                        search: [ example.com ]
                        addresses:
                                - 10.0.0.244
                interfaces: [ eno1 ]
        # gaming network
        gaming:
                interfaces: [ vlan4 ]
        # printers network
        printers:
                interfaces: [ vlan5 ]
    vlans:
        vlan4:
                id: 4
                link: eno1
        vlan5:
                id: 5
                link: eno1                                      

Lastly run netplan apply.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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