Border Gateway Protocol 4 (BGP-4)

How BGP exchanges reachability, chooses paths using policy and distributes them inside an autonomous system.

Peers exchange prefixes and path attributes

BGP peers establish a session over TCP port 179. External BGP (eBGP) connects routers in different autonomous systems (ASes), while internal BGP (iBGP) distributes BGP routes within an AS. UPDATE messages advertise reachability and withdraw routes that are no longer available.

The AS_PATH describes the sequence of ASes associated with a route. An AS normally rejects a route containing its own AS number to prevent loops. The NEXT_HOP tells the receiving router where to send traffic, and the next hop must be resolvable for the path to be usable.

Local policy can prefer a longer AS path

Routers apply import policy and compare eligible paths for the same prefix. LOCAL_PREF expresses the preferred exit inside an AS. A higher local preference can win over a shorter AS path. Other factors can include origin, MED and the cost to reach the next hop. Platform-specific steps and policy settings can affect the order.

For example, with other earlier criteria equal, local preference 200 beats local preference 100 even when the preferred path traverses two ASes and the other traverses one. If the preferred next hop becomes unreachable, the router must choose from the remaining eligible paths.

Route reflection reduces the iBGP mesh

Ordinary iBGP peers do not re-advertise routes learned from one iBGP peer to another. A route reflector is allowed to send a client-learned path to other clients and to non-client peers. A path learned from a non-client can be reflected to clients. Clients can learn each other’s routes without a direct iBGP session.

The ORIGINATOR_ID and CLUSTER_LIST attributes help prevent reflection loops. A reflector normally propagates its selected path, so its location and policy can influence which paths clients learn. The reflector need not be in the data path if clients can resolve the advertised next hop.

Try it in a lab

  1. On a BGP-capable lab router, receive the same IPv4 prefix from two eBGP peers with reachable next hops. Make the path through one peer two AS hops long and the other one hop long. With other earlier selection criteria equal, verify that raising local preference for the longer path changes the selected exit.
  2. Build three iBGP speakers in one AS with the middle speaker acting as a route reflector and the outer two as clients. Advertise an IPv4 loopback from one client and confirm that the other learns it without a direct session between clients.
  3. Inspect the reflected route for the originating client’s router ID and the reflector’s cluster ID. Confirm the receiving client can resolve the route’s next hop.

Sources