Skip to main content

Libvirt Bridged Setup

Being fond of different automatic setups when things just work after a bit of manual tweaking, i decided to let OpenSolaris go to the home network, i.e. have a nice 192.168.1.x address from my Linksys router and access the internet as if it was a regular machine.

After reading this, I’ve spent a couple of moments trying to create a network definition that could simply bridge vnet{something} to my ethernet card. I got some iptables rules added but no real effect. Until I read Bridge to LAN carefully. I should have just specified the name of the bridge in VM configuration instead of a global one. Phew.

So if you want to do this kind of setup, first (on a Ubuntu system) create bridge definition in /etc/network/interfaces like

auto br0

iface br0 inet static
    address 192.168.1.3
    netmask 255.255.255.0
    bridge_ports eth0

And in your vm configuration file simply attach the virtual ethernet to the bridge:

<interface type='bridge'>
  <source bridge='br0'/>
  <mac address='52:54:00:00:00:11'>
</interface>

Yep, libvirt adds another level of configuration that could be easily performed in your own scripts, but I just tired to maintain my own set of scripts that perform the same functions as libvirtd does.