BGP Basics: Webinar Course

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

BGP Basics

WEBINAR COURSE

1 v1.0
Overview

• What is BGP?
• BGP Features
• Path Vector Routing Protocol
• BGP General Operation
• BGP Terminology
• Inserting Prefixes into BGP

2 v1.0
What is BGP?

Interior Gateway Protocol Exterior Gateway Protocol

OSPF, IS-IS … BGP

• Border Gateway Protocol


• A Routing Protocol used to exchange routing information between
different networks
o Exterior gateway protocol

• Described in RFC4271
o RFC4276 gives an implementation report on BGP
o RFC4277 describes operational experiences using BGP

3 v1.0
BGP Features

• Path Vector Protocol


• Incremental Updates
• Many options for policy enforcement
• Widely used for Internet backbone
• Autonomous systems
• Classless Inter Domain Routing (CIDR)

4 v1.0
What is an Autonomous System?

• Group of Internet Protocol-based networks with the same routing policy


o Usually under single ownership, trust or administrative control

• The AS is used both in the exchange of exterior routing information


(between neighboring ASes) and as an identifier of the AS itself
• The Autonomous System is the cornerstone of BGP
o It is used to uniquely identify networks with a common routing policy

5 v1.0
Autonomous System Number (ASN)

• Globally unique identifiers for IP networks


• ASN uniquely identifies each network on the Internet, allocated to each
Autonomous System (AS) for use in BGP routing
• 2-byte only AS number range : 0 – 65535
• 4-byte only AS number range : 65,536 - 4,294,967,295

6 v1.0
What is Path Vector Routing Protocol

• A path vector routing protocol is used to span different autonomous


systems
• It defines a route as a collection of a number of AS that it passes
through from source AS to destination AS, i.e.
{65001 65002 65003 65007}
• This list of AS numbers is called AS path and used to avoid routing loop
• AS path is also used to select path to destination

7 v1.0
Path Vector Routing Protocol

172.16.0.0/16
172.16.0.0/16
64503
64501 64503

AS64500 AS64501

172.16.0.0/16

AS64503
AS64502 172.16.0.0/16

8 v1.0
Definitions

• Transit
§ carrying traffic across a network, usually for a fee

• Peering
§ exchanging routing information and traffic

9 v1.0
Peering and Transit example

A and B can peer, provider A


but need transit
Backbone
arrangements with IXP-West Provider D
IXP-East

D to get packets
provider B
to/from C
provider C

10 v1.0
BGP General Operation

• Learns multiple paths via internal and external BGP speakers


• Picks the best path and installs it in the routing table (RIB)
• Best path is sent to external BGP neighbours
• Policies are applied by influencing the best path selection

11 v1.0
BGP Attributes

• Well-known attributes – must be supported by every BGP implementation


o Mandatory attributes – must be included with every route entry. If one attribute is missing,
it will result in an error message
o Ex: ORIGIN, AS_PATH, NEXT_HOP
o Discretionary attributes – every BGP router must recognize, but they don’t have to be
present with every route entry
o Ex. ATOMIC_AGGREGATE, LOCAL_PREF
• Optional attributes – not necessarily supported by all BGP implementations. It can be
either transitive or non-transitive.
o COMMUNITY, AGGREGATOR, MULTI_EXIT_DISC

12 v1.0
Internal & External BGP

• eBGP used to:


o Exchange networks/routes between ASes
- Aggregates and sub-aggregates
o Implement routing policies
- To manipulate inbound and outbound traffic

• iBGP is used to:


o Carry customer networks/prefixes
o Internet routes (some or all) across the AS backbone

13 v1.0
BGP Message Types

• Open:
o After a TCP connection has been established between two BGP routers, an Open
message is sent
- Once the open message is confirmed (keepalive), the BGP session is established –
become BGP peers/neighbors!
o Contains:
- Sender’s ASN
- BGP version
- BGP router ID
- Hold-time (3 x keepalive interval)

14 v1.0
BGP Message Types

• Keepalive:
o Exchanged initially to acknowledge Open messages
o Exchanged periodically (60 secs) to maintain BGP session
- Dataless packet

• Update:
o BGP peers exchange network information through Update messages
- One update for each path!
o Contains:
- Withdrawn routes – no more reachable
- Path attributes – attributes for this path to reach the destinations specified by the NLRI
- NLRI – list of networks reachable through this path <prefix, length>

15 v1.0
BGP Message Types

• Notification:
o Sent when an error condition is detected
o The BGP session is torn down immediately!
o Contains:
- Error code
- Error sub-code
- Data related to error

16 v1.0
BGP Neighbor States

• A BGP router goes through six different states


o Idle
- The router is looking for a route to its neighbor
o Connect
- BGP router moves from Idle to Connect state if it has found a route to its neighbor, and
has started the TCP handshake
- If the TCP session successful, sends an Open message (and transitions to OpenSent)
- Else, move to Active state

