Bridge interface in Ubuntu 14.04

Bridging a interface has some advantages. When using KVM as a virtual environment you may want or must use a bridged interface.
VirtualBox has this feature already built in. But using something like virt-manager (libvirt) you have to set it up yourself. But thankfully it’s not that hard.

Note: To bridge a interface in Ubuntu you have to remove the Network Manager (the network icon in the upper right corner of your screen). This is because Network Manager
keeps overwriting any changes you make to the interfaces in Ubuntu. But don’t worry if you regret your decision you can just install it again with the command sudo apt-get install network-manager
If you still want a type of network manager, making it easier to connect to wifi networks, you could install wicd. I’ve tried it and i’m satisfied with it functionality. To install it, simply type; sudo apt-get install wicd-gtk

First we need to install bridge-utils to be able to create a bridge interface, we do this by issuing the following command:

sudo apt-get install bridge-utils

Then we need to remove the Network manager, we do this with the command:

sudo apt-get purge network-manager

Then we have to add a bridge interface, we do this with the command:

sudo brctl addbr br0

Now we have to configure the interface settings, open the file /etc/network/interfaces with your favorite editor.
Then change the file to the following:

#auto eth0
#iface eth0 inet dhcp

auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

After this is is done we have to reboot.

sudo reboot

The process is done and we now have a bridged interface.
Check your settings with ifconfig and try to ping Googles public dns (8.8.8.8).

Screenshot-from-2014-11-03-130604-300x162

Note: This should work on most of the Linux distributions that are using net-tools. One famous distribution that this do not work on is Arch Linux. That is because Arch Linux is not using net-tools as default, they’re using systemd stuff. But it can be made possible with the use of netctl. I’ve written a post about it and you can find it here: Bridge Interface in Arch Linux

Leave a Reply

Your email address will not be published. Required fields are marked *