forked from fdioDocs/vpp-docs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
progressivevpp changes, and improvement
- Loading branch information
1 parent
8c1050d
commit b5adc74
Showing
8 changed files
with
628 additions
and
454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
Oops, something went wrong.