John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 1 | .. _twovppinstances: |
| 2 | |
| 3 | .. toctree:: |
| 4 | |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 5 | Connecting Two FD.io VPP Instances |
| 6 | ================================== |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 7 | |
| 8 | .. _background-1: |
| 9 | |
| 10 | memif is a very high performance, direct memory interface type which can |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 11 | be used between FD.io VPP instances. It uses a file socket for a control channel |
| 12 | to set up shared memory. |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 13 | |
| 14 | .. _skills-to-be-learned-1: |
| 15 | |
| 16 | Skills to be Learned |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 17 | --------------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 18 | |
| 19 | You will learn the following new skill in this exercise: |
| 20 | |
| 21 | #. Create a memif interface between two FD.io VPP instances |
| 22 | |
| 23 | You should be able to perform this exercise with the following skills |
| 24 | learned 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 | |
| 32 | Topology |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 33 | --------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 34 | |
| 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 | |
| 42 | Initial state |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 43 | -------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 44 | |
| 45 | The initial state here is presumed to be the final state from the |
| 46 | exercise `Create an |
| 47 | Interface <VPP/Progressive_VPP_Tutorial#Exercise:_Create_an_Interface>`__ |
| 48 | |
| 49 | .. _action-running-a-second-vpp-instances-1: |
| 50 | |
| 51 | Running a second FD.io VPP instances |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 52 | ------------------------------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 53 | |
| 54 | You should already have a FD.io VPP instance running named: vpp1. |
| 55 | |
| 56 | Run a second FD.io VPP instance named: vpp2. |
| 57 | |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 58 | .. 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 DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 72 | .. _action-create-memif-interface-on-vpp1-1: |
| 73 | |
| 74 | Create memif interface on vpp1 |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 75 | ------------------------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 76 | |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 77 | Create a memif interface on vpp1. To connect to the instance vpp1 use the |
| 78 | socket **/run/vpp/cli-vpp1.sock** |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 79 | |
| 80 | .. code-block:: console |
| 81 | |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 82 | $ sudo vppctl -s /run/vpp/cli-vpp1.sock |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 83 | vpp# create interface memif id 0 master |
| 84 | |
| 85 | This will create an interface on vpp1 memif0/0 using /run/vpp/memif as |
| 86 | its socket file. The role of vpp1 for this memif inteface is 'master'. |
| 87 | |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 88 | With what you have learned: |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 89 | |
| 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 | |
| 96 | Create memif interface on vpp2 |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 97 | -------------------------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 98 | |
| 99 | We want vpp2 to pick up the 'slave' role using the same |
| 100 | run/vpp/memif-vpp1vpp2 socket file |
| 101 | |
| 102 | .. code-block:: console |
| 103 | |
| 104 | vpp# create interface memif id 0 slave |
| 105 | |
| 106 | This will create an interface on vpp2 memif0/0 using /run/vpp/memif as |
| 107 | its socket file. The role of vpp1 for this memif inteface is 'slave'. |
| 108 | |
| 109 | Use 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 | |
| 117 | Ping from vpp1 to vpp2 |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 118 | ------------------------ |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 119 | |
| 120 | Ping 10.10.2.2 from vpp1 |
| 121 | |
| 122 | .. code-block:: console |
| 123 | |
| 124 | $ ping 10.10.2.2 |
| 125 | |
| 126 | Ping 10.10.2.1 from vpp2 |
| 127 | |
| 128 | .. code-block:: console |
| 129 | |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame^] | 130 | $ ping 10.10.2.1 |