Setting Up a DHCP Bridge in Ubuntu 10.10 for Virtualization

Setting up a network bridge allows you to give a virtual machine it’s own IP address and make it accessible from the outside. A DHCP bridge is useful in a smaller network where static IPs aren’t assigned - like in a home or small office. You’ll want to do this if you’re setting up LXC or KVM.

This is what my /etc/network/interfaces config looks like.

`` auto lo iface lo inet loopback

auto eth0 iface eth0 inet manual

auto br0 iface br0 inet dhcp bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0

The 2nd block configures your hard connection - in my case it's eth0.  The last block configures the virtual device - br0, to bridge using the eth0 connection.  If yours is named differently, you'll want to change the settings appropriately.

Last step - restart networking.

/etc/init.d/networking restart

I'll be setting up KVM in a future tutorial.  Have fun!