M14 Border Gateway Protocol
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. ”
Autonomous Systems are registered and numbered in the Internet by IANA. RIPE allocates the numbers in Europe.
Some AS numbers to be mentioned:
- AS719 – Elisa Oyj
- AS1741 – FUNET AS
- AS12582 – TeliaSoneraFinland – Datanet (TSF MPLS VPN Services)
- AS16086 – DNA Oy
- AS15496 – Aalto University
- AS16273 – F-Secure Oyj
On our course
Imagine yourself
- being an Network Administrator, with an whole network of your own. Like the one you've done in Exercise 16.
- Think that every other student at that same point wants to interconnect their network to yourself
- The "glue" between your networks is BGP
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) theNEXT_HOP
metric.
To decide the best route for a given subnet. BGP uses NLRI.
Network Layer Reachability Information - NLRI
Prefix
is a fancy term for subnet address
2.0.0.0/24
is theprefix
for IPv4 address of 256 computers2001:dead:beef:5::/64
is theprefix
for 2^64 computers
Thus NLRI
is metrics
attached to the prefix
.
- Similarly as a
human
might have multiple metricsweight
andheight
as their attributes - or a
car
might have multiple metrics e.g.model
andengine
Metrics: AS_PATH
AS_PATH is the number of Autonomous Systems along the packet's travel.
Metrics: ORIGIN
ORIGIN marks the source of the prefix
: Where has the prefix
been learned?
- it has been introduced to the BGP protocol with a
network
-commandset protocol bgp 343 address-family ipv4-unicast network 2.0.0.0/24
- The prefix attribute of ORIGIN is marked as
I
forInternal
- 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
forExternal
- 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
?
forIncomplete
Metrics: NEXT_HOP
NEXT_HOP
is an variable that contains the next BGP router.
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).
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.
Problems with BGP
-
Internet coughed a little bit: because 512K limit of routing table on some devices, autumn of 2014
-
Google Internet Traffic wasn’t Hijacked, but it was out of control, November 2018
-
How Verizon and a BGP Optimizer Knocked Large Parts of the Internet Offline, June 2019
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
Continue to the Exercises
E17 Welcome to the Internet, I'll be your guide
Back to the 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.