0

I have an Ubuntu 16.04 host with 6 LXC/LXD containers connected to the Internet in both directions using a routed setup. Each container gets one IPv4 address from a routed IPv4/29 subnet. In addition it gets one IPv6 address from an IPv6/64 subnet.

Now, as I'm migrating to Ubuntu 18.04 I wanted to migrate my setup to Netplan as well but got stuck. I have no problems creating the basic Netplan configuration for the host. But I dont know how to create the "bridge/router". Any attempt to configure a bridge (layer 3) failed in one or the other way.

This is how my old configuration looks like:

# /etc/network/interfaces
# Loopback device:
auto lo
iface lo inet loopback
iface lo inet6 loopback

# device: eth0
auto eth0
iface eth0 inet static
  address 88.99.64.130
  netmask 255.255.255.192
  pointopoint 88.99.64.129
  gateway 88.99.64.129

iface eth0 inet6 static
  address 2a01:4f9:c010:32bc::2
  netmask 128
  gateway fe80::1
  up sysctl -p

### From here on I dont know how to do this in Netplan!!!
# Bridge router to VMs (brouter)
auto br0
iface br0 inet static
  address 88.99.64.130
  netmask 255.255.255.192
  bridge_ports none
  bridge_stp off
  bridge_fd 0

  # Add IPv4 subnet route
  up ip route add 94.130.31.40/29 dev br0

iface br0 inet6 static
  address 2a01:4f9:c010:32bc::2
  netmask 128

  # Add IPv6 route
  up ip -6 route add  2a01:4f9:c010:32bc::/64

To make it more clear for people who dont know LXC/LXD, I have another host with a much similar configuration for VirtualBox where I called the bridge "virbr0" (instead of "br0" in my example). The VM's in the VirtualBox are then attached to the Bridged Adapter with the name "virbr0".

In the VM's running in the VirtualBox it's a simple static configuration. I have no problems with Netplan inside the VM's. My issues are related to the host only.

Maybe someone can post an example for this kind of routed setup.

1
  • See these examples here.
    – heynnema
    Oct 24, 2018 at 22:03

1 Answer 1

0

From https://netplan.io/examples

Bridging

To create a very simple bridge consisting of a single device that uses DHCP, write:

network:
  version: 2
  renderer: networkd
  bridges:
    br0:
      dhcp4: yes
      interfaces:
        - enp3s0

A more complex example, to get libvirtd to use a specific bridge with a tagged vlan, while continuing to provide an untagged interface as well would involve:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s25:
      dhcp4: true
  bridges:
    br0:
      addresses: [ 10.3.99.25/24 ]
      interfaces: [ vlan15 ]
  vlans:
    vlan15:
      accept-ra: no
      id: 15
      link: enp0s25

Then libvirtd would be configured to use this bridge by adding the following content to a new XML file under /etc/libvirtd/qemu/networks/. The name of the bridge in the tag as well as in need to match the name of the bridge device configured using netplan:

<network>
  <name>br0</name>
  <bridge name='br0'/>
  <forward mode="bridge"/>
</network>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .