Skip to content

BGP

Border Gateway Protocol

Border Gateway Protocol (BGP) is an EGP standardized path-vector routing protocol that guarantees scalability, flexibility, and network stability. It was established by the Internet Engineering Task Force (IETF) and is known as the primary routing protocol for service provider networks and the internet. BGP was initially designed to provide internet connectivity information, but has expanded its ability to support multicast, IPv6, and VPN routes, among other forms of data.

The Neighbor Command

  • The peering between routers works differently for BGP than for IGPs.
  • BGP routers located in the same AS may not be physically connected directly and could be separated by several intermediary hops.
  • Using link-local multicast Hello messages to form adjacencies is not possible, as they are not forwarded to another interface.
  • To establish BGP peering, it is necessary to specify the neighbor manually.
  • This is done by including a neighbor statement in the configuration and providing the IP address of the peer router.

How BGP Works

  • The administrator configures BGP and specifies the neighbor IP address.
  • In order for a router to send BGP packets to the destination router, there must be a route to the neighbor IP address in the router's routing table. Otherwise, the router will not know how to reach the destination.

iBGP Neighbors

  • If the BGP session is established using the IP address of a physical interface, and that interface becomes unavailable, the BGP session will be disrupted, even if there are alternative paths available to reach the router.
  • Loopback addresses, usually advertised within the IGP, are commonly used as the address in the neighbor statement for BGP peers. This allows the BGP peers to maintain connectivity with each other even if a physical interface fails.
  • BGP routers connected inside the same AS through BGP belong to an internal BGP session, or IBGP. In order to prevent routing table loops, IBGP does not advertise IBGP-learned routes to other routers in the same session. As such, IBGP requires a full mesh of all peers. For large networks, this quickly becomes unscalable. Introducing route reflectors removes the need for the full-mesh.

BGP Router Advertisement Rules

  • BGP gives more importance to advertising routes that it is actively using.
  • BGP advertises routes it has learned from an external BGP peer with all of its BGP peers, whether they are external or internal to its own network.
  • Once BGP has successfully connected with a new peer, BGP advertises all the routes matching the above criteria to the peer. Then, BGP only shares updates related to changes or additions to those routes with the peer.

Address-family specification

Inside the BGP, configuration, there are multiple options tied to a specific address-family. BGP uses mostly the same protocol for both IPv4 and IPv6 for communicating with peers (establishing and maintaining a BGP-connection), but has further options regarind route-distribution for each protocol. For this, address-family subsets are used when configuring BGP. For TTM4240, address families IPv4-Unicast and IPv6-Unicast are used. Notice, that when configuring each of the address-types, the inputs are set within the correct address-family.

FRR example:

router bgp AS
 bgp router-id ROUTER-ID
 neighbor PEER remote-as PEER-AS
 neighbor iBGP-PEER remote-as AS (Same AS as local router)
 !
 address-family ipv4 unicast
  network NETWORK-TO-SHARE
  redistribute connected
  redistribute ospf
  neighbor PEER prefix-list PREFIX-LIST-NAME-IPv4 in
  neighbor PEER prefix-list PREFIX-LIST-NAME-IPv4 out
 exit-address-family
 address-family ipv6 unicast
  redistribute connected
  redistribute ospf6
  neighbor PEER activate
  neighbor PEER prefix-list PREFIX-LIST-NAME-IPv6 in
  neighbor PEER prefix-list PREFIX-LIST-NAME-IPv6 out

VyOS example:

set protocols bgp $name address-family ipv4-unicast redistribute connected
set protocols bgp $name address-family ipv6-unicast redistribute connected
set protocols bgp $name neighbor PEER remote-as PEER-AS
set protocols bgp $name neighbor PEER address-family ipv4-unicast prefix-list export PREFIX-LIST-NAME-IPv4
set protocols bgp $name neighbor PEER address-family ipv4-unicast prefix-list import PREFIX-LIST-NAME-IPv4
set protocols bgp $name neighbor PEER address-family ipv6-unicast prefix-list export PREFIX-LIST-NAME-IPv6
set protocols bgp $name neighbor PEER address-family ipv6-unicast prefix-list import PREFIX-LIST-NAME-IPv6
set protocols bgp $name parameters router-id ROUTER-ID (probably ipv4 loopback address)

Commands

Platform Protocol Documentation Link
FRR BGP FRR
VyOS BGP VyOS