BGP Basics
Peering
A C
AS 100
B D
AS 101
BGP speakers are called peers when they form BGP TCP Sessions
AS 102
BGP Messages
Open : These messages are used when establishing BGP peers. Keepalive : These messages are sent periodically to ensure that connections are still active or established. Update : Any change that occurs, such as loss of network results in an update message. availability,
Notification : These messages are used only to notify BGP peers of receiving errors.
Collection of networks with same routing policy Single routing protocol Usually under single ownership, trust and administrative control
Autonomous system
An AS is a set of routers under one or more administrations that presents a common routing policy to the internet . Inside AS networks, interior routing protocols called IGP are used to discover the connectivity among a set of IP subnets. IGP are well known protocols such as RIP,IGRP,OSPF,EIGRP. There are 65,535 available AS numbers that can be assigned, from 1 to 65,535.(16-Bit integers). Of these 65,535 64,512 to 65,535 are reserved for private use. IANA(Internet Assigned Numbers Authority) is the organization that assigns BGP autonomous system numbers. The IANA allows the American Registry for Internet Number(ARIN) to assign ASN for North America, South America the Caribbean, and Africa. RIPE-NIC(Reseaux IP Eurpeennes for Europe) and the Asia Pacific-NIC (APNIC) assigns for ASIA RFC-1771
AS continued
Stub As :
A stub AS is a single-homed network with only one entry and exit point, the stub network does not need to learn internet routes. Because the the Local service provider or Internet service provider is the next hop and all the traffic is sent to one exit interface to the provider.
Transit AS : A transit AS is an AS through which data from one AS must travel to get to another AS. Example (Local service provider) A non-transit AS is an AS that does not pass through to another AS.
Ibgp vs Ebgp
Internal BGP and External BGP are inter-domain routing protocols. Ibgp is a connection between two BGP speakers in the same AS,Ebgp is a connection between two BGP speakers in different AS. Before any BGP route information can be exchanged between two routers, a TCP connection has to be established . The TCP connection is made by a three-way handshake using a SYN,ACK,SYN sequence. Once a TCP connection has been established, route information can be exchanged.
AS 100
B
AS 101
Topology independent Each iBGP speaker must peer with every other iBGP speaker in the AS
BGP peer within the same AS Not required to be directly connected iBGP speakers need to be fully meshed
they originate connected networks
BGP States
Idle : Before a session between two or more BGP routers has been initiated, the endpoints are considered to be in the Idle State. Connection State : As soon as one endpoint tries to open a TCP session,the endpoints is considered to be in the Connection state. Active State : When there is problem in establishing a connection between two endpoints, the router trying to initiate the session will transition to the active state, where it will periodically try to establish a TCP connection. Open Sent : Once the TCP connection has been established,BGP sends messages back and forth in a specific format. The first message is an identification message from the endpoints. As soon as this message is sent, the router is in the Open sent state. Open confirm state : When the router receives a reply to the identification message,it come in the Open confirm state.
BGP States contEstablished state : This is the final stage of BGP peer negotiation during which both peers exchange their BGP table Endpoints typically stay in the Established state until there is a loss of the session or an error. If this occurs, then the connection returns to the Idle state and all the information that the BGP endpoints have learned from neighboring endpoint will be purged from the routing table.
AS 200
170.10.0.0/16
AS 100
180.10.0.0/16
140.10.0.0/16 170.10.0.0/16
AS 300
140.10.0.0/16
AS 500
180.10.0.0/16 170.10.0.0/16 140.10.0.0/16 300 200 100 300 200 300
180.10.0.0/16 is not announced to AS100 as AS500 sees that it is originated from AS100, and that AS100 is the neighbouring AS loop detection in action
Learns multiple paths via internal and external BGP speakers Picks the best path and installs in the forwarding table Policies applied by influencing the best path selection
2. Router must receive the TCP connection request a source address that a router finds in a bgp neighbor Command 3. ASN should be same which is configured in remote as command
4. MD5 authentication should be passed
BGP Attributes
BGP ATTRIBUTES
BGP has a number of complex attributes used to determine a path to a remote network. These attributes allow greater flexibility and enable a complex routing decision to ensure that the path to a remote network is the best possible path.
AS_Path : This attribute describes the sequence of AS that the packet has travaersed.
Origin : This attribute is mandatory and defines the origin of the path and can have three different values
IGP IGP indicates the remote path originated from within the AS EGP- EGP means learned through an External Gateway Protocol
Incomplete Incomplete means the BGP route was discovered using redistribution or static routes. Next Hop : This attribute describes the next hop address taken to a remote path, typically the BGP peer.
Local Preference : This attribute indicates to the AS the preferred path to exit the AS. A higher local preference is always preferred. MED : Multi exit discriminator BGP peers in other AS which path to take to a remoter network . A lower MED is always preferred. Weight : This is Cisco proprietary is used in local router selection. Weight is not sent to other BGP peers, and a higher weight value is always preferred. (0-294967295) By Default weight is 32768 for the path which is originate from router .
AS-Path
Sequence of ASes a route has traversed
Loop detection
AS 200
170.10.0.0/16
AS 100
180.10.0.0/16
Apply policy
AS 300 AS 400
150.10.0.0/16
AS 500
Next Hop
150.10.1.1 150.10.1.2
AS 200
150.10.0.0/16
AS 300
AS 100
160.10.0.0/16
Next hop to reach a network Usually a local network is the next hop in eBGP session
20
Local Preference
AS 100
160.10.0.0/16
AS 200
D
500 800
AS 300
E
A
160.10.0.0/16 > 160.10.0.0/16 500 800
AS 400
C
Local Preference
Local to an AS
local preference set to 100 when heard from neighbouring AS
AS 200
C
192.68.1.0/24 2000 192.68.1.0/24 1000
B
192.68.1.0/24
AS 201
Community
BGP attribute
Used to group destinations Represented as two 16bit integers Each destination could be member of multiple communities
Community
ISP 2
X
200.10.0.0/16 200.10.0.0/16 300:9
160.10.0.0/16 170.10.0.0/16
300:1 300:1
AS 400
ISP 1
C
AS 300
160.10.0.0/16 300:1 170.10.0.0/16 300:1
AS 100
AS 200
170.10.0.0/16
160.10.0.0/16
no auto-summary
no synchronization
Bgp log-neighbor-changes
How to implement new policy without causing flaps and route churning?
How to reduce the overhead on the routers?
Soft Reconfiguration
Problem:
Hard BGP peer clear required after every policy change because the router does not store prefixes that are denied by a filter
Hard BGP peer clearing consumes CPU and affects connectivity for all networks
Solution:
Soft-reconfiguration
Soft Reconfiguration
New policy is activated without tearing down and restarting the peering session Per-neighbour basis
router bgp 100 neighbor 1.1.1.1 remote-as 101 neighbor 1.1.1.1 soft-reconfiguration in
x.x.x.x
* ASN
IP address of a peer
all peers all peers in an AS
external
Peer Groups
Without peer groups iBGP neighbours receive same update Large iBGP mesh slow to build Router CPU wasted on repeat calculations
router bgp 100 neighbor ibgp-peer peer-group neighbor ibgp-peer remote-as 100 <<<<<<< <<<<<<<
neighbor ibgp-peer update-source loopback 1 neighbor 1.1.1.1 peer-group ibgp-peer neighbor 2.2.2.2 peer-group ibgp-peer
Route flap
Going up and down of path or change in attribute Ripples through the entire Internet Wastes CPU
Requirements
Fast convergence for normal route changes
Operation
Operation
4000 Suppress limit 3000
Penalty
2000 Reuse limit 1000
0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Time
Network Announced
Network Re-announced
Configuration
router bgp 100 bgp dampening [<half-life> <reuse-value> <suppresspenalty> <maximum suppress time>]
Configuration
Examples -
bgp dampening 15 500 2500 30
reuse-limit of 500 means maximum possible penalty is 2000 no prefixes suppressed as penalty cannot exceed suppress-limit
Examples -
bgp dampening 15 750 3000 45
reuse-limit of 750 means maximum possible penalty is 6000 suppress limit is easily reached
Two solutions
Route reflector simpler to deploy and run Confederation more complex, corner case benefits
AS 100
B C
Route Reflector
Clients
Reflector receives path from clients and non-clients Selects best path If best path is from client, reflect to other clients and non-clients Non-meshed clients
B A C
Reflectors
AS 100
Originator_ID attribute
Carries the RID of the originator of the route in the local AS (created by the RR)
Cluster_list attribute
The local cluster-id is added when the update is sent by the RR
Easy migration
Multiple levels of route reflectors
Multi- Homing
Benefits :
Thanks
Amit / Ajay