Xen Networking in Fedora 7+ and RHEL

dale's picture

Starting with Fedora 7 if you use Xen you will notice a new subnet and a
bridge automagically being created by libvirt. This is great for desktop experimenting, but if you are running this on a server you probably have an opinion on how your network should be configured.

Here's how to revert to manually controlled network settings.

Disable the bridge script:

Edit /etc/xen/xend-config.sxp and change "(network-script network-bridge)" to "(network-script /bin/true)".

Configure network-scripts:

Configure /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
BRIDGE=br0

Configure /etc/sysconfig/network-scripts/ifcfg-br0

# cat ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.10.0.1
NETMASK=255.255.255.0
NETWORK=10.10.0.0
BROADCAST=10.10.0.255

Now your primary IP of your dom0 lives on the br0 interface. Your domU's will be on the same VLAN and should see your DHCP server. Don't forget to enable IP forwarding.

Adjust routing and filtering:

Allow forwarding across the bridge by modifying iptables.

iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
service iptables save

You may need this depending on subnetting

sysctl -w net.ipv4.ip_forward=1

Add it to /etc/sysctl.conf to make it stick

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

See also: