Set up a network bridge - Ubuntu 12.04 LTS +


(Jason Bayton) #1

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

1. 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. 2. 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 bridge named br0. The simplest edit to make is as follows (note the emphasis): # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto br0 iface br0 inet dhcp bridge_ports eth0 iface eth0 inet manual This will set the eth0 interface to manual and create a new bridge that piggybacks directly off it. If you wish to create a static interface while you’re editing this file, the following may help you:…