blob: abc388492d871fab5a3c46be51e99f1ea9bc0599 [file] [log] [blame]
Charles Chan9e5c6172019-09-07 11:24:54 -07001External Connectivity
2=====================
Charles Chan8d3ae672019-09-07 22:07:22 -07003
4vRouter
5-------
6
Charles Chan8d3ae672019-09-07 22:07:22 -07007Physical Connectivity
8^^^^^^^^^^^^^^^^^^^^^
Charles Chan8d3ae672019-09-07 22:07:22 -07009
Zack Williamsd63d35b2020-06-23 14:12:46 -070010External routers must be physically connected to one of the fabric leaf
11switches.
12
13Currently there is a limitation that the **external/upstream router and the
14Quagga instance must be connected to the same fabric leaf switch**.
15
16Therefore it is necessary to use an additional front panel port on the
17leaf-switch (or at least an additional vlan) to connect to the compute node
18hosting Quagga.
Charles Chan8d3ae672019-09-07 22:07:22 -070019
Charles Chan976d8a02019-09-08 17:18:50 -070020.. image:: ../images/config-vr-physical.png
Charles Chan8d3ae672019-09-07 22:07:22 -070021
22Configure vRouter
23^^^^^^^^^^^^^^^^^
Charles Chan8d3ae672019-09-07 22:07:22 -070024
Zack Williamsd63d35b2020-06-23 14:12:46 -070025The operator will need to configure a subnet between the Leaf-switch, the
26external/upstream router and the Quagga instance. There are 3 IP addresses we
27need to allocate - 1 on the switch port, 1 in Quagga, and 1 on the upstream
28router. This means the peering subnet **cannot be smaller than a /29**.
Charles Chan8d3ae672019-09-07 22:07:22 -070029
Zack Williamsd63d35b2020-06-23 14:12:46 -070030BGP peering happens between the IP addresses configured on the interfaces in
31Quagga and the external router.
32
33Routes are advertised by Quagga to the upstream with the next-hop set to the
34switch port IP address. This means that when traffic comes to the fabric leaf
35switch from outside, the switch is able to distinguish peering traffic from
36data traffic and treat each appropriately.
Charles Chan8d3ae672019-09-07 22:07:22 -070037
38The following shows an ONOS interface configuration example:
39
40.. code-block:: json
41
Charles Chan8299f072019-09-23 11:32:26 -070042 {
43 "ports" : {
44 "of:0000000000000001/1" : {
45 "interfaces" : [
46 {
47 "name" : "upstream1",
48 "ips" : [ "10.0.1.2/24" ],
49 "vlan-untagged" : 4000
50 }
51 ]
52 },
53 "of:0000000000000001/2" : {
54 "interfaces" : [
55 {
56 "name" : "quagga",
57 "ips" : [ "10.0.1.2/24" ],
58 "vlan-untagged" : 4000
59 }
60 ]
61 }
62 }
63 }
Charles Chan8d3ae672019-09-07 22:07:22 -070064
65- ``name``: An arbitrary name string for the interface. Optional.
Zack Williamsd63d35b2020-06-23 14:12:46 -070066
67- ``ips``: Configure the peering subnet (10.0.1.0/24) and the switch port IP
68 (10.0.1.2). Note that we use the same IP address on both the quagga and
69 upstream interfaces.
70
71- ``vlan-untagged``: Configure the same VLAN ID on both interfaces. It doesn't
72 matter exactly what the VLAN ID is, but it must be the same on both the
73 Quagga-facing and upstream-facing interfaces.
Charles Chan8d3ae672019-09-07 22:07:22 -070074
75In this case the peering subnet is ``10.0.1.0/24``.
76The upstream router is using the ``10.0.1.1`` address.
77Quagga is assigned ``10.0.1.3``, which is the address used for peering.
Charles Chan8d3ae672019-09-07 22:07:22 -070078
Zack Williamsd63d35b2020-06-23 14:12:46 -070079The upstream router needs to be configured with ``10.0.1.3`` as its BGP
80neighbor, and the BGP peering will be established between ``10.0.1.1`` and
81``10.0.1.3``. The ``10.0.1.2`` address is used by the fabric switch and for the
82next-hop for routes advertised by Quagga.
83
84Of course you are not obliged to use ``10.0.1.0/24``, you should use a subnet
85that makes sense for your peering environment.
Charles Chan8d3ae672019-09-07 22:07:22 -070086
87.. note::
Zack Williamsd63d35b2020-06-23 14:12:46 -070088 This configuration will set up an L2 link between the two fabric switch
89 ports, over which the Quagga and external router can communicate.
Charles Chan8d3ae672019-09-07 22:07:22 -070090
Zack Williamsd63d35b2020-06-23 14:12:46 -070091 Both Quagga and the upstream router will receive untagged packets (i.e they
92 will never see packets with vlanId 4000, which is used inside the leaf
93 switch to establish a bridging domain).
94
95 If you need a vlan-tag in the compute node to distinguish the traffic going
96 to Quagga, you can change the vlan assignment on the switch port
97 "of:0000000000000001/2" to be vlan-tagged instead of vlan-untagged.
Charles Chan8d3ae672019-09-07 22:07:22 -070098
99Deploy the Quagga Docker Image
100^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Zack Williamsd63d35b2020-06-23 14:12:46 -0700101
102Trellis uses a slightly modified version of Quagga, so the easiest way to
103deploy this is to use the provided docker image.
Charles Chan8d3ae672019-09-07 22:07:22 -0700104
105.. code-block:: console
106
Charles Chan8299f072019-09-23 11:32:26 -0700107 $ docker pull opencord/quagga
Charles Chan8d3ae672019-09-07 22:07:22 -0700108
Zack Williamsd63d35b2020-06-23 14:12:46 -0700109We also need to download the **pipework** tool which will be used to connect
110the docker image to the physical interface that we set aside earlier.
Charles Chan8d3ae672019-09-07 22:07:22 -0700111
112.. code-block:: console
113
Charles Chan8299f072019-09-23 11:32:26 -0700114 $ wget https://raw.githubusercontent.com/jpetazzo/pipework/master/pipework
115 $ chmod +x pipework
Charles Chan8d3ae672019-09-07 22:07:22 -0700116
Zack Williamsd63d35b2020-06-23 14:12:46 -0700117Create a directory for your Quagga configuration files, and create a bgpd.conf
118and zebra.conf in there. This folder is going to be mounted into the Quagga
119container. More on configuring Quagga later.
Charles Chan8d3ae672019-09-07 22:07:22 -0700120
121.. code-block:: console
122
Charles Chan8299f072019-09-23 11:32:26 -0700123 $ mkdir configs
124 $ touch zebra.conf bgpd.conf
Charles Chan8d3ae672019-09-07 22:07:22 -0700125
Zack Williamsd63d35b2020-06-23 14:12:46 -0700126Now run the docker image (make sure the path the config directory matches what
127is on your system):
Charles Chan8d3ae672019-09-07 22:07:22 -0700128
129.. code-block:: console
130
Charles Chan8299f072019-09-23 11:32:26 -0700131 $ sudo docker run --privileged -d -v configs:/etc/quagga -n quagga opencord/quagga
Charles Chan8d3ae672019-09-07 22:07:22 -0700132
Zack Williamsd63d35b2020-06-23 14:12:46 -0700133Finally, we can use the pipework tool to add the physical interface into the
134container so that Quagga can talk out over the fabric:
Charles Chan8d3ae672019-09-07 22:07:22 -0700135
136.. code-block:: console
137
Charles Chan8299f072019-09-23 11:32:26 -0700138 $ sudo ./pipework mlx1 -i eth1 quagga 10.0.1.3/24
Charles Chan8d3ae672019-09-07 22:07:22 -0700139
Zack Williamsd63d35b2020-06-23 14:12:46 -0700140This will add host interface ``mlx1`` to the container with name ``quagga``
141with interface name ``eth1`` inside the container. The newly added interface
142will have the IP ``10.0.1.3``. This IP address should be the peering subnet
143address that you want to assign to Quagga.
Charles Chan8d3ae672019-09-07 22:07:22 -0700144
Zack Williamsd63d35b2020-06-23 14:12:46 -0700145If you need to change anything about the container (for example if you change
146the Quagga configuration) you can remove the original container and run a new
147one:
Charles Chan8d3ae672019-09-07 22:07:22 -0700148
149.. code-block:: console
150
Charles Chan8299f072019-09-23 11:32:26 -0700151 $ sudo docker rm -f quagga
152 $ sudo docker run --privileged -d -v configs:/etc/quagga -n quagga opencord/quagga
Charles Chan8d3ae672019-09-07 22:07:22 -0700153
154Configure Quagga
155^^^^^^^^^^^^^^^^
Zack Williamsd63d35b2020-06-23 14:12:46 -0700156
157At this point Quagga should have IP connectivity to the external routers, and
158it should be able to ping them on the peering subnet.
Charles Chan8d3ae672019-09-07 22:07:22 -0700159
160Now Quagga and the upstream routers can be configured to peer with one another.
Zack Williamsd63d35b2020-06-23 14:12:46 -0700161This configuration of Quagga is going to be highly dependent on the
162configuration of the upstream network, so it won't be possible to give
163comprehensive configuration examples here.
164
165It is recommended to consult the Quagga documentation for exhaustive
166information on Quagga's capabilities and configuration. Here I will attempt to
167provide a few basic examples of Quagga configuration to get you started.
168You'll have to enhance these with the features and functions that are needed in
169your network.
Charles Chan8d3ae672019-09-07 22:07:22 -0700170
171Zebra configuration
172"""""""""""""""""""
Zack Williamsd63d35b2020-06-23 14:12:46 -0700173
174Regardless of which routing protocols you are using in your network, it is
175important to configure Zebra's FPM connection to send routes to the FPM app
176running on ONOS. This feature was enabled by the patch that was applied
177earlier when we installed Quagga.
Charles Chan8d3ae672019-09-07 22:07:22 -0700178
179A minimal Zebra configuration might look like this:
180
181.. code-block:: text
182
Charles Chan8299f072019-09-23 11:32:26 -0700183 !
184 hostname cord-zebra
185 password cord
186 !
187 fpm connection ip 10.6.0.1 port 2620
188 !
Charles Chan8d3ae672019-09-07 22:07:22 -0700189
Zack Williamsd63d35b2020-06-23 14:12:46 -0700190The FPM connection IP address is the IP address of **one of the onos cluster
191instances** - does not matter which one. If you have other configuration that
192needs to go in zebra.conf you should add that here as well.
Charles Chan8d3ae672019-09-07 22:07:22 -0700193
194BGP configuration
195"""""""""""""""""
Zack Williamsd63d35b2020-06-23 14:12:46 -0700196
197An example simple BGP configuration for peering with one BGP peer might look
198like this:
Charles Chan8d3ae672019-09-07 22:07:22 -0700199
200.. code-block:: text
201
Charles Chan8299f072019-09-23 11:32:26 -0700202 hostname bgp
203 password cord
204 !
205 ip prefix-list 1 seq 10 permit 192.168.0.0/16
206 !
207 route-map NEXTHOP permit 10
208 match ip address prefix-list 1
209 set ip next-hop 10.0.1.2
210 !
211 router bgp 65535
212 bgp router-id 10.0.1.3
213 !
214 network 192.168.0.0/16
215 !
216 neighbor 10.0.1.1 remote-as 65540
217 neighbor 10.0.1.1 description upstream1
218 neighbor 10.0.1.1 route-map NEXTHOP out
219 !
Charles Chan8d3ae672019-09-07 22:07:22 -0700220
Zack Williamsd63d35b2020-06-23 14:12:46 -0700221This configuration peers with one upstream router ``10.0.1.1`` and advertises
222one route ``192.168.0.0/16``. Note that Quagga (and as a result Trellis) is in
223a different AS ``65535`` from the upstream router AS ``65540``, as we are using
224E-BGP for this connectivity.
Charles Chan8d3ae672019-09-07 22:07:22 -0700225
226.. note::
Zack Williamsd63d35b2020-06-23 14:12:46 -0700227 Pay attention to the configuration to rewrite the next hop of routes that
228 are advertised to the upstream router.
Charles Chan8d3ae672019-09-07 22:07:22 -0700229
Zack Williamsd63d35b2020-06-23 14:12:46 -0700230 A ``route-map`` is used to set the next hop of advertised routes to
231 ``10.0.1.2``, which is **different from the address that Quagga is using to
232 peer with the external router**.
233
234 As mentioned above, it is important that this rewriting is done correctly
235 so that the fabric switch is able to **distinguish data plane and control
236 plane** traffic.
Charles Chan8d3ae672019-09-07 22:07:22 -0700237
238Route service and static route
239------------------------------
240
241Access route service via CLI
242^^^^^^^^^^^^^^^^^^^^^^^^^^^^
243
244View routes
245"""""""""""
Zack Williamsd63d35b2020-06-23 14:12:46 -0700246
Charles Chan8d3ae672019-09-07 22:07:22 -0700247This will show routes from all sources, including static and dynamic routes.
Zack Williamsd63d35b2020-06-23 14:12:46 -0700248
249The example below shows routes learned from the upstream router (Source: FPM)
250and routes configured manually (Source: STATIC)
Charles Chan8d3ae672019-09-07 22:07:22 -0700251
252.. code-block:: text
253
Charles Chan8299f072019-09-23 11:32:26 -0700254 onos> routes
Charles Chan8d3ae672019-09-07 22:07:22 -0700255
Charles Chan8299f072019-09-23 11:32:26 -0700256 B: Best route, R: Resolved route
Charles Chan8d3ae672019-09-07 22:07:22 -0700257
Charles Chan8299f072019-09-23 11:32:26 -0700258 Table: ipv4
259 B R Network Next Hop Source (Node)
260 0.0.0.0/0 172.16.0.1 FPM (127.0.0.1)
261 > * 1.1.0.0/18 10.0.1.20 STATIC
262 > * 10.0.99.0/24 10.0.1.1 FPM (127.0.0.1)
263 * 10.0.99.0/24 10.0.6.1 FPM (127.0.0.1)
264 Total: 2
Charles Chan8d3ae672019-09-07 22:07:22 -0700265
Charles Chan8299f072019-09-23 11:32:26 -0700266 Table: ipv6
267 B R Network Next Hop Source (Node)
268 > * 2000::7700/120 fe80::288:ff:fe00:1 FPM (127.0.0.1)
269 > * 2000::8800/120 fe80::288:ff:fe00:2 FPM (127.0.0.1)
270 > * 2000::9900/120 fe80::288:ff:fe00:1 FPM (127.0.0.1)
271 * 2000::9900/120 fe80::288:ff:fe00:2 FPM (127.0.0.1)
272 Total: 3
Charles Chan8d3ae672019-09-07 22:07:22 -0700273
274
275Add a static route
276""""""""""""""""""
277
278.. code-block:: console
279
Charles Chan8299f072019-09-23 11:32:26 -0700280 onos> route-add <prefix> <nexthop>
281 onos> route-add 1.1.0.0/18 10.0.1.20
282 onos> route-add 2020::101/120 2000::1
Charles Chan8d3ae672019-09-07 22:07:22 -0700283
284
285Remove a static route
286"""""""""""""""""""""
287
288.. code-block:: console
289
Charles Chan8299f072019-09-23 11:32:26 -0700290 onos> route-remove <prefix> <nexthop>
291 onos> route-remove 1.1.0.0/18 10.0.1.20
Charles Chan8d3ae672019-09-07 22:07:22 -0700292
293
294Access route service via REST
295^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
296
297Single route
298""""""""""""
299
300.. code-block:: console
301
Charles Chan8299f072019-09-23 11:32:26 -0700302 $ curl --user onos:rocks -X POST -H 'Content-Type:application/json' http://<controller-ip>:8181/onos/routeservice/routes -d@routes.json
303 $ curl --user onos:rocks -X GET -H 'Accept:application/json' http://<controller-ip>:8181/onos/routeservice/routes | python -mjson.tool
304 $ curl --user onos:rocks -X DELETE -H 'Content-Type:application/json' http://<controller-ip>:8181/onos/routeservice/routes -d@routes.json
Charles Chan8d3ae672019-09-07 22:07:22 -0700305
306with identical json format for both POST and DELETE:
307
308.. code-block:: json
309
Charles Chan8299f072019-09-23 11:32:26 -0700310 {
311 "prefix": "20.0.0.1/24",
312 "nextHop": "10.0.1.10"
313 }
Charles Chan8d3ae672019-09-07 22:07:22 -0700314
315
316Bulk routes
317"""""""""""
318
319.. code-block:: console
320
Charles Chan8299f072019-09-23 11:32:26 -0700321 $ curl --user onos:rocks -X POST -H 'Content-Type:application/json' http://<controller-ip>:8181/onos/routeservice/routes/bulk -d@routes.json
322 $ curl --user onos:rocks -X DELETE -H 'Content-Type:application/json' http://<controller-ip>:8181/onos/routeservice/routes/bulk -d@routes.json
Charles Chan8d3ae672019-09-07 22:07:22 -0700323
324with identical json format for both POST and DELETE:
325
326.. code-block:: json
327
Charles Chan8299f072019-09-23 11:32:26 -0700328 {
329 "routes": [
330 {
331 "prefix": "20.0.0.1/24",
332 "nextHop": "10.0.1.10"
333 },
334 {
335 "prefix": "30.0.0.1/24",
336 "nextHop": "10.0.2.15"
337 }
338 ]
339 }
Charles Chan8d3ae672019-09-07 22:07:22 -0700340
341
342Verify routes
343^^^^^^^^^^^^^
Zack Williamsd63d35b2020-06-23 14:12:46 -0700344Check the leaf switches that the route (e.g. 1.1.0.0/18) has been programmed in
345the routing table (table 30).
Charles Chan8d3ae672019-09-07 22:07:22 -0700346
347.. code-block:: console
348
Charles Chan8299f072019-09-23 11:32:26 -0700349 onos> flows any of:0000000000000205 30
350 <snip>
351 id=670000d1f6782c, state=ADDED, bytes=0, packets=0, duration=39, liveType=UNKNOWN, priority=36010, tableId=30, appId=org.onosproject.segmentrouting, payLoad=null, selector=[ETH_TYPE:ipv4, IPV4_DST:1.1.0.0/18],
352 treatment=DefaultTrafficTreatment{immediate=[], deferred=[GROUP:0x70000014], transition=TABLE:60, meter=None, cleared=false, metadata=null}
353 <snip>
Charles Chan8d3ae672019-09-07 22:07:22 -0700354
355Notes about next hops
356^^^^^^^^^^^^^^^^^^^^^
Zack Williamsd63d35b2020-06-23 14:12:46 -0700357The next hop of a route should be resolvable to a MAC address that is known to
358ONOS. Typically the next hop is a server interface that is known to ONOS as a
359host learned via ARP or DHCP. If you are not sure, check the ``hosts`` command
360on the ONOS CLI.
Charles Chan8d3ae672019-09-07 22:07:22 -0700361
362.. code-block:: console
363
Charles Chan8299f072019-09-23 11:32:26 -0700364 onos> hosts
365 <snip>
366 id=A2:9B:32:9D:7F:B3/None, mac=A2:9B:32:9D:7F:B3, location=of:0000000000000205/48, vlan=None, ip(s)=[192.168.101.2], configured=false
367 id=B2:A4:E2:72:D1:91/None, mac=B2:A4:E2:72:D1:91, location=of:0000000000000204/16, vlan=None, ip(s)=[10.0.1.20], configured=false
368 id=EE:22:F7:BE:86:50/None, mac=EE:22:F7:BE:86:50, location=of:0000000000000205/16, vlan=None, ip(s)=[10.0.2.15], configured=false
Charles Chan8d3ae672019-09-07 22:07:22 -0700369
Zack Williamsd63d35b2020-06-23 14:12:46 -0700370If the next hop has not been resolved for any reason, it would be necessary to
371configure the next hop as a host (/32 prefix) together with MAC address and
372location.
Charles Chan8d3ae672019-09-07 22:07:22 -0700373
Zack Williamsd63d35b2020-06-23 14:12:46 -0700374Learn more about how to configure a host using `Network Config Host Provider
375<https://wiki.onosproject.org/display/ONOS/Network+Config+Host+Provider>`_
376
377Finally note that if you are configuring routes manually/statically and they
378are publicly routable IPs that should be reachable from “outside”, you would
379need to configure Quagga to advertise them upstream.
Charles Chan8d3ae672019-09-07 22:07:22 -0700380
381
382Route blackhole
383---------------
Zack Williamsd63d35b2020-06-23 14:12:46 -0700384The blackhole consists of a rule on table 30 on every edge device on the
385fabric. The Table 30 rule matches on a given IP address and mask and has
386nothing but a clearDeferred action, practically dropping the packet. Every IP
387we want to blackhole will have it's own rule in every edge switch.
Charles Chan8d3ae672019-09-07 22:07:22 -0700388
389An example of such rule is:
390
391.. code-block:: text
392
Charles Chan8299f072019-09-23 11:32:26 -0700393 ADDED, bytes=0, packets=0, table=30, priority=48010, selector=[ETH_TYPE:ipv4, IPV4_DST:50.0.0.0/24], treatment=[transition=TABLE:60]
Charles Chan8d3ae672019-09-07 22:07:22 -0700394
395Route blackholing can be done via network configuration.
396
397.. code-block:: json
398
Charles Chan8299f072019-09-23 11:32:26 -0700399 {
400 "apps" : {
401 "org.onosproject.segmentrouting" : {
402 "segmentrouting": {
403 "blackholeIps": [
404 "50.0.0.0/24"
405 ]
406 }
407 }
408 }
409 }
Harshada Chaundkarabcd53c2019-09-23 20:53:46 +0000410
411Ignore certain FPM peer
412-----------------------
Zack Williamsd63d35b2020-06-23 14:12:46 -0700413The ``FpmConnectionInfo`` consists a new flag ``acceptRoutes``, indicating
414whether we want to accept or discard the routes advertised by certain FPM peer.
415Per current requirement, we always have the ``acceptRoutes`` flag set to
416``true`` by default, meaning that we will accept routes from all peers.
Harshada Chaundkarabcd53c2019-09-23 20:53:46 +0000417
418We can updated the flag using REST API and CLI command as below
419
420REST API
421^^^^^^^^
422- ``POST /acceptRoutes`` to enable or disable acceptRoutes flag
423- ``GET /acceptRoutes`` to fetch the current status of the FPM connection
424
425.. image:: ../images/config-fpm-rest.png
426 :width: 900px
427
Harshada Chaundkarabcd53c2019-09-23 20:53:46 +0000428CLI
429^^^
430
431- ``fpm-set-accept-routes`` to enable or disable acceptRoutes flag
432
433 .. code-block:: console
434
435 onos> fpm-set-accept-routes 10.250.16.40 52560 false
436
437- ``fpm-get-accept-route`` to fetch the current status of the FPM connection
438
439 .. code-block:: console
440
441 onos> fpm-get-accept-route
442 <snip>
443 peer 10.250.16.40 port 52560 acceptRoutes false
444 peer 10.250.16.41 port 52594 acceptRoutes true
445 <snip>