John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 1 | .. _switching: |
| 2 | |
| 3 | .. toctree:: |
| 4 | |
| 5 | Switching |
| 6 | ========= |
| 7 | |
| 8 | Skills to be Learned |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame] | 9 | ---------------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 10 | |
| 11 | #. Associate an interface with a bridge domain |
Paul Vinciguerra | 7fa3dd2 | 2019-10-27 17:28:10 -0400 | [diff] [blame] | 12 | #. Create a loopback interface |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 13 | #. Create a BVI (Bridge Virtual Interface) for a bridge domain |
| 14 | #. Examine a bridge domain |
| 15 | |
| 16 | FD.io VPP command learned in this exercise |
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 | #. `show |
| 20 | bridge <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_l2.html#clicmd_show_bridge-domain>`__ |
| 21 | #. `show bridge |
| 22 | detail <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_l2.html#clicmd_show_bridge-domain>`__ |
| 23 | #. `set int l2 |
| 24 | bridge <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_l2.html#clicmd_set_interface_l2_bridge>`__ |
| 25 | #. `show l2fib |
| 26 | verbose <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_l2.html#clicmd_show_l2fib>`__ |
| 27 | |
| 28 | Topology |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame] | 29 | --------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 30 | |
| 31 | .. figure:: /_images/Switching_Topology.jpg |
| 32 | :alt: Switching Topology |
| 33 | |
| 34 | Switching Topology |
| 35 | |
| 36 | Initial state |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame] | 37 | --------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 38 | |
| 39 | Unlike previous exercises, for this one you want to start tabula rasa. |
| 40 | |
| 41 | Note: You will lose all your existing config in your FD.io VPP instances! |
| 42 | |
| 43 | To clear existing config from previous exercises run: |
| 44 | |
| 45 | .. code-block:: console |
| 46 | |
| 47 | $ ps -ef | grep vpp | awk '{print $2}'| xargs sudo kill |
| 48 | $ sudo ip link del dev vpp1host |
Paul Vinciguerra | 7fa3dd2 | 2019-10-27 17:28:10 -0400 | [diff] [blame] | 49 | $ # do the next command if you are cleaning up from this example |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 50 | $ sudo ip link del dev vpp1vpp2 |
| 51 | |
| 52 | Run FD.io VPP instances |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame] | 53 | ------------------------ |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 54 | |
| 55 | #. Run a vpp instance named **vpp1** |
| 56 | #. Run a vpp instance named **vpp2** |
| 57 | |
| 58 | Connect vpp1 to host |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame] | 59 | --------------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 60 | |
| 61 | #. Create a veth with one end named vpp1host and the other named |
| 62 | vpp1out. |
| 63 | #. Connect vpp1out to vpp1 |
| 64 | #. Add ip address 10.10.1.1/24 on vpp1host |
| 65 | |
| 66 | Connect vpp1 to vpp2 |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame] | 67 | --------------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 68 | |
| 69 | #. Create a veth with one end named vpp1vpp2 and the other named |
| 70 | vpp2vpp1. |
| 71 | #. Connect vpp1vpp2 to vpp1. |
| 72 | #. Connect vpp2vpp1 to vpp2. |
| 73 | |
| 74 | Configure Bridge Domain 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 | |
| 77 | Check to see what bridge domains already exist, and select the first |
| 78 | bridge domain number not in use: |
| 79 | |
| 80 | .. code-block:: console |
| 81 | |
| 82 | vpp# show bridge-domain |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 83 | ID Index Learning U-Forwrd UU-Flood Flooding ARP-Term BVI-Intf |
| 84 | 0 0 off off off off off local0 |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 85 | |
| 86 | In the example above, there is bridge domain ID '0' already. Even though |
| 87 | sometimes we might get feedback as below: |
| 88 | |
| 89 | .. code-block:: console |
| 90 | |
| 91 | no bridge-domains in use |
| 92 | |
| 93 | the bridge domain ID '0' still exists, where no operations are |
| 94 | supported. For instance, if we try to add host-vpp1out and host-vpp1vpp2 |
| 95 | to bridge domain ID 0, we will get nothing setup. |
| 96 | |
| 97 | .. code-block:: console |
| 98 | |
| 99 | vpp# set int l2 bridge host-vpp1out 0 |
| 100 | vpp# set int l2 bridge host-vpp1vpp2 0 |
| 101 | vpp# show bridge-domain 0 detail |
| 102 | show bridge-domain: No operations on the default bridge domain are supported |
| 103 | |
| 104 | So we will create bridge domain 1 instead of playing with the default |
| 105 | bridge domain ID 0. |
| 106 | |
| 107 | Add host-vpp1out to bridge domain ID 1 |
| 108 | |
| 109 | .. code-block:: console |
| 110 | |
| 111 | vpp# set int l2 bridge host-vpp1out 1 |
| 112 | |
| 113 | Add host-vpp1vpp2 to bridge domain ID1 |
| 114 | |
| 115 | .. code-block:: console |
| 116 | |
| 117 | vpp# set int l2 bridge host-vpp1vpp2 1 |
| 118 | |
| 119 | Examine bridge domain 1: |
| 120 | |
| 121 | .. code-block:: console |
| 122 | |
| 123 | vpp# show bridge-domain 1 detail |
| 124 | BD-ID Index BSN Age(min) Learning U-Forwrd UU-Flood Flooding ARP-Term BVI-Intf |
| 125 | 1 1 0 off on on on on off N/A |
| 126 | |
| 127 | Interface If-idx ISN SHG BVI TxFlood VLAN-Tag-Rewrite |
| 128 | host-vpp1out 1 1 0 - * none |
| 129 | host-vpp1vpp2 2 1 0 - * none |
| 130 | |
| 131 | Configure loopback interface on vpp2 |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame] | 132 | ------------------------------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 133 | |
| 134 | .. code-block:: console |
| 135 | |
| 136 | vpp# create loopback interface |
| 137 | loop0 |
| 138 | |
| 139 | Add the ip address 10.10.1.2/24 to vpp2 interface loop0. Set the state |
| 140 | of interface loop0 on vpp2 to 'up' |
| 141 | |
| 142 | Configure bridge domain on vpp2 |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame] | 143 | -------------------------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 144 | |
| 145 | Check to see the first available bridge domain ID (it will be 1 in this |
| 146 | case) |
| 147 | |
| 148 | Add interface loop0 as a bridge virtual interface (bvi) to bridge domain |
| 149 | 1 |
| 150 | |
| 151 | .. code-block:: console |
| 152 | |
| 153 | vpp# set int l2 bridge loop0 1 bvi |
| 154 | |
| 155 | Add interface vpp2vpp1 to bridge domain 1 |
| 156 | |
| 157 | .. code-block:: console |
| 158 | |
| 159 | vpp# set int l2 bridge host-vpp2vpp1 1 |
| 160 | |
| 161 | Examine the bridge domain and interfaces. |
| 162 | |
| 163 | Ping from host to vpp and vpp to host |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame] | 164 | -------------------------------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 165 | |
| 166 | #. Add trace on vpp1 and vpp2 |
| 167 | #. ping from host to 10.10.1.2 |
| 168 | #. Examine and clear trace on vpp1 and vpp2 |
| 169 | #. ping from vpp2 to 10.10.1.1 |
| 170 | #. Examine and clear trace on vpp1 and vpp2 |
| 171 | |
| 172 | Examine l2 fib |
John DeNisco | c4c72d2 | 2018-08-16 13:50:02 -0400 | [diff] [blame] | 173 | --------------- |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 174 | |
| 175 | .. code-block:: console |
| 176 | |
| 177 | vpp# show l2fib verbose |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 178 | Mac Address BD Idx Interface Index static filter bvi Mac Age (min) |
| 179 | de:ad:00:00:00:00 1 host-vpp1vpp2 2 0 0 0 disabled |
| 180 | c2:f6:88:31:7b:8e 1 host-vpp1out 1 0 0 0 disabled |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 181 | 2 l2fib entries |
| 182 | |
| 183 | .. code-block:: console |
| 184 | |
| 185 | vpp# show l2fib verbose |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 186 | Mac Address BD Idx Interface Index static filter bvi Mac Age (min) |
| 187 | de:ad:00:00:00:00 1 loop0 2 1 0 1 disabled |
| 188 | c2:f6:88:31:7b:8e 1 host-vpp2vpp1 1 0 0 0 disabled |
John DeNisco | c8e7f41 | 2018-08-03 11:02:24 -0400 | [diff] [blame] | 189 | 2 l2fib entries |