blob: c6a7420fcc839b16ad78bae2ad72bdf6939c177a [file] [log] [blame]
John DeNiscoc8e7f412018-08-03 11:02:24 -04001.. _twovppinstances:
2
3.. toctree::
4
John DeNiscoc4c72d22018-08-16 13:50:02 -04005Connecting Two FD.io VPP Instances
6==================================
John DeNiscoc8e7f412018-08-03 11:02:24 -04007
8.. _background-1:
9
10memif is a very high performance, direct memory interface type which can
John DeNiscoc4c72d22018-08-16 13:50:02 -040011be used between FD.io VPP instances. It uses a file socket for a control channel
12to set up shared memory.
John DeNiscoc8e7f412018-08-03 11:02:24 -040013
14.. _skills-to-be-learned-1:
15
16Skills to be Learned
John DeNiscoc4c72d22018-08-16 13:50:02 -040017---------------------
John DeNiscoc8e7f412018-08-03 11:02:24 -040018
19You will learn the following new skill in this exercise:
20
21#. Create a memif interface between two FD.io VPP instances
22
23You should be able to perform this exercise with the following skills
24learned in previous exercises:
25
26#. Run a second FD.io VPP instance
27#. Add an ip address to a FD.io VPP interface
28#. Ping from FD.io VPP
29
30.. _topology-1:
31
32Topology
John DeNiscoc4c72d22018-08-16 13:50:02 -040033---------
John DeNiscoc8e7f412018-08-03 11:02:24 -040034
35.. figure:: /_images/Connecting_two_vpp_instances_with_memif.png
36 :alt: Connect two FD.io VPP topology
37
38 Connect two FD.io VPP topology
39
40.. _initial-state-1:
41
42Initial state
John DeNiscoc4c72d22018-08-16 13:50:02 -040043--------------
John DeNiscoc8e7f412018-08-03 11:02:24 -040044
45The initial state here is presumed to be the final state from the
46exercise `Create an
47Interface <VPP/Progressive_VPP_Tutorial#Exercise:_Create_an_Interface>`__
48
49.. _action-running-a-second-vpp-instances-1:
50
51Running a second FD.io VPP instances
John DeNiscoc4c72d22018-08-16 13:50:02 -040052-------------------------------------
John DeNiscoc8e7f412018-08-03 11:02:24 -040053
54You should already have a FD.io VPP instance running named: vpp1.
55
56Run a second FD.io VPP instance named: vpp2.
57
John DeNiscoc4c72d22018-08-16 13:50:02 -040058.. code-block:: console
59
60 $ sudo /usr/bin/vpp -c startup2.conf
61 ....
62 $ sudo vppctl -s /run/vpp/cli-vpp2.sock
63 _______ _ _ _____ ___
64 __/ __/ _ \ (_)__ | | / / _ \/ _ \
65 _/ _// // / / / _ \ | |/ / ___/ ___/
66 /_/ /____(_)_/\___/ |___/_/ /_/
67
68 vpp# show version
69 vpp v18.07-release built by root on c469eba2a593 at Mon Jul 30 23:27:03 UTC 2018
70 vpp# quit
71
John DeNiscoc8e7f412018-08-03 11:02:24 -040072.. _action-create-memif-interface-on-vpp1-1:
73
74Create memif interface on vpp1
John DeNiscoc4c72d22018-08-16 13:50:02 -040075-------------------------------
John DeNiscoc8e7f412018-08-03 11:02:24 -040076
John DeNiscoc4c72d22018-08-16 13:50:02 -040077Create a memif interface on vpp1. To connect to the instance vpp1 use the
78socket **/run/vpp/cli-vpp1.sock**
John DeNiscoc8e7f412018-08-03 11:02:24 -040079
80.. code-block:: console
81
John DeNiscoc4c72d22018-08-16 13:50:02 -040082 $ sudo vppctl -s /run/vpp/cli-vpp1.sock
John DeNiscoc8e7f412018-08-03 11:02:24 -040083 vpp# create interface memif id 0 master
84
85This will create an interface on vpp1 memif0/0 using /run/vpp/memif as
Paul Vinciguerra7fa3dd22019-10-27 17:28:10 -040086its socket file. The role of vpp1 for this memif interface is 'master'.
John DeNiscoc8e7f412018-08-03 11:02:24 -040087
John DeNiscoc4c72d22018-08-16 13:50:02 -040088With what you have learned:
John DeNiscoc8e7f412018-08-03 11:02:24 -040089
90#. Set the memif0/0 state to up.
91#. Assign IP address 10.10.2.1/24 to memif0/0
92#. Examine memif0/0 via show commands
93
94.. _action-create-memif-interface-on-vpp2-1:
95
96Create memif interface on vpp2
John DeNiscoc4c72d22018-08-16 13:50:02 -040097--------------------------------
John DeNiscoc8e7f412018-08-03 11:02:24 -040098
99We want vpp2 to pick up the 'slave' role using the same
100run/vpp/memif-vpp1vpp2 socket file
101
102.. code-block:: console
103
104 vpp# create interface memif id 0 slave
105
106This will create an interface on vpp2 memif0/0 using /run/vpp/memif as
Arthur de Kerhor950d33e2021-02-11 03:02:44 -0800107its socket file. The role of vpp2 for this memif interface is 'slave'.
John DeNiscoc8e7f412018-08-03 11:02:24 -0400108
109Use your previously used skills to:
110
111#. Set the memif0/0 state to up.
112#. Assign IP address 10.10.2.2/24 to memif0/0
113#. Examine memif0/0 via show commands
114
115.. _action-ping-from-vpp1-to-vpp2-1:
116
117Ping from vpp1 to vpp2
John DeNiscoc4c72d22018-08-16 13:50:02 -0400118------------------------
John DeNiscoc8e7f412018-08-03 11:02:24 -0400119
120Ping 10.10.2.2 from vpp1
121
122.. code-block:: console
123
124 $ ping 10.10.2.2
125
126Ping 10.10.2.1 from vpp2
127
128.. code-block:: console
129
John DeNiscoc4c72d22018-08-16 13:50:02 -0400130 $ ping 10.10.2.1