BGP

From Network Security Wiki


Introduction

Protocol Specifications
Protocol Type Path vector
Peering mechanism Manual peering between neighbors
eBGP AD 20
iBGP AD 200
Rights Open standard
Supported protocols IPv4, IPv6
Transport TCP/179
Update mode Only triggered
Timers Hello (60 sec)
Authentication None, MD5
Specifications RFC 4271


  • Usage applications
BGP is needed for redundancy of servers. BGP is not used for providing redundancy to users for internet access.
Customer connected to multiple Internet service providers (ISPs).
Service provider networks (Transit autonomous system).
Network cores of very large enterprise networks (distribution or core layer)as a backup or redundant routing protocol due to its stability.
  • Customer's Network will become a Transit Autonomous system if ISP traffic passes through your AS.
  • Session Establishment facts
BGP neighbors are not discovered.
They must be configured manually on both sides of the connection.
TCP port 179 is used. 
Only one session remains if both connection attempts succeed.
  • Without tuning behaves like RIP, considers AS as a Hop.
  • BGP is an advanced Path Vector Protocol and has following advantages:
Reliable updates (using TCP)
Triggered updates only
Rich metric (Path attributes)
Scalable to massive networks
Updates are Incremental and Triggered
  • Only 1 instance of BGP can be run on a router. It will show an error if running it with another AS Number.


BGP States

Idle           Neighbor is not responding
Active         Attempting to connect
Connect        TCP session established
OpenSent       Open message sent
OpenConfirm    Response received
Established    Adjacency established

BGP Messages

Open            Starts the Session
Update          Network Reachability Exchanges
Keepalive       Sent every 60 seconds
Notification    Always indicate something is wrong

BGP Tables

Neighbor Table        Configured/Connected BGP Peers
BGP Table             List of All BGP Routes(Can be Huge)
Routing Table         List of Best Routes

BGP Route selection criteria[1]

Mnemonics: N-WLLA-OMNI

Full Internet BGP routing table is more than 300K routes and a BGP router can receive multiple copies of that routing table from multiple providers, router has to compare those multiple entries and select only the best route for the routing table. It uses the BGP Best Path Selection Algorithm to do this. Routes installed by different BGP instances are compared by the general algorithm, i.e. route distances are compared and the route with lower distance is preferred.

Attribute Which is better
Next Hop reachable Route cannot be used if next hop is unreachable
Weight Bigger
Local Preference Bigger
Locally Injected Locally injected is better than iBGP/eBGP learned
AS Path Length Smaller
Origin Prefer IGP over EGP & EGP over Unknown
MED Smaller
Neighbor Type Prefer eBGP over iBGP
IGP Metric to Next Hop Smaller

Filter with Route Maps

  • Route maps are very powerful filtering tools, they can be used to accomplish the following tasks:
Filter on IP prefixes coming from a specific autonomous system
Filter on other BGP attributes
Modify BGP attributes
  • Match clauses in the BGP route map can be based on the following:
IP network numbers and subnet masks (prefix list or access list)
Route originator
Next hop
Origin code
Tag value attached to an Interior Gateway Protocol (IGP) route
Autonomous system path
Community
IGP route type
  • With a route map, the following can be set:
Origin
Next hop
Weight
Community
Local preference
MED
  • You can apply a route map on incoming or outgoing routing information for a neighbor.
  • The routing information must be permitted by the route map to be accepted.
  • If the route map has no statement explicitly permitting a route, the route is implicitly denied and dropped.
  • The syntax required is as follows:
Router(config-router)# neighbor ip-address route-map name in|out

What is a Route Reflector?[2]

        This section is under construction.

Synchronization

        This section is under construction.

Auto-Summarization

        This section is under construction.


Next Hop Processing

        This section is under construction.

MED vs Local Preference

Multi-Exit Discriminator
  • The MED is an optional attribute that comes in handy when there are multiple entrance paths to an AS.
  • The remote AS sets MED values to tell the other AS which path to use.
  • The MED is passed between the two autonomous systems, but the value is not passed to any other ASs.
  • The path with the lowest MED is the preferred path.
  • This attribute is only used to influence entry INTO the AS.
Local Preference
  • LOCAL_PREF is a well-known attribute that is also used when multiple paths between autonomous systems exist.
  • The LOCAL_PREF attribute is just that… local and exclusive to the AS.
  • Routers within the local AS are told what path to use to exit that AS.
  • The local preference value is passed only among iBGP peers, and this value never leaves the local AS.


