Introduction
Software Defined networking (SDN) is no more a new topic but still many Network/ System engineers feel it painful how to start learning SDN. Many SDN solution exists in market and each has its pros and cons. Objective of this blog is to give an idea about SDN basics to the engineers who want to start their SDN learning curve.
Reference topology
- 2 x Ubuntu host (14.04 LTS) each with multiple NICs
- Open vSwitch installed in each host and 1 instance created.
- Virtual Box installed in each host, vBox will be used to host guest virtual machines (VM-A & VM-B)
Topology Description
Open vSwitch (e.g br0) in each host will have following interfaces:-
- A tap interface which will be used to bind guest VM to Open vSwitch
- Eth1 of each host will be added to Open vSwitch
- IP address / sub netmask for Eth1 of each host will be configured on Open vSwitch itself (br0)
- Guest VM eth1 will be configured with IP/sub net mask different that host IP/ sub net mask
- VXLAN / GRE will be configured on each host (by using host IP addresses)
Step by Step setting up Lab
It is assumed Ubuntu 14.04 is installed in each host and host machine has connectivity to the internet.
- Install open-vSwitch in each (apt-get install openvswitch-switch)
- Create an instance of Open-Vswitch (ovs-vsctl add-br br0)
- Add tunnel interface in each host (ip tuntap add mode tap tap0 , ifconfig tap0 up)
- Add relevant ports to Open –Vswitch
- Ovs-vsctl add-port br0 tap0
- Ovs-vsctl add-port br0 eth1
- Assign IP address to Open-vSwitch br0 (IP address for the host Ethernet Eth1)
- Ifconfig eth1 0
- Ifconfig br0 192.168.100.1 netmask 255.255.255.0
- Ifconfig br0 up
- Ifconfig tap0 up
- Install Virtual-Box in each host (apt-get install virtualbox)
- Create Tunnel Interface
Ovs-vsctl add-port br0 GRE – set interface GRE type=gre options:remote_ip=192.168.100.x
or vxlan
Ovs-vsctl add-port br0 VX – set interface VX type=vxlan options:remote_ip=192.168.100.x
(.x is remote host IP)
- Check the configuration/ status of ports assigned to Open-vSwitch
- ovs-vsctl show
7d7c9778-ac43-443c-82d9-1efdbcf3ba0e
Bridge “br0” Port “br0” Interface “br0” type: internal Port “tap0” Interface “tap0″ Port GRE Interface GRE type: gre options: {remote_ip=”192.168.100.1”} Port “eth1” Interface “eth1” ovs_version: “2.0.2
|
- Start virtual-box and create a VM using any tinny Linux image
- In VM setting , set network as bridge and select physical interface “tap0”
- Assign IP address to guest VM (e.g 172.172.1.1/24 to VM-A and 172.172.1.2/24 to VM-B)
- Start ping from one guest VM to other guest VM
- Check MAC table on open-vSwitch
port VLAN MAC Age
1 0 00:0c:29:45:15:06 1 3 0 00:0c:29:dd:ac:b2 1 2 0 08:00:27:5e:55:54 1 (VM-B hosted on Host-2, MAC address learned on local tap interface) 3 0 08:00:27:04:36:64 1 ( VM-A hosted on Host-1, MAC learned on GRE tunnel interface) |
- root@ubuntu:~# ovs-appctl fdb/show br0
- root@ubuntu:~# ovs-ofctl show br0
1(eth1): addr:00:0c:29:dd:ac:b2
config: 0 state: 0 current: 1GB-FD COPPER AUTO_NEG advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-FD COPPER AUTO_NEG supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-FD COPPER AUTO_NEG speed: 1000 Mbps now, 1000 Mbps max 2(tap0): addr:2e:c1:d7:25:5e:18 config: 0 state: LINK_DOWN current: 10MB-FD COPPER speed: 10 Mbps now, 0 Mbps max 3(GRE): addr:e6:da:71:24:70:bb config: 0 state: 0 speed: 0 Mbps now, 0 Mbps max LOCAL(br0): addr:00:0c:29:dd:ac:b2 config: 0 state: 0 speed: 0 Mbps now, 0 Mbps max |
Conclusion
Traffic will be initiated from guest VM and once traffic will reach open-vSwitch from guest VM through tap interface it will be encapsulated in tunnel (gre/vxlan) and will be send to remote host. Above snippet taken from host-2 shows that VM-A (gust VM on host-1) mac address has been learned on GRE interface (interface 3) and local VM address is learned on tap interface (interface 2).
References: