BGP Basics
Explicit peer connection
BGP peers must explicitly indicate their desire of establishing a BGP session with each other A TCP connection must be first established Usually, an IGP or static-route configuration is required to support the establishment of some types of BGP sessions
BGP Basics
Continue
BGP finite-state machine Idle
Initiate a TCP connection
Connect
Timer expires/ Initiate a TCP connection
Active
Send updates or keep-alive messages Received keep-alive message
Open sent
Receive open message/ send keep alive message
Established
Open received
3
BGP Basics
Incremental update and route withdrawal
Reduce the traffic load Use keep-alive message to maintain the BGP session
BGP Basics
2. Internal and External BGP sessions
A BGP session between two ASes is called external BGP A BGP session between two BGP routers in the same AS is called internal BGP
BGP Basics
Routes learned from an EBGP peer are distributed to other IBGP and EBGP peers Routes learned from an IBGP peer will only be distributed to other EBGP peers
EBGP(net1)
BGP Basics
The IBGP characteristic is used to prevent routing loop inside the AS.
net1 <20 10> Without the IBGP route distribution restriction, routing loop may result
AS 20
net1 <10>
net1 <30 40 20 10> AS Path attribute can only prevent routing loop among ASes
BGP Basics
3. Recursive Routing Table Lookup
BGP route advertisement only specifies the BGP next hop, which is not necessary the physical next hop
To use the BGP entry in the routing table, recursive lookup is required to determine the physical next hop
Routing Table
net1, next_hop=200.10.1.1
Addr.
Next Hop
Interface Fa0/1
Recursive lookup
BGP Basics
Next-Hop attribute manipulation
N.H. attribute indicates the downstream router of the route By default, the Next-Hop attribute will not changed in IBGP route distribution
Net 1 Next-hop=R3
Net 1 Next-hop=R3
Net 1 Next-hop=R2
BGP Basics
The route is only valid if the next hop is accessible the routing table must provide the information on how to reach the next hop
net1 N.H. = R1
If R3 does not know how to reach R1, then the route will not be adopted and advertised net1 N.H.=R3
net1 N.H. = R1
10
BGP Basics
It is necessary sometimes to change the Next-Hop value in the IBGP update
11
BGP Basics
4. Synchronization
The physical path of the IBGP route may have to go through the intermediate router(s)
The route is not feasible if the intermediate router(s) has(have) not learned the route
Addr N.H.
R2
net2
DC
Net 3
No entry of Net 1
R3
BGP Basics
Synchronization rule:
A route learned from an IBGP peer is feasible only if it is also learned through IGP IBGP route The route will not be applied to the route selection process Route is not feasible
Is route also learned by IGP? The route must be in the Routing table Yes Route is feasible
No
The route will be applied to the route selection process and may be advertised to the peer(s)
13
BGP Basics
To abide to the synchronization rule, external BGP routes must be redistributed into IGP
Addr N.H. Net2 DC Net1 R1
R2
Net 2 redistribution
IGP (Net1)
Net 3
IBGP(net1) EBGP
(Net1)
R1
R3
EBGP(Net1)
CN8815 Network Architecture
14
BGP Basics
Synchronization problems:
BGP may carry thousands of routes Redistribution may cause the IGP overload
In practice, BGP synchronization is disabled Configuration: router bgp AS-number no synchronization Other methods are used to deal with the synchronization issues
15
BGP Basics
Solutions:
Full-mesh IBGP all the routers in the AS are IBGP-connected with each other Route reflector Confederation
16
BGP Basics
5. Advertisement of Routes from Non-BGP Source
Redistribution from IGP to BGP
Less control on route distribution Loss of AS-Path information Route filter at the BGP router is required AS 10 redistribution EBGP(net1) <20> AS20 Net 1 EBGP(net1) <10>
CN8815 Network Architecture 17
IGP(net1)
BGP Basics
Semi-dynamic routing update
Use network command to specify which networks will be advertised by BGP Configuration:
18
BGP Basics
Example
AS 10 145.10.1.0/24 145.10.2.0/24 down 145.10.3.0/24 145.10.4.0/24
IGP
router BGP 10 network 145.10.1.0 mask 255.255.255.0 network 145.10.2.0 mask 255.255.255.0 network 145.10.3.0 mask 255.255.255.0
19
BGP Basics
Static routing updates
Combining static route and network commands
ip route ip-prefix mask {next-hop-address | interface} router bgp AS-number network ip-prefix [mask mask]
AS 10 145.10.1.0/24 145.10.2.0/24 145.10.3.0/24 ip route 150.10.0.0 255.255.0.0 null0 router BGP 10 network 145.10.0.0 network 150.10.0.0
CN8815 Network Architecture
IGP
BGP Basics
6. BGP Update Packets
Update packet format
Unfeasible Route Length Withdrawn Routes (variable) Total Path Attribute Length Length Prefix Path Attributes (variable) Network Layer Reachability Information (NLRI)
21
BGP Basics
Example:
update packet
155.10.2.1
22
BGP Basics
Continue update packet content: 3 200.10.1.0/24 200.10.2.0/24 200.10.3.0/24 Path attribute length AS-PATH = <AS100, AS200> Next hop = 155.10.2.1 145.10.0.0/16 150.10.0.0/16
23
BGP Basics
Path attribute format
Type code Length Value
0 1-byte length field 1 2-byte length field 0 complete 1 - partial 0 non-transitive 1 transitive 0 - well-known 1 - optional
24
BGP Basics
Path attributes
Well-know mandatory must be in the BGP update packets Well-know discretionary recognized by all BGP implementations, but it may not be in BGP update packets Optional may not be recognized by a BGP implementation non-transitive
25
BGP Basics
Example
AS-Path: <200 100> Next Hop: R3 Mult_Exit_Disc new attribute Not recognized
26
BGP Basics
7. BGP Attributes
Types Attribute Name 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Origin AS_Path Next-Hop Multi_Exit_Disc Local_Preference Atomic_Aggregate Aggregator Community Originator_ID Cluster_List Category/Type Code Well-known mandatory Well-known mandatory Well-known mandatory Optional nontransitive Well-known discretionary Well-known discretionary Optional transitive Optional transitive Optional nontransitive Optional nontransitive
27
BGP Basics
Attribute functions
Origin, AS_PATH, Local_preference, and Multi_Exit_Disc
used for route selection process AS_PATH is also used for routing loop detection
Atomic_Aggregate, and Aggregator
used for routing loop detection within AS when the routereflector is configured
Others
BGP Basics
7. BGP Routing Process
BGP process structure
29
BGP Basics
Route Selection Process
Route selection is based on the various attribute values In general, an attribute more specific to local policies has a higher precedence
This allows the administration of a domain to control its own policies Weight configured and used within a BGP router Local_Preference configured and used within one AS AS_PATH length derived based on the AS_PATH attribute Origin indicates where the route originated MED attribute assigned by the other AS Weight > Local_Preference > AS_PATH length > Origin > MED
30
BGP Basics
BGP route decision process (From Cisco document)
1. 2. 3. 4. 5. 6. 7. 8. 9. If the next hop is inaccessible, the route is ignored Prefer the path with the largest weight (weight is a Cisco proprietary parameter) Prefer the route with the largest local preference value Prefer the route with the shortest AS_PATH Prefer the route with the lowest origin type Prefer the route with the lowest MED value if the routes were received from the same AS Prefer EBGP paths to IBGP paths Prefer the route that can be reached via the closest IGP neighbor. (Follow the shortest path to the BGP Next-Hop Prefer the route coming from the BGP router with the lowest Router ID
31
BGP Basics
EBGP > IBGP
BGP updates usually contain routes from other ASes Preferring EBGP route means traffic can be directly sent out to the peer AS without traversing the local AS
IBGP(net1) EBGP(net1)
EBGP(net1)
net1
net1
32
BGP Basics
Prefer closest IGP neighbor Prefer lowest peer ID
net1
Preferred 145.10.1.1 Preferred 145.10.12.1
net1
33
BGP Basics
Example
170.1.0.0/16 <1,3> 145.10.0.0/16 <1> 193.168.2.0/24 <5,1,2>, LP=200 145.10.0.0/16 <5,1> 150.10.0.0/16 <5> 140.10.0.0/16 <.>
AS 6
34
BGP Basics
Continue
Incoming policy configured at R1
Route to 130.15.2.0/24 is not advertised to other ASes When route to 145.10.0.0/16 is advertised to other ASes Artificially increasing the AS_PATH length by 2 Advertise 140.10.0.0/16 to other ASes
35
BGP Basics
Continue BGP Table
Route Next-Hop 0.0.0.0 R4 R2 R2 R5 R3 R5 R5 Default: 100
Origin i i i i i i i i
> * 140.10.0.0/16
Best route
>
Feasible route
If R1 knows the route to R5, then the iBGP routes are feasible
Default: 0
36
BGP Basics
Continue
Outgoing routing updates
140.10.0.0/16, NH=R1, <6> 193.168.2.0/24, NH=R1, <6,5,1,2> 150.10.0.0/16, NH=R1, <6,5>
AS 6 140.10.0.0/16, NH=R1, <6> 193.168.2.0/24, NH=R1, <6,5,1,2> 145.10.0.0/16, NH=R1, <6,6,6,1> 150.10.0.0/16, NH=R1, <6,5>
37
BGP Basics
9. Multiprotocol Extensions for BGP
The NLRI attribute in BGP is only defined for IPv4 address
To support multiprotocol environment, new attributes are needed to carry NLRI information of other address families
The MP_REACH_NLRI attribute contains the next hop information Two new attributes
MP_REACH_NLRI; MP_UNREACH_NLRI
38
BGP Basics
MP_REACH_NLRI format
Address Family Identifier (AFI) Subsequent AFI Length of Next Hop Address Next Hop Address Number of SNAPs SNAPs NLRI
Second-layer addresses
39
BGP Basics
MP_UNREACH_NLRI format
AFI SAFI Withdrawn Routes
IPv6 example
R1
R2
R3
NLRI= ::06:1234:5678 NH=R2s non-link IPv6 address
NLRI= ::06:1234:5678 NH=R1s non-link IPv6 address R1s link IPv6 address SNPA=R1s second layer address
40