17 v1.0
BGP Neighbor States

o Active
- A router transitions to Active state if the initial TCP connection was not successful (in
Connect state)
- Restarts the TCP connection
- If successful, sends an Open message
- Else, falls back to Idle state
• OpenSent
- An Open message has been sent to the neighbour
- Waiting for Open message from neighbour
- If it receives an Open message and there are no mismatches (version, source addr same
as TCP addr, ASN, router-ID, TTL, md5), sends KeepAlive, moves to OpenConfirm
- Else (if mismatches/errors), sent Notification and falls back to Idle
18 v1.0
BGP Neighbor States

• OpenConfirm
- waiting for the initial KeepAlive
- If received, transitions to Established
- If holdtimer expires or Notification received, moves to Idle
• Established
- The BGP neighbor relationship (session) is established!
- Routing information can now be exchanged
- If holdtimer expires/error, moves back to Idle

19 v1.0
BGP State Machine

Idle

Connect

Active

OpenSent

OpenConfirm

Established

20 v1.0
BGP/IGP model used in ISP networks

• BGP is used internally (iBGP) and externally (eBGP)


• iBGP – used to carry some/all Internet prefixes across ISP backbone and
ISP’s customer prefixes
• eBGP – used to eBGP eBGP eBGP

exchange prefixes
with other ASes iBGP iBGP iBGP iBGP
and implement IGP IGP IGP IGP

routing policy
AS65001 AS65002 AS65003 AS65004

21 v1.0
eBGP Neighbor Relationship

• eBGP neighbors/peers
o BGP session established between routers in different ASes
o Generally directly connected!
- Session established using directly connected interface IP
- Peering address must match the TCP session!
o Else, we need a static route to reach the neighbor and change the eBGP TTL
value (default 1)

router bgp 65001


neighbor 172.16.12.2 remote-as 65000
172.16.12.0/30
!
AS AS address-family ipv4
65001 .1
65000 neighbor 172.16.12.2 activate
!

22 v1.0
iBGP Neighbor Relationship

• iBGP neighbors/peers
o BGP session established between routers within the same AS
o Does not need to be directly connected
- IGP ensure reachability (TCP connection)
o Generally using loopback addresses

AS 65001 router bgp 65001


neighbor 10.10.10.2 remote-as 65001
!

23 v1.0
iBGP Operation

• iBGP routers must:


o Originate directly connected routes
• Carry routes learned from outside the AS to all routers within the AS
o Fully-meshed instead of redistributing!
o Advertise routes learned from eBGP peers to all iBGP peers!

• To prevent routing loops (in a fully-meshed network)


o iBGP routers are not allowed to advertise iBGP learned routes to other iBGP peers!

24 v1.0
iBGP full-mesh

Example configuration on R1 and R2


R1:
AS R4 router bgp 65400
65400 neighbor 10.10.10.2 remote-as 65400
neighbor 10.10.10.3 remote-as 65400
neighbor 10.10.10.4 remote-as 65400
R1 R3 !

R2:
R2 router bgp 65400
neighbor 10.10.10.1 remote-as 65400
neighbor 10.10.10.3 remote-as 65400
neighbor 10.10.10.4 remote-as 65400
!

25 v1.0
Sourcing iBGP from Loopback

• By default, routers use the exit-interface address as the source address


for locally originated packets (updates)
o If the BGP TCP session was established using any other interface (loopbacks)
addresses, the source address for BGP updates must match!

• In Cisco IOS, the update-source loopback command achieves this

router bgp 65400


neighbor 10.10.10.1 remote-as 65400
neighbor 10.10.10.1 update-source loopback 0
!

26 v1.0
Insert Prefixes into BGP

Examples in IOS Function


network 192.168.1.0 mask Add the specific route 192.168.1.0/24
255.255.255.0 into BGP routing table.
redistribute OSPF redistribute all the routes in OSPF routing
table into BGP routing table.

27 v1.0
Inserting prefixes into BGP – network command

• Configuration Example

router bgp 65400


network 10.10.32.0 mask 255.255.254.0
ip route 10.10.32.0 255.255.254.0

• A matching route must exist in the routing table before the network is
announced
• Forces origin to be “IGP”

28 v1.0
Configuring Aggregation – Network Command

• Configuration Example 10.10.1.0 255.255.255.0


10.10.2.0 255.255.255.0
10.10.3.0 255.255.255.0
router bgp 64500 …
network 10.10.0.0 mask 255.255.0.0
ip route 10.10.0.0 255.255.0.0 null0

• A matching route must exist in the routing table before the network is
announced
• Easiest and best way of generating an aggregate

29 v1.0
APNIC Helpdesk Chat

30 v1.0
Acknowledgements

Some materials used in this course were originated from the Cisco ISP/IXP
Workshop Programme developed by Philip Smith & Barry Greene.

All images and icons used on these slides, that include an APNIC
logo, are licensed or owned by APNIC.

31 v1.0

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy