summaryrefslogtreecommitdiffstats
path: root/docs/gettingstarted/progressivevpp/switching.rst
blob: 7ee559815ec98765174dd4deac843e45d5ac4533 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
.. _switching:

.. toctree::

Switching
=========

Skills to be Learned
----------------------

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

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

#. `show
   bridge <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_l2.html#clicmd_show_bridge-domain>`__
#. `show bridge
   detail <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_l2.html#clicmd_show_bridge-domain>`__
#. `set int l2
   bridge <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_l2.html#clicmd_set_interface_l2_bridge>`__
#. `show l2fib
   verbose <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_l2.html#clicmd_show_l2fib>`__

Topology
---------

.. figure:: /_images/Switching_Topology.jpg
   :alt: Switching Topology

   Switching 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
   $ # do the next command if you are cleaning up from this example
   $ sudo ip link del dev vpp1vpp2

Run FD.io VPP instances
------------------------

#. Run a vpp instance named **vpp1**
#. Run a vpp instance named **vpp2**

Connect vpp1 to host
---------------------

#. Create a veth with one end named vpp1host and the other named
   vpp1out.
#. Connect vpp1out to vpp1
#. Add ip address 10.10.1.1/24 on vpp1host

Connect vpp1 to vpp2
---------------------

#. Create a veth with one end named vpp1vpp2 and the other named
   vpp2vpp1.
#. Connect vpp1vpp2 to vpp1.
#. Connect vpp2vpp1 to vpp2.

Configure Bridge Domain on vpp1
--------------------------------

Check to see what bridge domains already exist, and select the first
bridge domain number not in use:

.. code-block:: console

   vpp# show bridge-domain
    ID   Index   Learning   U-Forwrd   UU-Flood   Flooding   ARP-Term     BVI-Intf
    0      0        off        off        off        off        off        local0

In the example above, there is bridge domain ID '0' already. Even though
sometimes we might get feedback as below:

.. code-block:: console

   no bridge-domains in use

the bridge domain ID '0' still exists, where no operations are
supported. For instance, if we try to add host-vpp1out and host-vpp1vpp2
to bridge domain ID 0, we will get nothing setup.

.. code-block:: console

   vpp# set int l2 bridge host-vpp1out 0
   vpp# set int l2 bridge host-vpp1vpp2 0
   vpp# show bridge-domain 0 detail
   show bridge-domain: No operations on the default bridge domain are supported

So we will create bridge domain 1 instead of playing with the default
bridge domain ID 0.

Add host-vpp1out to bridge domain ID 1

.. code-block:: console

   vpp# set int l2 bridge host-vpp1out 1

Add host-vpp1vpp2 to bridge domain ID1

.. code-block:: console

   vpp# set int l2 bridge host-vpp1vpp2  1

Examine bridge domain 1:

.. code-block:: console

    vpp# show bridge-domain 1 detail
    BD-ID   Index   BSN  Age(min)  Learning  U-Forwrd  UU-Flood  Flooding  ARP-Term  BVI-Intf
    1       1      0     off        on        on        on        on       off       N/A

            Interface           If-idx ISN  SHG  BVI  TxFlood        VLAN-Tag-Rewrite
        host-vpp1out            1     1    0    -      *                 none
        host-vpp1vpp2           2     1    0    -      *                 none

Configure loopback interface on vpp2
-------------------------------------

.. code-block:: console

    vpp# create loopback interface
    loop0

Add the ip address 10.10.1.2/24 to vpp2 interface loop0. Set the state
of interface loop0 on vpp2 to 'up'

Configure bridge domain on vpp2
--------------------------------

Check to see the first available bridge domain ID (it will be 1 in this
case)

Add interface loop0 as a bridge virtual interface (bvi) to bridge domain
1

.. code-block:: console

   vpp# set int l2 bridge loop0 1 bvi

Add interface vpp2vpp1 to bridge domain 1

.. code-block:: console

   vpp# set int l2 bridge host-vpp2vpp1  1

Examine the bridge domain and interfaces.

Ping from host to vpp and vpp to host
--------------------------------------

#. Add trace on vpp1 and vpp2
#. ping from host to 10.10.1.2
#. Examine and clear trace on vpp1 and vpp2
#. ping from vpp2 to 10.10.1.1
#. Examine and clear trace on vpp1 and vpp2

Examine l2 fib
---------------

.. code-block:: console

    vpp# show l2fib verbose
    Mac Address     BD Idx           Interface           Index  static  filter  bvi   Mac Age (min)
    de:ad:00:00:00:00    1            host-vpp1vpp2           2       0       0     0      disabled
    c2:f6:88:31:7b:8e    1            host-vpp1out            1       0       0     0      disabled
    2 l2fib entries

.. code-block:: console

    vpp# show l2fib verbose
    Mac Address     BD Idx           Interface           Index  static  filter  bvi   Mac Age (min)
    de:ad:00:00:00:00    1                loop0               2       1       0     1      disabled
    c2:f6:88:31:7b:8e    1            host-vpp2vpp1           1       0       0     0      disabled
    2 l2fib entries