10.2. Bridged networking with libvirt
If your system was using a Xen bridge, it is recommended to disable the default Xen network bridge by editing /etc/xen/xend-config.sxp and changing the line:
(network-script network-bridge)
(network-script network-bridge)
(network-script /bin/true)
(network-script /bin/true)
NetworkManager does not support bridging. Running NetworkManager will overwrite any manual bridge configuration. Because of this, NetworkManager should be disabled in order to use networking via the network scripts (located in the /etc/sysconfig/network-scripts/ directory):
chkconfig NetworkManager off chkconfig network on service NetworkManager stop service network start
# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start
Note
NM_CONTROLLED=no" to the ifcfg-* scripts used in the examples. If you do not either set this parameter or disable NetworkManager entirely, any bridge configuration will be overwritten and lost when NetworkManager next starts.
Create or edit the following two network configuration files. This step can be repeated (with different names) for additional network bridges.
/etc/sysconfig/network-scripts directory:
cd /etc/sysconfig/network-scripts
# cd /etc/sysconfig/network-scripts
ifcfg-eth0 defines the physical network interface which is set as part of a bridge:
Note
MTU variable to the end of the configuration file.
MTU=9000
MTU=9000
/etc/sysconfig/network-scripts directory called ifcfg-br0 or similar. The br0 is the name of the bridge; this name can be anything as long as the name of the file is the same as the DEVICE parameter.
Note
ifcfg-br0 file). Network access will not function as expected if IP address details are configured on the physical interface that twehe bridge is connected to.
Warning
TYPE=Bridge, is case-sensitive. It must have uppercase 'B' and lower case 'ridge'.
service network restart
# service network restart
iptables to allow all traffic to be forwarded across the bridge.
iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT service iptables save service iptables restart
# iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
# service iptables save
# service iptables restart
Note
iptables rules. In /etc/sysctl.conf append the following lines:
net.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
sysctl.
sysctl -p /etc/sysctl.conf
# sysctl -p /etc/sysctl.conf
libvirt daemon.
service libvirtd reload
# service libvirtd reload
brctl show
# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.000000000000 yes
br0 8000.000e0cb30550 no eth0
virbr0 bridge. Do not attempt to attach a physical device to virbr0. The virbr0 bridge is only for Network Address Translation (NAT) connectivity.