Skip to content

Commit

Permalink
progressivevpp changes, and improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
javierfernandezvalles committed Aug 2, 2018
1 parent 8c1050d commit b5adc74
Show file tree
Hide file tree
Showing 8 changed files with 628 additions and 454 deletions.
101 changes: 88 additions & 13 deletions docs/guides/progressivevpp/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,7 @@ Setting up your environment
All of these exercises are designed to be performed on an Ubuntu 16.04 (Xenial) box.

* If you have an Ubuntu 16.04 box on which you have sudo or root access, you can feel free to use that.
* If you do not, a Vagrantfile is provided to setup a basic Ubuntu 16.04 box for you.

.. toctree::

settingupenvironment.rst

The DPDK Plugin will be disabled for this section. The link below demonstrates how this is done.

.. toctree::

removedpdkplugin.rst
* If you do not, a Vagrantfile is provided to setup a basic Ubuntu 16.04 box for you in the the steps below.

Running Vagrant
---------------
Expand All @@ -50,7 +40,13 @@ When running multiple FD.io VPP instances, each instance needs to have specified

.. toctree::

vagrant.rst
settingupenvironment.rst

The DPDK Plugin will be disabled for this section. The link below demonstrates how this is done.

.. toctree::

removedpdkplugin.rst

Start a FD.io VPP shell using vppctl
------------------------------------
Expand Down Expand Up @@ -94,4 +90,83 @@ Traces

.. toctree::

traces.rst
traces.rst

Routing
-------

Skills to be Learned
^^^^^^^^^^^^^^^^^^^^

In this exercise you will learn these new skills:

#. Add route to Linux Host routing table
#. Add route to FD.io VPP routing table

And revisit the old ones:

#. Examine FD.io VPP routing table
#. Enable trace on vpp1 and vpp2
#. ping from host to FD.io VPP
#. Examine and clear trace on vpp1 and vpp2
#. ping from FD.io VPP to host
#. Examine and clear trace on vpp1 and vpp2


.. toctree::

routing.rst

Connecting Two FD.io VPP Instances
----------------------------------

memif is a very high performance, direct memory interface type which can
be used between FD.io VPP instances to form a topology. It uses a file socket
for a control channel to set up that shared memory.

Skills to be Learned
^^^^^^^^^^^^^^^^^^^^

You will learn the following new skill in this exercise:

#. Create a memif interface between two FD.io VPP instances

You should be able to perform this exercise with the following skills
learned in previous exercises:

#. Run a second FD.io VPP instance
#. Add an ip address to a FD.io VPP interface
#. Ping from FD.io VPP

.. toctree::

twovppinstances.rst

Switching
---------

Skills to be Learned
^^^^^^^^^^^^^^^^^^^^

#. Associate an interface with a bridge domain
#. Create a loopback interaface
#. Create a BVI (Bridge Virtual Interface) for a bridge domain
#. Examine a bridge domain

.. toctree::

switching.rst

Source NAT
----------

Skills to be Learned
^^^^^^^^^^^^^^^^^^^^

#. Abusing networks namespaces for fun and profit
#. Configuring snat address
#. Configuring snat inside and outside interfaces

.. toctree::

sourceNAT.rst
71 changes: 71 additions & 0 deletions docs/guides/progressivevpp/routing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.. _routing:

.. toctree::

Exercise: Routing
-----------------

Skills to be Learned
^^^^^^^^^^^^^^^^^^^^

In this exercise you will learn these new skills:

#. Add route to Linux Host routing table
#. Add route to FD.io VPP routing table

And revisit the old ones:

#. Examine FD.io VPP routing table
#. Enable trace on vpp1 and vpp2
#. ping from host to FD.io VPP
#. Examine and clear trace on vpp1 and vpp2
#. ping from FD.io VPP to host
#. Examine and clear trace on vpp1 and vpp2

FD.io VPP command learned in this exercise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. `ip route
add <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_ip.html#clicmd_ip_route>`__

Topology
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. figure:: /_images/Connecting_two_vpp_instances_with_memif.png
:alt: Connect two FD.io VPP topology

Connect two FD.io VPP topology

Initial State
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The initial state here is presumed to be the final state from the
exercise `Connecting two FD.io VPP
instances <VPP/Progressive_VPP_Tutorial#Connecting_two_vpp_instances>`__

