Configuring VXLAN and GRE Tunnels on OpenvSwitch

CONFIGURING VXLAN AND GRE TUNNELS ON OPENVSWITCH
UPDATE: VXLAN ENCAPSULATION
VXLan is now upstreamed into the Master build. It is worth mentioning that is the encapsulation only, not the Multicast control plane functionality. That is being worked on by Mestery currently. So basically no need to pull from the fork but pull directly from the Open vSwitch Master. ‘git clone git://openvswitch.org/openvswitch’ have the VXLan encap included.

I have done a couple of GRE tunnel how-tos using OpenvSwitch (OVS). I ran across the git tree of the VXlan implementation which is still in development I am sure. I don’t want anyone to think this is anything other than me seeing the tree on GitHub. I had been itching to give VXLan a spin in OVS so why not ferret out someones tree on GitHub. I believe VXLan is still scheduled to officially release soon in OpenvSwitch. So here are the steps for installing, configuring tunnels on OpenvSwitch with VXLan and GRE encapsulations. At the end we will compare some of the protocols with difference MTU sizes. The results were interesting I think (for a nerd). We will be installing and then configure both GRE and VXLan encapsulated tunnels using Open vSwitch.

I like seeing some collaboration of really smart people from different companies as displayed in the GPL below.

/* * Copyright (c) 2011 Nicira Networks.
* Copyright (c) 2012 Cisco Systems Inc.
* Distributed under the terms of the GNU GPL version 2.
* * Significant portions of this file may be copied from parts of the Linux
* kernel, by Linus Torvalds and others. */
Open vSwitch Tunnels GRE and VXLan

Figure 1. Example of how tunnels can be leveraged as overlays.

By the way I should probably disclaim now that huge Layer2 networks do not scale and huge Layer3 networks do. Host count in a broadcast domain/Vlan/network should be kept to a reasonable 3 digit number. Cisco is quick to point out that OTV is the solution over WAN’s for extending Layer 2 networks with OTV as the solution to extend Layer 2 Vlans. That said Overlays are flat out required to overcome Vlan number limitations and have lots of potential with programmatic orchestration.

Open vSwitch Datapath Forwarding

Figure 2. OVS punts the first packet to user land for the forwarding decision and passes the data path back to the data path in the kernel for subsequent packets in the flow. slow path for the first packet then fast path for the rest.

I do some simple Iperf tests at the end of the post with 1500 and 9000 byte MTUs. The numbers are kind of fun to look at from the result. For a really nice analysis take a look at Martin’s post at Network Heresy on comparing STT, Linux Bridging and GRE. I am going to spin up some VMs on the VXLan tunnel later this week and measure the speeds a little closer and see how GRE and VXLan stack up to one another from hosts using overlays. I just ran some Iperfs from the hypervisor itself rather than VMs. OVS also supports Capwap encapsulation that performs mac in GRE which is rather slick. Wonder why we do not hear much about that. I am going to dig in when I get back to home from the road later next week.

Open vSwitch VXLan GRE

Figure 3. Lab Setup basically has a fake interface up with Br1. Real world Br1 would have VMs tapped on it. The video uses br1 and br2 but it got to be confusing for people so I changed it to br0 and br1 to match most peoples eth0 = br0 NIC naming in ifconfig.

Quick Video of the fast install below.


For those familiar with the build you can just paste the following in your bash shell as root. To walk through the install skip the following snippet.

OPEN VSWITCH SYSTEM PREPERATION

This is on two boxes with 64 cores and Broadcom Corporation NetXtreme II BCM57810 10G Nics to a random 10G TOR switch.
Install dependencies

Download the  Open vSwitch latest build

COMPILE OPENVSWITCH FROM SOURCE

INITIAL OPEN VSWITCH CONFIGURATION

Run the following commands, note some dashes are two ‘- -’ e.g. – -remote=db & – -private-key

Start ovsdb-server, this stores the config into a file that is persistent even after restarts.

*note* “brcompat” is depreciated since the OVS upstream. Output should just be “openvswitch” as a loaded kernel module. If they are not there try loading again and check your path to the kernel module.

At this point you have a fucntioning vanilla OVS install. Output should look something like this.

CONFIGURE LINUX NETWORKING

I have one NIC (eth0) on the same LAN segment/network/vlan.
We are attaching eth0 to br1 and applying an IP to the bridge interface.
We are attaching an IP to br1. br1 is the island that we are building a tunnel for hosts to connect on. Without the VXLAN tunnel, the two br1 interfaces should not be able to ping one another. Note: This is being setup on the same subnet, it is important to keep in mind that the VXLAN framing will allow for the tunnel to be established over disparate networks. E.g. can be done over the Internet etc.


Configuration for Host 1


Configuration for Host 2

If you have issues getting the bridge built you may need to kill the OVS processes and restart them depending on your step order.

Your Linux routing table and ifconfig should now look something like this:

TROUBLESHOOTING OPEN VSWITCH INSTALLATION

An error was sent to me by someone that looked like this below, restarting the OVS procs will clear it up:

BUILD A GRE TUNNEL IN OPEN VSWITCH

Adjust MTUs with % ifconfig <interface e.g. br0 eth0 etc> mtu 9000
#(Remember your switch needs to have >= your MTU.

openvswitch gre tunnel

Figure 4. Output of GRE Tunnels running with 1500 byte MTUs.

openvswitch gre tunnel jumbo

Figure 5. Output of GRE Tunnels running with 9000 byte MTUs.


Now delete the GRE ports

CONFIGURE THE VXLAN TUNNEL

The difference here is the “type” specifying the tunnel encapsulation.

openvswitch VXLan tunnel vxlan mtu 1500

Figure 6 Output of VXLan Tunnels running with 1500 byte MTUs.

openvswitch gre tunnel vxlan
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值