BGP (Border Gateway Protocol)

The Border Gateway Protocol (BGP) is an inter-autonomous system routing protocol. An autonomous system is a network or group of networks under a common administration and with common routing policies. BGP is used to exchange routing information for the Air-Stream WAN and is the protocol used between our Access Points Routers (APR). BGP is a very robust and scalable routing protocol, as evidenced by the fact that BGP is the main routing protocol employed on the Internet today. To achieve scalability, BGP uses many route parameters, called attributes, to define routing policies and maintain a stable routing environment. In addition to the BGP attributes, classless inter-domain routing (CIDR) is used to reduce the size of the routing tables. For example, assume that an APR such as Julia Farr owns the IP address block 10.123.x.x, this block would consist of 256 address blocks 10.123.0.x through to 10.123.255.x. If the APR assigns each block to a member without CIDR it would be necessary for the APR to advertise 256 address blocks to its peers. But CIDR can subnet the address space and advertise only one block 10.123.x.x which is much smaller as it is rendered obsolete by CIDR, allowing a significant reduction in the BGP routing tables.

BGP Attributes

Routes learned via BGP have associated properties that are used to determine the best route to a destination when multiple paths exist to a particular destination eg where an APR has multiple backbones. These properties are referred to as BGP attributes and include:

  • Weight
  • Local preference
  • Multi-exit discriminator
  • Origin
  • AS_path
  • Next hop
  • Community

Weight Attribute

Weight is an attribute that is local to a router. The weight attribute is not advertised to neighbouring routers. If the router learns about more than one route to the same destination, the route with the highest weight will be preferred and will be installed in the IP routing table.

Local Preference Attribute

The local preference attribute is used to prefer an exit point from the local autonomous system (AS). Unlike the weight attribute, the local preference attribute is propagated throughout the local AS. If there are multiple exit points from the AS, the local preference attribute is used to select the exit point for a specific route.

Multi-Exit Discriminator Attribute

The multi-exit discriminator (MED) is used as a suggestion to an external AS regarding the preferred route. The term suggestion is used because the external AS that is receiving the MEDs may be using other BGP attributes for route selection.

Origin Attribute

The origin attribute indicates how BGP learned about a particular route. The origin attribute can have one of three possible values:

  • IGP is the route interior to the originating AS. This value is set when the network router configuration command is used to inject the route into BGP.
  • EGP is the route learned via the Exterior Border Gateway Protocol (EBGP).
  • Incomplete is where the origin of the route is unknown or learned in some other way.

AS path Attribute

When a route advertisement passes through an autonomous system, the AS number is added to an ordered list of AS numbers that the route advertisement has traversed.

Next-Hop Attribute

The EBGP next-hop attribute is the IP address that is used to reach the advertising router. For EBGP peers, the next-hop address is the IP address of the connection between the peers. For IBGP, the EBGP next-hop address is carried into the local AS, as illustrated in Therefore, it is important to have an IGP running in the AS to propagate next-hop routing information.

Community Attribute

The community attribute provides a way of grouping destinations, called communities, to which routing decisions (such as acceptance, preference, and redistribution) can be applied. Route maps are used to set the community attribute. Predefined community attributes are:

  • no-export—Do not advertise this route to EBGP peers.
  • no-advertise—Do not advertise this route to any peer.
  • internet—Advertise this route to the Internet community; all routers in the network belong to it.

BGP could possibly receive multiple advertisements for the same route from multiple sources. BGP selects only one path as the best path. When the path is selected, BGP puts the selected path in the IP routing table and propagates the path to its neighbours. BGP uses the following criteria, in the order presented, to select a path for a destination:

  • If the path specifies a next hop that is inaccessible, drop the update.
  • Prefer the path with the largest weight.
  • If the weights are the same, prefer the path with the largest local preference.
  • If the local preferences are the same, prefer the path that was originated by BGP running on this router.
  • If no route was originated, prefer the route that has the shortest AS path.
  • If all paths have the same AS path length, prefer the path with the lowest origin type (where IGP is lower than EGP, and EGP is lower than incomplete).
  • If the origin codes are the same, prefer the path with the lowest MED attribute.
  • If the paths have the same MED, prefer the external path over the internal path.
  • If the paths are still the same, prefer the path through the closest IGP neighbour.
  • Prefer the path with the lowest IP address, as specified by the BGP router ID.
zebra.conf:
-------------------------
hostname blah                # your hostname
password blah                # your password
enable password blah
interface rl0                # your interfaces
interface wi0
interface wi1
line vty
-------------------------

bgpd.conf:
-------------------------
hostname blah
password blah
enable password blah
router bgp 655xx            # your AS
network 10.x.x.x/27            # 
network 10.y.y.y/30            # your networks
network 10.z.z.z/30            #
neighbor 10.y.y.y remote-as 655yy    # peer1
neighbor 10.z.z.z remote-as 655zz    # peer2
line vty
------------------------- 

Good resources for BGP routing are: