BGP
CLI reference:/routing/bgp
RouterOS implements BGP-4 for IPv4 and IPv6, with multiprotocol extensions for the VPN services that run over BGP. A router runs one or more BGP instances, each with its own AS number and router ID, and a connection for each peer or group of peers. Routing filters decide which routes are accepted and advertised.
Start with Understanding BGP for the concepts and Peering sessions for the configuration.
Related pages: Route selection and filtering (routing filters for BGP), RPKI (origin and ASPA validation), EVPN, VRF (L3VPN) and VPLS.
Understanding BGP
How BGP works in RouterOS: terms, sessions and messages, the BGP menus, the ORIGIN attribute, the best-path selection steps and what changes when a router runs several BGP instances.
Peering sessions
Configure BGP peering in RouterOS: an eBGP session, iBGP with a route reflector that accepts dynamic sessions from a loopback range, BGP unnumbered over IPv6 link-local addresses, how the local address is chosen, and how to check, stop, clear and refresh sessions.
Nexthop selection
How RouterOS BGP handles the next hop: what it checks on received routes, how it resolves them, and how it chooses the next hop it sends to each peer with nexthop-choice, route reflection and routing filters.
Route leak prevention
Prevent route leaks with BGP roles (RFC 9234) in RouterOS: the roles of local.role, role negotiation in the OPEN message, the Only to Customer (OTC) attribute, and examples for a transit provider, a customer, a lateral peer and a route server.
FAQ
Answers to common BGP questions in RouterOS: eBGP to a loopback address, network synchronization, hiding or removing AS numbers from the path, best-path selection across instances, routes that are not advertised, and SNMP polling with a full table.