Action: Setup host route
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
$ sudo ip route add 10.10.2.0/24 via 10.10.1.2
$ ip route
default via 10.0.2.2 dev enp0s3
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
10.10.1.0/24 dev vpp1host proto kernel scope link src 10.10.1.1
10.10.2.0/24 via 10.10.1.2 dev vpp1host
Setup return route on vpp2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
vpp# ip route add 10.10.1.0/24 via 10.10.2.1
Ping from host through vpp1 to vpp2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. Setup a trace on vpp1 and vpp2
#. Ping 10.10.2.2 from the host
#. Examine the trace on vpp1 and vpp2
#. Clear the trace on vpp1 and vpp2
2 changes: 1 addition & 1 deletion docs/guides/progressivevpp/settingupenvironment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ After setting up Vagrant, use these commands on your Vagrant directory to boot t
# vagrant ssh
Afterwards, configure FD.io VPP on the Vagrant system using the :ref:`configuration utility<installingvppconfig>`
Afterwards, configure FD.io VPP on the Vagrant system following the steps on the :ref:`configutil` guide.

159 changes: 159 additions & 0 deletions docs/guides/progressivevpp/sourceNAT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
.. _sourceNAT:

.. toctree::

Source NAT
----------

Skills to be Learned
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. Abusing networks namespaces for fun and profit
#. Configuring snat address
#. Configuring snat inside and outside interfaces

FD.io VPP command learned in this exercise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. `snat add interface
address <https://docs.fd.io/vpp/17.04/clicmd_src_plugins_snat.html#clicmd_snat_add_interface_address>`__
#. `set interface
snat <https://docs.fd.io/vpp/17.04/clicmd_src_plugins_snat.html#clicmd_set_interface_snat>`__

Topology
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. figure:: /_images/SNAT_Topology.jpg
:alt: SNAT Topology

SNAT Topology

Initial state
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Unlike previous exercises, for this one you want to start tabula rasa.

Note: You will lose all your existing config in your FD.io VPP instances!

To clear existing config from previous exercises run:

.. code-block:: console
ps -ef | grep vpp | awk '{print $2}'| xargs sudo kill
$ sudo ip link del dev vpp1host
$ sudo ip link del dev vpp1vpp2
Action: Install vpp-plugins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Snat is supported by a plugin, so vpp-plugins need to be installed

.. code-block:: console
$ sudo apt-get install vpp-plugins
Action: Create FD.io VPP instance
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Create one FD.io VPP instance named vpp1.

Confirm snat plugin is present:

.. code-block:: console
vpp# show plugins
Plugin path is: /usr/lib/vpp_plugins
Plugins loaded:
1.ioam_plugin.so
2.ila_plugin.so
3.acl_plugin.so
4.flowperpkt_plugin.so
5.snat_plugin.so
6.libsixrd_plugin.so
7.lb_plugin.so
Action: Create veth interfaces
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. Create a veth interface with one end named vpp1outside and the other
named vpp1outsidehost
#. Assign IP address 10.10.1.1/24 to vpp1outsidehost
#. Create a veth interface with one end named vpp1inside and the other
named vpp1insidehost
#. Assign IP address 10.10.2.1/24 to vpp1outsidehost

Because we'd like to be able to route \*via\* our vpp instance to an
interface on the same host, we are going to put vpp1insidehost into a
network namespace

Create a new network namespace 'inside'

.. code-block:: console
$ sudo ip netns add inside
Move interface vpp1inside into the 'inside' namespace:

.. code-block:: console
$ sudo ip link set dev vpp1insidehost up netns inside
Assign an ip address to vpp1insidehost

.. code-block:: console
$ sudo ip netns exec inside ip addr add 10.10.2.1/24 dev vpp1insidehost
Create a route inside the netns:

.. code-block:: console
$ sudo ip netns exec inside ip route add 10.10.1.0/24 via 10.10.2.2
Action: Configure vpp outside interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. Create a vpp host interface connected to vpp1outside
#. Assign ip address 10.10.1.2/24
#. Create a vpp host interface connected to vpp1inside
#. Assign ip address 10.10.2.2/24

Action: Configure snat
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Configure snat to use the address of host-vpp1outside

.. code-block:: console
vpp# snat add interface address host-vpp1outside
Configure snat inside and outside interfaces

.. code-block:: console
vpp# set interface snat in host-vpp1inside out host-vpp1outside
Action: Prepare to Observe Snat
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Observing snat in this configuration is interesting. To do so, vagrant
ssh a second time into your VM and run:

.. code-block:: console
$ sudo tcpdump -s 0 -i vpp1outsidehost
Also enable tracing on vpp1

Action: Ping via snat
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
$ sudo ip netns exec inside ping -c 1 10.10.1.1
Action: Confirm snat
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Examine the tcpdump output and vpp1 trace to confirm snat occurred.

0 comments on commit b5adc74

Please sign in to comment.