Having NetworkManager in place doesn’t help setting up bridges. Still, it is useful especially on laptops. I need virtualization on my laptop, because i use it for demos away from my office.
This is about creating bridges on Fedora for use with Libvirt applications, Like the KVM Xen hypervisors.

Guests can connect to the outside world by two means: “virtual network” or “shared device”. The former is a one way traffic from inside to the outside, nobody can connect to the guest. it’s enough for desktops.

The second allows both directions traffic, that’s what we gonna do. We assume NetworkManager is in place, handling two NICs, eth0 and wlan0.

We’ll need to:

  • disable NetworkManager for eth0,
  • create bridge br0,
  • tweak iptables,
  • add interfaces to the bridge.

Disbaling NetworkManager

Fire up system-config-network, and uncheck “Controlled by NetworkManager” on eth0 properties.
Set the network service to start on boot:
chkconfig network on

Create bridge br0

Add the bridge br0 configuration, by creating the file:

/etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0

The TYPE=Bridge, must be spelled with a capital “B”.
Proceed to ifcfg-eth0, in the same location, and add these lines:

BRIDGE=br0
MTU=9000

MTU adjusting is optional.
and finally, restart network.

Tweak iptables

We will disable iptables for the bridge. Actually on Fedora 12, it’s already disabled, just ensure or add these lines to /etc/sysctl.conf:

# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0

It’s said, it’s better for performance reasons, see Fedora bug #512206.

Adding interfaces

Now we will add a bridged interface for each guest we will install. Actually we already have included eth0 in the bridge:

[root@mishket ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.001a4b70924c no eth0
virbr0 8000.000000000000 yes

We will use tunctl, to add virtual interfaces for guests will. You might need to install it before:

[root@mishket ~]# yum -y install tunctl

Than, create tap0, and add it to the bridge:

[root@mishket ~]# tunctl -t tap0
[root@mishket ~]# brctl addif br0 tap0
[root@mishket ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.001a4b70924c no eth0
tap0
virbr0 8000.000000000000 yes

Finally

Finally you add a bridged interface, to new or already created guests through virt-manager. You’ll need a virtual interface for each guest.
Like we did, all interfaces will get their configuration by DHCP, unless you set’em up manually on the guest, but remember, it has to be part of your LAN.