Skip to content

M14 Border Gateway Protocol

Back to the Course Schedule

ENABLE THE ENGLISH SUBTITLES, These videos are spoken in Finnish

Lecture Videos

Video: Data Networks, Border Gateway Protocol

BGP

Quote

RFC 4271 says: ” The Border Gateway Protocol (BGP) is an inter-Autonomous System routing protocol.”

BGP works in TCP port 179. To work BGP needs an established state from TCP: If we are exchanging the whole Internet routing table, we want it to realiably go through. BGP can have a lot of routes in the routing table. BGP has methods to send updates to only certain routes of the routing table.

The whole routing table isn’t needed to send through every update, thus BGP is a SLOW protocol. This is intentional to have the Internet stable. Effects:

  • The changes you make might take a while to update to neighbors
  • The badly advertised subnets/prefix's take time to refresh

BGP bases its usage on Autonomous Systems.

Autonomous System - AS

What is an Autonomous System?

Quote

”An AS is a connected group of one or more IP prefixes run by one or more network operators which has a SINGLE and CLEARLY DEFINED routing policy. ”

!a

Autonomous Systems are registered and numbered in the Internet by IANA. RIPE allocates the numbers in Europe.

Some AS numbers to be mentioned:

On our course

Imagine yourself

  1. being an Network Administrator, with an whole network of your own. Like the one you've done in Exercise 16.
  2. Think that every other student at that same point wants to interconnect their network to yourself
  3. The "glue" between your networks is BGP

!BGP on the course

Distance Vector Protocol

BGP is a Distance Vector routing protocol.

  • This distance is measured through different metrics.
  • vector is (with a little bit of simplification) the NEXT_HOP metric.

To decide the best route for a given subnet. BGP uses NLRI.

Network Layer Reachability Information - NLRI

!a

Prefix is a fancy term for subnet address

  • 2.0.0.0/24 is the prefix for IPv4 address of 256 computers
  • 2001:dead:beef:5::/64 is the prefix for 2^64 computers

Thus NLRI is metrics attached to the prefix.

  • Similarly as a human might have multiple metrics weight and height as their attributes
  • or a car might have multiple metrics e.g. model and engine

Metrics: AS_PATH

AS_PATH is the number of Autonomous Systems along the packet's travel.

!a

Metrics: ORIGIN

ORIGIN marks the source of the prefix: Where has the prefix been learned?

  1. it has been introduced to the BGP protocol with a network -command
    • set protocol bgp 343 address-family ipv4-unicast network 2.0.0.0/24
    • The prefix attribute of ORIGIN is marked as I for Internal
  2. it has been learnt from another BGP process (this is a little bit rarer)
    • set protocols bgp 343 address-family ipv4-unicast redistribute bgp 500
    • The prefix attribute of ORIGIN is marked as E for External
  3. it has been learn from an routing protocol other than BGP
    • set protocols bgp 343 address-family ipv4-unicast redistribute ospf
    • The prefix attribute of ORIGIN is marked as ? for Incomplete

Metrics: NEXT_HOP

NEXT_HOP is an variable that contains the next BGP router.

!a

Other Metrics

  • Local Preference - What is the exit router for a given subnet (requires multiple BGP exit routers)
  • Multi Exit Discriminator - MED - How I want traffic to enter my Autonomous System (requires multiple BGP incoming routers)
  • Atomic Aggregate - "Supernet" of subnets in BGP
  • Aggregator - The router who "supernetted" the subnets
  • Community - a tag related to many subnets (can be tagged to belong to a certain customer [e.g. MPLS-VPN instance])
  • ... and many more

Address families

BGP was designed to carry IPv4 NLRI –information, but it can support a whole bunch of different protocols (called address families).

RFC 1700 - Assigned Numbers - Address Family Numbers

!a

Thus BGP supports IPv4 and IPv6.

Looking Glass services in the Internet

Looking Glasses are services ran by operators to take a peek into their view of the Internet.

Assuming you have connectivity to the Internet, you can see how your prefix is advertised through BGP.

Example: Telia Looking Glass, Tokyo - 195.148.26.0 - 2.11.2020

!a

Problems with BGP

Configuring BGP

BGP should be configured between Loopbacks, but that is an hassle of its own.

Lets do it on this course a little bit simpler: neighborship between ethX ip addresses.

Configuring BGP - IPv4

set protocols bgp <my_as_number> neighbor <ipv4 of neighbor> remote-as <neighbor_as_number>

e.g.

Declares a neighboring routers which TCP connections are tried to establish for a BGP neighborship.

Both routers must have mirroring settings!

Example Router AS 111

set protocols bgp 111 neighbor 2.2.2.2 remote-as 222

Example Router AS 222

set protocols bgp 222 neighbor 1.1.1.1 remote-as 111

set protocols bgp <my_as_number> address-family ipv4-unicast network <ipv4 subnet>

Similar to OSPF, but "doesn't send BGP HELLO".

Only advertises the network through BGP to other neighbors.

set protocols bgp 111 address-family ipv4-unicast network 1.1.1.0/24

set protocols bgp address-family ipv4-unicast redistribute <ospf/static/connected>

Redistributes one routing protocol routes to another and starts to advertise them to neighbors.

set protocols bgp 111 address-family ipv4-unicast redistribute ospf

Takes OSPF routes from show ip route ospf and starts to advertise them to neighbors through BGP.

set protocols ospf redistribute bgp metric-type 2

Redistributes one routing protocol routes to another and starts to advertise them to neighbors.

set protocols ospf redistribute bgp metric-type 2

Takes BGP routes from show ip route bgp and starts to advertise them to neighbors through OSPF.

Configuring BGP - IPv6

set protocols bgp <my_as_number> address-family ipv6-unicast network <ipv6 subnet>

IPv6 address-family has to be enabled separately, but starts to advertise the IPv6 subnet/prefix to neighboring BGP devices.

set protocols bgp 111 address-family ipv6-unicast network 2001:dead:beef:5::/64

set protocols bgp <my_as_number> neighbor <ip> address-family ipv6-unicast

Enables the IPv6 address-family for a neighbor. Required to receive IPv6 routes through BGP.

set protocols bgp 222 neighbor 1.1.1.1 address-family ipv6-unicast

Configuring BGP - show commands

show ip bgp

!a

show ip bgp <prefix>

!a

show ip bgp neighbors

!a

show ipv6 bgp

!a

show ip bgp summary

!a

show ip route

!a

show ip route bgp

!a

Continue to the Exercises

E17 Welcome to the Internet, I'll be your guide

Back to the Schedule?

Back to the Course Schedule


License

This course and its materials are written by Karo Saharinen and licenced by Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) license.

Creative Commons -licence