iBGP vs eBGP

        This section is under construction.
1. EBGP is peering between two different AS, whereas IBGP is between same AS (Autonomous System).
2. Routes learned from eBGP peer will be advertised to other peers (BGP or IBGP); however, routes learned from IBGP peer will not be advertised to other IBGP peers.
3. By default, EBGP peers are set with TTL = 1, which means neighbors are assumed to be directly connected, which is not in the case of IBGP. We can change this behavior for EBGP by using command “neighbor x.x.x.x ebgp-multihop <TTL>”. Multihop is the term used in EBGP only.
4. EBGP routes have administrative distance of 20, whereas IBGP has 200.
5. Next hop remains unchanged when route is advertised to IBGP peer; however, it is changed when it is advertised to EBGP peer by default.
This default behavior of IBGP can be changed by the command “neighbor x.x.x.x next-hop-self”; this changes the next hop, while advertising, as a local route.
For IBGP peers dont need to be directly connected.
Next-hop IP will not be changed when adv prefixes to another IBGP.
Also, if you check the way BGP choose the best route to put in the routing table you'll see that EBGP is preferred.
And BGP can run in two modes that each has a very different behavior when advertising routing information.
EBGP: external BGP runs between routers in different ASs.
IBGP: internal BGP runs between routers in the same AS.
EBGP: routes received from an EBGP peer can be advertised to EBGP and IBGP peers.
IBGP: routes received from an IBGP peer cannot be advertised to another IBGP peer but can be advertised to an EBGP peer.


Troubleshooting and Monitoring

Command Description
show ip bgp neighbor ip-address Displays detailed neighbor information
show ip bgp Displays all the routes in the BGP table
show ip bgp ip-prefix [mask subnet-mask] Displays detailed information about all paths for a single prefix
debug ip tcp transactions Displays all TCP transactions
debug ip bgp events Displays significant BGP events
debug ip bgp keepalives Debugs BGP keepalive packets
debug ip bgp updates Displays all incoming or outgoing BGP updates
debug ip bgp updates acl Displays all incoming and sent updates matching an ACL
debug up bgp ip-address update [acl] Displays all BGP updates received from or sent to a specific neighbor


  • BGP route not installing, route reasons:
Synchronisation is enabled & route unknown by IGP(run 'no sync' command)
Next Hop inaccessible (for iBGP run 'neighbor 1.1.1.1 next-hop-self' command)
AS path includes the local AS
Rejection by inbound policy
  • Blackhole formed in iGBP if all internal routers not running BGP, Solution:
Redistribute into IGP: Full Routing Table redistribution not possible, Redistribute partial routing table/specific routes.
Add a direct WAN Link between BGP Peers
Run iBGP between Peers
?? Configure Route Reflector


R&S Quick Notes

When using Communities, don’t forget “neighbor send-community”
Know your attributes and the direction which applied, when to used what.
“aggregate address” needs a more specific prefix in the BGP table for aggregate to be advertised.
Synchronization issue has 3 solutions, 1- Load BGP on all transit routers, 2- GRE tunnel, 3- Redistribution BGP>IGP.
“no bgp nexthop trigger” – Disables next-hop tracking between scanner intervals.
“no bgp fast-ext-fallover” – Force the router to wait for the dead-timer to expire, before generating notification messages , when a connected peer goes down.
“neighbor fall-over” – Will check neighbor connenctivity between scanner intervals, aka BGP Fast Peering.
Only the Holdtime is sent in update-msg. Two neighbors will use the lowest holdtime and then calculate the keepalive from that.
Know your Regular Expressions
Know the difference between Peer-Groups and Peer-Templates

LAB

BGP Basic Lab

Objectives

  • Configure iBGP & eBGP
  • Establish Neighbors using Loopback interfaces
  • Using Update-Source command
  • Using eBGP-Multihop command
  • Advertising Networks into BGP
  • Turn off BGP Auto-Summary
  • BGP Synchronization
  • BGP Handling of Next Hop Address


References

  1. www.accenture.com
  2. www.accenture.com



{{#widget:DISQUS |id=networkm |uniqid=BGP |url=https://aman.awiki.org/wiki/BGP }}