> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/cgw/1.7/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/cgw/1.7/concepts/routing_basics.md).

# Routing basics

To announce routes to external partners, we use the Border Gateway Protocol (BGP).
Using this, the routers connect and create a session, and announce network
prefixes.

![IPs and routes](https://docs.cennso.com/api/assets/components/cgw/1.7/resources/images/bgp-announced-routing-with-ip.svg)

In the example above, the router `C2` announces the prefix
`2001:db8:2000::/64` via `2001:db8:1000::2`.
The router `C3` announces the networks connected to the router and not
shown in the picture to router `C2`.
Then, `C3` announces networks that are not directly connected to the
router, but reachable via other routers connected to router `C3` and so forth.

## Routing preferences

When multiple routers are connected to one router, it makes sense to
announce which router is preferred.

![multiple-routers](https://docs.cennso.com/api/assets/components/cgw/1.7/resources/images/bgp-announced-routing-duo.svg)

One way to do it is to set a local preference of the router in the BGP
configuration. The router with the highest preference is selected.
The drawback is that our side decides which router is preferred and
not the other side, although they might have the need to change the value
during maintenance.

The second option to select one router over the other is to send a *MED* value
(Multi-Exit Discriminator). If both routers have the same preference based on other values, the one with
the lowest MED value is selected. The MED value is transmitted via Border Gateway Protocol.
