Our Sample Setup
The following describes the networking used by our setup:+------+ +-----+Where,
LAN --> | eth0 | <==> | br0 | -> KVM VMs connected to LAN for SAN/NFS
+------+ +-----+
10.10.x.y/24
+------+ +-----+
Internet --> | eth1 | <==> | br1 | -> KVM VMs connected to the Inernet
+------+ +-----+
123.1.2.0/28
- All other clients can reached to all VMs via br1 which is connected to public interface. br1 is our default gateway.
- br0 is connected to private LAN to access other servers, services and storage devices such as SAN/NAS or NFS servers. br0 route is configured via route-br0 static networking configuration file.
Turn Off NetworkManager
The NetworkManager (GUI) tool can create problems with bridged based networking so disable it as follows, enter:# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
Edit /etc/sysconfig/network, enter:
# vi /etc/sysconfig/network
Update file as follows:
Save and close the file.
NETWORKING=yes
HOSTNAME=kvm42.nixcraft.net
GATEWAY=br1
br0: Configure Bridging for eth0
Edit /etc/sysconfig/network-scripts/ifcfg-eth0, enter:# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Update it as follows:
Save and close the file. Create /etc/sysconfig/network-scripts/ifcfg-br0, enter:
DEVICE=eth0
ONBOOT=yes
ETHTOOL_OPTS="autoneg off speed 100 duplex full"
BRIDGE=br0
HWADDR=b8:ac:6f:65:31:e5
# vi /etc/sysconfig/network-scripts/ifcfg-br0
Update it as follows (note options are case sensitive i.e. Bridge and bridge are two different options)
Save and close the file. Finally, create static routing file /etc/sysconfig/network-scripts/route-br0, enter :
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.10.21.70
NETMASK=255.255.255.192
DELAY=0
# vi /etc/sysconfig/network-scripts/route-br0
Edit it as follows:
10.0.0.0/8 via 10.10.21.122 dev br0Save and close the file. Delete old /etc/sysconfig/network-scripts/route-eth0 (if exists):
# rm /etc/sysconfig/network-scripts/route-eth0
br1: Configure Bridging for eth1
Edit /etc/sysconfig/network-scripts/ifcfg-eth1, enter:# vi /etc/sysconfig/network-scripts/ifcfg-eth1
Update it as follows:
Please note that test server is set to 100Mbps full duplex. Save and close the file. Edit /etc/sysconfig/network-scripts/ifcfg-br1, enter:
DEVICE=eth1
ONBOOT=yes
ETHTOOL_OPTS="autoneg off speed 100 duplex full"
BRIDGE=br1
HWADDR=00:30:49:8c:48:ad
# vi /etc/sysconfig/network-scripts/ifcfg-br1
Define public IP address including gateway as follows:
Save and close the file.
DEVICE=br1
BOOTPROTO=static
ONBOOT=yes
IPADDR=123.1.2.3
NETMASK=255.255.255.248
GATEWAY=123.1.2.200
TYPE=Bridge
DELAY=0
Restart Network Service
Type the following command:# service network restart
Make sure everything is working fine:
# brctl show
Sample outputs:
bridge name bridge id STP enabled interfacesVerify IPs and routing tables:
br0 8000.0030488e31ac no eth0
br1 8000.0030488e31ad no eth1
virbr0 8000.000000000000 yes
# ip addr show br0
# ip addr show br1
# ip route
# ping cyberciti.biz
# host google.com
No comments:
Post a Comment