User Tools

Site Tools


ubuntu_systemd_bridge

Creating a systemd network bridge rather than using Network-Manager

A lot of this I borrowed from the Arch Linux Page here

If you are doing this on a machine which you cannot physically access, I'd suggest stopping/removing Network Manager only when you've set it up and not before you follow this.

Firstly, I just removed Network Manager

  sudo apt-get remove network-manager

Then, I enabled the systemd network service

  sudo systemctl enable systemd-networkd.service

I was a bit worried if the resolvconf for Ubuntu would continue or stop working, so I did this to avoid any risk

  sudo systemctl enable systemd-resolved
  sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

Get the name of your network interface by running the following command

  ip addr show

There are 3 types of files that systemd uses for configuring this, but we only need two. .network files will apply the configuration of a matching device name and .netdev will create the network device for the matching environment (in this case, that's the bridge)

So, we'll start by creating the file for eth0 (which was my device in this case). /etc/systemd/network/uplink.network

  [Match]
  Name=enp4s0
   
  [Network]
  Bridge=br0

Then /etc/systemd/network/br0.network (Use the settings applicable to your network. These are examples)

  [Match]
  Name=br0
   
  [Network]
  DNS=62.241.198.245 
  DNS=62.241.198.246
  Address=10.10.10.1/24
  Gateway=10.10.10.254

Lastly, the .netdev rule /etc/systemd/network/br0.netdev

  [NetDev]
  Name=br0
  Kind=bridge

Finally, reboot (because that way you'll know if it persists through a reboot and/or if there are other issues.

Once rebooted, you can use networkctl to check if it all worked.

Mine looked something like this:

  IDX LINK             TYPE               OPERATIONAL SETUP     
  1   lo               loopback           carrier     unmanaged 
  2   eth0             ether              degraded    configured
  3   sit0             sit                off         unmanaged 
  4   ip6tnl0          tunnel6            off         unmanaged 
  5   bond0            ether              off         unmanaged 
  6   br0              ether              routable    configured
  7   lxcbr0           ether              no-carrier  unmanaged 
  
  7 links listed.

When I set this up, IPv6 autoconfiguration kicked in for the br0 adapter. So I presume that if you do have an IPv6 DHCP server on your network (or your ISP manages this for you), then you shouldn't need to worry about configuring IPv6 automatically (unless you need to).

ubuntu_systemd_bridge.txt · Last modified: 2017/06/18 13:57 by steve