eROU03 BGP Basics PDF
eROU03 BGP Basics PDF
eROU03 BGP Basics PDF
BGP Basics
Contact: training@apnic.net
eROU03_v1.0
Overview
• What is BGP?
• BGP Features
• Path Vector Routing Protocol
• Peering and Transit
• BGP General Operation
• BGP Terminology
• BGP Attributes
• Inserting Prefixes into BGP
What is BGP?
• Border Gateway Protocol
• A Routing Protocol used to exchange routing information
between different networks
– Exterior gateway protocol
• Described in RFC4271
– RFC4276 gives an implementation report on BGP
– RFC4277 describes operational experiences using BGP
BGP Features
• Path Vector Protocol
• Incremental Updates
• Many options for policy enforcement
• Classless Inter Domain Routing (CIDR)
• Widely used for Internet backbone
• Autonomous systems
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
• This list of ASes are called AS path and used to avoid
routing loop
• AS path is also used to select path to destination
• RFC 1322
– “A path vector protocol defines a route as a pairing between a
destination and the attributes of the path to that destination.”
Path Vector Protocol
AS11268
AS6337
AS7018
AS500
AS6461
AS600
Definitions
provider A
Backbone IXP-East
IXP-West Provider D
provider B
provider C
• A and B can peer, but need transit
arrangements with D to get packets to/
from C
What Is An Autonomous System?
• Group of Internet Protocol-based networks with the same
routing policy
– Usually under single ownership, trust or administrative control
A C
AS 100 AS 101
B D
• Runs over TCP – port 179
• Path vector protocol E
• Incremental updates
AS 102
• “Internal” & “External” BGP
BGP Terminology
• Neighbor
– Any two routers that have formed a TCP connection to exchange
BGP routing information are called peers or neighbors
• iBGP
– iBGP refers to the BGP neighbor relationship within the same AS.
– The neighbors do not have to be directly connected.
• eBGP
– When BGP neighbor relationship are formed between two peers
belongs to different AS are called eBGP.
– EBGP neighbors by default need to be directly connected.
BGP Attributes
• Well-known attributes – must be supported by every BGP
implementation
• Mandatory attributes – must be included with every route entry. If one
attribute is missing, it will result in an error message
– Ex: ORIGIN, AS_PATH, NEXT_HOP, LOCAL_PREF
• Discretionary attributes – every BGP router must recognize, but they
don’t have to be present with every route entry
– Ex. ATOMIC_AGGREGATE
AS 100
B
A
C
D
• Topology independent
• Each iBGP speaker must peer with every other iBGP
speaker in the AS
Peering between Loopback Interfaces
AS 100
C
A
B
• Peer with loop-back interface
– Loop-back interface does not go down – ever!
discarded
BGP in
in
process accepted
everything
best paths
BGP out forwarding
out table
process
External BGP Peering (eBGP)
AS 100 AS 101
C
B
• Between BGP speakers in different AS
• Should be directly connected
• Never run an IGP between eBGP peers
Configuring BGP in Cisco IOS
• This command enables BGP in Cisco IOS:
router bgp 100
interface loopback 0
ip address 105.3.7.1 255.255.255.255
!
router bgp 100 Local ASN
network 100.100.1.0
neighbor 105.3.7.2 remote-as 100 Local ASN
neighbor 105.3.7.2 update-source loopback0
neighbor 105.3.7.3 remote-as 100
neighbor 105.3.7.3 update-source loopback0
!
ip address of Router
B loopback interface
Configuring Internal BGP
ip address on
loopback interface
Router B in AS100
interface loopback 0
ip address 105.3.7.2 255.255.255.255
!
router bgp 100 Local ASN
network 100.100.1.0
neighbor 105.3.7.1 remote-as 100 Local ASN
neighbor 105.3.7.1 update-source loopback0
neighbor 105.3.7.3 remote-as 100
neighbor 105.3.7.3 update-source loopback0
!
ip address of Router
A loopback interface
Inserting prefixes into BGP –
network command
• Configuration Example
– router bgp 100
– network 102.10.32.0 mask 255.255.254.0
– ip route 102.10.32.0 255.255.254.0 serial0