Difference between revisions of "Vnx-tutorial-openvswitch"

From VNX
Jump to: navigation, search
(Description  )
Line 7: Line 7:
 
This tutorial scenario is intended to show how to configure and use OpenvSwitch (OVS) VLAN support in a VNX scenario. It shows also how to create direct connections between OVS switches.
 
This tutorial scenario is intended to show how to configure and use OpenvSwitch (OVS) VLAN support in a VNX scenario. It shows also how to create direct connections between OVS switches.
  
The scenario is made of three OVS switches connected in a line topology with six Ubuntu LXC virtual machines (VM) connected to them (two VM to each switch). Besides the host has an interface connected to Net2.
+
The scenario is made of three OVS switches connected in a line topology with six Ubuntu LXC virtual machines (VM) connected to them (two VMs to each switch). Besides the host has an interface connected to Net2.
  
 
Three VLANs (1,2 and 3) are defined in the scenario, as show in the figure.  
 
Three VLANs (1,2 and 3) are defined in the scenario, as show in the figure.  
Line 13: Line 13:
 
[[File:Tutorial_vlan_ovs.png|center|thumb|600px|<div align=center>
 
[[File:Tutorial_vlan_ovs.png|center|thumb|600px|<div align=center>
 
'''Figure 1: tutorial OpenvSwitch scenario topology'''</div>]]
 
'''Figure 1: tutorial OpenvSwitch scenario topology'''</div>]]
 +
 +
== Starting the scenario ans testing ==
 +
 +
Start the scenario with:
 +
cd /usr/share/vnx/examples
 +
vnx -f tutorial_vlan_ovs.xml -v --create
 +
 +
Once the scenario has started, you can test the connectivity among VMs to check that the VLAN
 +
 +
You can check 
 +
 +
 +
== Configuration ==
 +
 +
 +
 +
 +
 +
== OVS commands issued by VNX when creating the scenario ==
 +
 +
 +
<pre>
 +
/usr/bin/ovs-vsctl add-port Net0 h1-e1
 +
/usr/bin/ovs-vsctl add-port Net0 h2-e1
 +
/usr/bin/ovs-vsctl add-port Net1 h3-e1
 +
/usr/bin/ovs-vsctl add-port Net1 h4-e1
 +
/usr/bin/ovs-vsctl add-port Net2 h5-e1
 +
/usr/bin/ovs-vsctl add-port Net2 h6-e1
 +
/usr/bin/ovs-vsctl set port h1-e1 tag=1
 +
/usr/bin/ovs-vsctl set port h2-e1 tag=2
 +
/usr/bin/ovs-vsctl set port h3-e1 tag=1
 +
/usr/bin/ovs-vsctl set port h4-e1 tag=3
 +
/usr/bin/ovs-vsctl set port h5-e1 tag=3
 +
/usr/bin/ovs-vsctl set port h6-e1 tag=1
 +
/usr/bin/ovs-vsctl set port firstlink-1 trunk=1,2
 +
/usr/bin/ovs-vsctl set port firstlink-0 trunk=1,2
 +
/usr/bin/ovs-vsctl set port secondlink-1 trunk=3
 +
/usr/bin/ovs-vsctl set port secondlink-0 trunk=3
 +
/usr/bin/ovs-vsctl set port Net2 tag=1
 +
</pre>
  
 
== tutorial_vlan_ovs.xml scenario ==
 
== tutorial_vlan_ovs.xml scenario ==

Revision as of 02:21, 28 August 2015

VNX tutorial scenario using OpenvSwitch and VLANs

(To be completed)

Description  

This tutorial scenario is intended to show how to configure and use OpenvSwitch (OVS) VLAN support in a VNX scenario. It shows also how to create direct connections between OVS switches.

The scenario is made of three OVS switches connected in a line topology with six Ubuntu LXC virtual machines (VM) connected to them (two VMs to each switch). Besides the host has an interface connected to Net2.

Three VLANs (1,2 and 3) are defined in the scenario, as show in the figure.

Figure 1: tutorial OpenvSwitch scenario topology

Starting the scenario ans testing

Start the scenario with:

cd /usr/share/vnx/examples
vnx -f tutorial_vlan_ovs.xml -v --create

Once the scenario has started, you can test the connectivity among VMs to check that the VLAN

You can check


Configuration

OVS commands issued by VNX when creating the scenario

/usr/bin/ovs-vsctl add-port Net0 h1-e1
/usr/bin/ovs-vsctl add-port Net0 h2-e1
/usr/bin/ovs-vsctl add-port Net1 h3-e1
/usr/bin/ovs-vsctl add-port Net1 h4-e1
/usr/bin/ovs-vsctl add-port Net2 h5-e1
/usr/bin/ovs-vsctl add-port Net2 h6-e1
/usr/bin/ovs-vsctl set port h1-e1 tag=1
/usr/bin/ovs-vsctl set port h2-e1 tag=2
/usr/bin/ovs-vsctl set port h3-e1 tag=1
/usr/bin/ovs-vsctl set port h4-e1 tag=3
/usr/bin/ovs-vsctl set port h5-e1 tag=3
/usr/bin/ovs-vsctl set port h6-e1 tag=1
/usr/bin/ovs-vsctl set port firstlink-1 trunk=1,2
/usr/bin/ovs-vsctl set port firstlink-0 trunk=1,2
/usr/bin/ovs-vsctl set port secondlink-1 trunk=3
/usr/bin/ovs-vsctl set port secondlink-0 trunk=3
/usr/bin/ovs-vsctl set port Net2 tag=1

