Tuesday, July 27, 2010
Enabling Bridged Networking in RedHat 6 Beta 2
# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start
# cd /etc/sysconfig/network-scripts
Edit ifcfg-eth0 to read:
Note: HWADDR= line does not appear to be needed.
Create and edit ifcfg-br0 to read:
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.
# cd /etc/libvirt/qemu
# virsh create virtual_machine_name.xml
# 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: KVM RedHat 6 virtualization