Tuesday, July 27, 2010

Enabling Bridged Networking in RedHat 6 Beta 2

I decided to play around with the Redhat 6 beta 2 64 bit (x86_64) version since Xen is going away after RedHat version 5. Instructions on enabling bridged networking for a KVM server are rather scarce on the Internet and what few there are don't work well. Well, I found part of the answer here. In brief, perform the following steps:

# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start
# cd /etc/sysconfig/network-scripts

Edit ifcfg-eth0 to read:

DEVICE=eth0
ONBOOT=yes
BRIDGE=br0

Note: HWADDR= line does not appear to be needed.

Create and edit ifcfg-br0 to read:

DEVICE=br0
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=none
IPADDR=192.168.1.5
GATEWAY=192.168.1.1
STP=off
DELAY=0


Change your IP address (IPADDR variable) and gateway (GATEWAY variable) to suit your network environment.

Restart the network:
# service network restart

Configure iptables to forward traffic accross the bridge:

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

Restart the libvirtd daemon:
# service libvirtd reload

Check to see if your bridge br0 exists:
# brctl show

Should it still not work, in Virtual Machine Manager, go to Edit -> Host Details -> Network Interfaces and add a br0 interface if it is missing. This should rebuild the ifcfg-br0 script in /etc/sysconfig/network-scripts. Restart your network again.

To migrate your virtual machines from the default virtual network which is NATed, change directory to /etc/libvirt/qemu and edit your virtual machine's xml file.

Change interface type='network' to interface type='bridge'.
Change source network='default' to source bridge='br0'.

Altering those two lines should do it.
Then,
# cd /etc/libvirt/qemu
# virsh create virtual_machine_name.xml
(e.g.
# virsh create kubuntu-kvm.xml
Domain kubuntu-kvm created from kubuntu-kvm.xml)

If the virsh create command produces an error, note it carefully and check your edited xml file.

Labels:


Comments: Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?