Configuring Open vSwitch(OVS), Linux bridge, Libvirt ==================================================== Install ------- Install the Open vSwitch package, this is on Fedora 19: $ yum install openvswitch -y Enable the openvswitch systemd unit file, and start the daemon: $ systemctl enable openvswitch.service $ systemctl start openvswitch.service Check the status, to ensure the openvswithc service is 'Active': $ systemctl status openvswitch.service Configure a Linux bridge ------------------------ Disable NetworkManger service: $ systemctl disable NetworkManager.service Enable classic networking: $ systemctl enable network.service Create a file '/etc/sysconfig/network-scripts/ifcfg-br0' reflecting the below contents: $ cat ifcfg-br0 DEVICE=br0 ONBOOT=yes TYPE=Bridge BOOTPROTO=dhcp DELAY=0 Append the line BRIDGE=br0 to '/etc/sysconfig/network-scripts/ifcfg-em1' (or 'ifcfg-eth0'), save it: An example: $ cat ifcfg-eth0 DEVICE=eth0 ONBOOT=yes NETBOOT=yes UUID=3eee8eaf-6e5f-40ae-bdd5-3f0ecab84e94 BOOTPROTO=dhcp HWADDR="e4:1f:13:41:03:e4" TYPE=Ethernet BRIDGE=br0 Stop NetworkManager service: $ systemctl stop NetworkManager.service Restart classic network service: $ systemctl restart network.service Check the unit-file status of network & NetworkManger service: $ systemctl is-enabled network.service $ systemctl is-enabled NetworkManager.service Your bridge(br0) will have the IP address , (and your em1 or eth0 interface will lose the IP address - which is expected). $ ifconfig br0 Configure Open vSwitch ---------------------- Now that a regular Linux bridge is configured, let's try to configure an OVS brdige and get IP addresses from that space: Create an Open vSwitch bridge device called 'ovsbr', and display the current state of OpenvSwitch database contents: $ ovs-vsctl add-br ovsbr $ ovs-vsctl show Add a pair of virtual ethernet interfaces 'veth0' and 'veth1': $ ip link add name veth0 \ type veth peer name veth1 Add 'veth0' ethernet device to the Linux bridge 'br0', and enumerate all bridge devices: $ brctl addif br0 veth0 $ brctl show Now, associate virtual ethernet device 'veth1' to the OVS bridge, and display the current state of OpenvSwitch database contents $ ovs-vsctl add-port ovsbr veth1 $ ovs-vsctl show Bring up both the virtual ethernet interfaces 'veth0' and 'veth1' $ ip link set veth0 up && \ ip link set veth1 up Update libvirt guest's bridge source to OVS ------------------------------------------- Install a minimal Fedora guest with Oz (or any other mechanism): $ wget \ https://github.com/kashyapc/virt-scripts/blob/master/oz/oz-jeos.bash $ ./oz-jeos f19-min f19 Once install is finished, define the guest XML from the current dir: $ virsh define f19-minJul_12_2013-12 Now let's edit libvirt's guest XML file to reflect its bridge source is OVS bridge: $ virsh edit f19-min The contents of the guest XML should reflect something along the below lines: $ virsh dumpxml f19-min | grep bridge -A8
Start the guest, and the IP should be from the same subnet as the host: $ virsh start f19-jeos --console $ ifconfig eth0