Set up a network bridge - Ubuntu 12.04 LTS +

Originally published at: https://bayton.org/2016/10/set-up-a-network-bridge-ubuntu-12-04-lts/

Article extract The following is a modified extract from LXD, ZFS and bridged networking on Ubuntu 16.04 LTS. As bridged networking is quite a popular topic I felt it’s worth its own post to reduce the need to go looking for it in the longer guides I’ve written. I’ll also link to it from new guides going forward. NB: Ubuntu 12.04 LTS is the earliest release I’ve used this with. It should work on earlier versions as well, but your mileage may vary. Installation In order to set up a network bridge, the package bridge-utils needs to be installed. Install it with: sudo apt-get install bridge-utils The output should look similar to below: Reading package lists… Done Building dependency tree Reading state information… Done The following NEW packages will be installed: bridge-utils 0 upgraded, 1 newly installed, 0 to remove and 16 not upgraded. Need to get 28.6 kB of archives. […] Preparing to unpack …/bridge-utils_1.5-9ubuntu1_amd64.deb … Unpacking bridge-utils (1.5-9ubuntu1) … Processing triggers for man-db (2.7.5-1) … Setting up bridge-utils (1.5-9ubuntu1) … This is mandatory If bridge-utils isn’t installed before moving on, it won’t be possible to bring up the new bridge and will likely result in loss of network access entirely. Configuration With the bridge-utils package installed, begin by opening /etc/network/interfaces in a text editor. I like vim: sudo vim /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp This is the default interfaces file. Within this file add a new…