tutorial_vlan_ovs.xml scenario

<?xml version="1.0" encoding="UTF-8"?>

<!--

~~~~~~~~~~~~~~~~~~~~
VNX Sample scenarios
~~~~~~~~~~~~~~~~~~~~

Name:        tutorial_vlan_ovs
Description:

This file is part of the Virtual Networks over LinuX (VNX) Project distribution.
(www: http://www.dit.upm.es/vnx - e-mail: vnx@dit.upm.es)

Departamento de Ingenieria de Sistemas Telematicos (DIT)
Universidad Politecnica de Madrid
SPAIN

-->

<vnx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="/usr/share/xml/vnx/vnx-2.00.xsd">
  <global>
    <version>2.0</version>
    <scenario_name>tutorial_vlan_ovs</scenario_name>
    <automac offset="5"/>
    <vm_mgmt type="none" />
    <!--vm_mgmt type="private" network="10.250.0.0" mask="24" offset="16">
       <host_mapping />
    </vm_mgmt-->
    <vm_defaults>
	    <console id="0" display="no"/>
	    <console id="1" display="yes"/>
    </vm_defaults>
  </global>

  <net name="Net0" mode="openvswitch" />
  <net name="Net1" mode="openvswitch" >
	<connection name='firstlink' net='Net0'>
	    <vlan>
	       <tag id='1'/>
	       <tag id='2'/>
	    </vlan>
    </connection>
	<connection name='secondlink' net='Net2'>
	   <vlan>
         <tag id='3'/>
       </vlan>
    </connection>
  </net>
  <net name="Net2" mode="openvswitch" />

  <!-- NODES -->
  <vm name="h1" type="lxc" subtype="" os="">
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_lxc</filesystem>
    <mem>512M</mem>
    <if id="1" net="Net0" >
	   <vlan>
	     <tag id='1'/>
      </vlan>
      <ipv4>10.1.1.1/24</ipv4>
    </if>
    <filetree seq="vnxtxt" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="vnxwww" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="start-www" root="/var/www">conf/txtfile</filetree>

  </vm>

  <vm name="h2" type="lxc" subtype="" os="">
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_lxc</filesystem>
    <mem>512M</mem>
    <if id="1" net="Net0" >
      <vlan>
	     <tag id='2'/>
      </vlan>
      <ipv4>10.1.1.2/24</ipv4>
    </if>
    <filetree seq="vnxtxt" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="vnxwww" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="start-www" root="/var/www">conf/txtfile</filetree>

  </vm>

  <vm name="h3" type="lxc" subtype="" os="">
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_lxc</filesystem>
    <if id="1" net="Net1" >
      <vlan>
	    <tag id='1'/>
      </vlan>
      <ipv4>10.1.1.3/24</ipv4>
    </if>
    <filetree seq="vnxtxt" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="vnxwww" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="start-www" root="/var/www">conf/txtfile</filetree>

  </vm>

  <vm name="h4" type="lxc" subtype="" os="">
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_lxc</filesystem>
    <if id="1" net="Net1" >
      <vlan>
        <tag id='3'/>
      </vlan>
      <ipv4>10.1.1.4/24</ipv4>
    </if>
    <filetree seq="vnxtxt" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="vnxwww" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="start-www" root="/var/www">conf/txtfile</filetree>

  </vm>

  <vm name="h5" type="lxc" subtype="" os="">
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_lxc</filesystem>
    <if id="1" net="Net2" >
      <vlan>
        <tag id='3'/>
      </vlan>
      <ipv4>10.1.1.5/24</ipv4>
    </if>
    <filetree seq="vnxtxt" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="vnxwww" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="start-www" root="/var/www">conf/txtfile</filetree>

  </vm>

  <vm name="h6" type="lxc" subtype="" os="">
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_lxc</filesystem>
    <if id="1" net="Net2" >
      <vlan>
		<tag id='1'/>
      </vlan>
      <ipv4>10.1.1.6/24</ipv4>
    </if>
    <filetree seq="vnxtxt" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="vnxwww" root="/tmp/" perms="644">conf/txtfile</filetree>
    <filetree seq="start-www" root="/var/www">conf/txtfile</filetree>

  </vm>

  <host>
    <hostif net="Net2">
      <vlan>
		<tag id='1'/>
      </vlan>
      <ipv4>10.1.1.7/24</ipv4>
    </hostif>
  </host>

</vnx>