Setup bridged networking KVM

Bridged networking is very handy in virtual environments as it allows guests to receive IPs in the same address range as the host. I.e if the host as an IP 192.168.100.3 then the guest will receive an IP of 192.168.100.4 as an example. This is fairly simple to setup.

Run on the following on the host:

sudo brctl addbr br0

The above command simply adds another interface called br0.

sudo brctl addif br0 eth0

The above command creates the bridge between br0 and eth0 interfaces.

The next step is to edit the networking interfaces:

sudo nano /etc/network/interfaces

Paste the following:

# Establishing which interfaces to load at boot and establish the loopback
auto lo br0
iface lo inet loopback

# Set the existing interface to manual to keep it from interfering with the bridge via DHCP
iface eth0 inet manual

# Create the bridge and set it to DHCP.  Link it to the existing interface.
iface br0 inet dhcp
bridge_ports eth0

The final step is to restart networking using:

sudo service networking restart

It should be noted that it is important to include the following tag when running virt-install:

–network bridge=br0

Note that br0 corresponds with the name of the bridge created above.