openvswitch VLANs

testing out openvswitch VLAN capabilities, we decided to configure 2 servers this way:

(1) server named openvswitch has 2 NIC cards. One is eth0 IP address of 10.10.10.66 and the other is eth1 with IP address of 10.1.1.66. eth0 will use the openvswitch switch (br0) and eth1 is used for management and will not use the openvswitch.

root@openvswitch:~# ifconfig
br0 Link encap:Ethernet HWaddr b8:ac:6f:83:02:47
inet addr:10.10.10.66 Bcast:10.10.10.255 Mask:255.255.255.0
inet6 addr: fe80::baac:6fff:fe83:247/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:55 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:734 (734.0 B) TX bytes:9510 (9.5 KB)

eth0 Link encap:Ethernet HWaddr b8:ac:6f:83:02:47
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:560 errors:0 dropped:0 overruns:0 frame:0
TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:36094 (36.0 KB) TX bytes:7664 (7.6 KB)
Interrupt:16

eth1 Link encap:Ethernet HWaddr 68:05:ca:02:ec:37
inet addr:10.1.1.66 Bcast:10.1.1.255 Mask:255.255.255.0
inet6 addr: fe80::6a05:caff:fe02:ec37/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10983 errors:0 dropped:0 overruns:0 frame:0
TX packets:4037 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1449889 (1.4 MB) TX bytes:453823 (453.8 KB)
Interrupt:17 Memory:dfa60000-dfa80000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:412 errors:0 dropped:0 overruns:0 frame:0
TX packets:412 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:40732 (40.7 KB) TX bytes:40732 (40.7 KB)

(2) server named cloudctl has 2 NIC cards. One is eth0 IP address of 10.10.10.62 and the other is eth1 IP address of 10.1.1.62.

root@cloudctl:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:60:08:af:8a:a8
inet addr:10.10.10.62 Bcast:10.10.10.255 Mask:255.255.255.0
inet6 addr: fe80::260:8ff:feaf:8aa8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:516632 errors:0 dropped:0 overruns:0 frame:0
TX packets:495334 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:56507130 (56.5 MB) TX bytes:34333117 (34.3 MB)
Interrupt:22 Base address:0xbe00

eth1 Link encap:Ethernet HWaddr 00:40:ca:a5:7a:3b
inet addr:10.1.1.62 Bcast:10.1.1.255 Mask:255.255.255.0
inet6 addr: fe80::240:caff:fea5:7a3b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12405441 errors:0 dropped:0 overruns:0 frame:0
TX packets:8060288 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12507626044 (12.5 GB) TX bytes:2027562591 (2.0 GB)
Interrupt:20 Memory:fdfc0000-fdfe0000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2084258 errors:0 dropped:0 overruns:0 frame:0
TX packets:2084258 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:169503636 (169.5 MB) TX bytes:169503636 (169.5 MB)

Now we are ready to add the VLAN tag for 2 VM’s on eth0 on openvswitch. We had originally removed the virbr0 bridge (the default from KVM) and then ran the openvswitch script to set up the bridge. But now we want to set up VLANs, so first we deleted the openvswitch bridge so we an add it again:

so, first we show the bridge before we delete it:

root@openvswitch:~/openvswitch# ovs-vsctl show
43fb1d86-a3f0-49a4-96a2-0026db6dd0f3
Bridge “br0”
Port “eth0”
Interface “eth0”
Port “br0”
Interface “br0”
type: internal
ovs_version: “1.4.0+build0”

then we delete it, we are signed onto the server openvswitch from cloudctl, but we are using ssh with the 10.1.1 network so deleting the 10.10.10 bridge br0 won’t disconnect us (alternatively you could bypass this by using the “set” command like this: ovs-vsctl set Port br-int tag=1 but we are deleting and redefining to show the process):

root@openvswitch:~/openvswitch# ovs-vsctl del-br br0
root@openvswitch:~/openvswitch# ovs-vsctl show
43fb1d86-a3f0-49a4-96a2-0026db6dd0f3
ovs_version: “1.4.0+build0”

then we add the bridge and follow that up with adding a port with “ovs-vsctl add-port br0 eth0” but it says that it already exists, so we go ahead and add tap0 and tap1 to set up the VLANs:

root@openvswitch:~/openvswitch# ovs-vsctl add-br br0
root@openvswitch:~/openvswitch# ovs-vsctl show
43fb1d86-a3f0-49a4-96a2-0026db6dd0f3
Bridge “br0”
Port “eth0”
Interface “eth0”
Port “br0”
Interface “br0”
type: internal
ovs_version: “1.4.0+build0”

root@openvswitch:~/openvswitch# ovs-vsctl add-port br0 eth0
ovs-vsctl: cannot create a port named eth0 because a port named eth0 already exists on bridge br0
root@openvswitch:~/openvswitch# ovs-vsctl add-port br0 tap0 tag=1
root@openvswitch:~/openvswitch# ovs-vsctl add-port br0 tap1 tag=2
root@openvswitch:~/openvswitch# ovs-vsctl show
43fb1d86-a3f0-49a4-96a2-0026db6dd0f3
Bridge “br0”
Port “eth0”
Interface “eth0”
Port “tap1”
tag: 2
Interface “tap1”
Port “tap0”
tag: 1
Interface “tap0”
Port “br0”
Interface “br0”
type: internal
ovs_version: “1.4.0+build0”
root@openvswitch:~/openvswitch#

We were following the instructions from here: http://openvswitch.org/support/config-cookbooks/vlan-configuration-cookbook/ and the VLAN info from here: http://libvirt.org/formatnetwork.html

So now we have to change the virtual network XML file to add the VLAN information for the VMs. We set up a new virtual network using Virtual Machine Manager and then editted the XML file using “virsh net-edit openvswitchVLAN”

Advertisements

About johnnychipotle

cloud blogger
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s