Basics of Routing: Link State
Basics of Routing: Link State
Basics of Routing
Link State
• OSPF/IS-IS
• Relies on state of links
Distance Vector
• EIGRP/RIP
• Advertises Vector and Distance
Path Vector
• BGP
• Share information between
autonomous systems
• Path vector protocols rely on
analysis of the path to reach the
destination and determine if it is
loop free
•complete topology map
What is BGP?
Def routes + more specific routes: Enables you to manipulate the exit path for
specific routes using BGP so that traffic takes a shorter path to networks in each
ISP.
All routes from all providers: Requires high bandwidth and router resources.
Path selection for all external routes can be controlled via BGP and policy
routing tools.
-network commands
-redistribution
Multihoming Cases:
Characteristics:
Routers running BGP are termed BGP speakers. Neighbors are peers; must be
statically assigned.
Runs on top of TCP (Port 179) - used for reliability.
Path-vector: Fancy distance vector based on hop count between autonomous
systems.
ASN #s 1-64550 – Assigned to you by IANA. BGP Version 4 is the only EGP.
Updates are incremental and triggered; only sends what has changed. Slow to
converge. Periodic keepalives. BGP leverages keepalive messages to maintain
neighbor relationships.
When an update about a network leaves an AS, that AS’s number is prepended
to the list of ASs that have handled that update. When an AS receives an update,
it examines the AS list. If it finds its own ASN in that list, the update is
discarded. Loop prevention.
Routing Information Base (RIB) A list of networks known by BGP along with
their paths and attributes “sh ip bgp”
Uses many attributes; each route has its own set. BGP goes through from top to
bottom to find attribute that isn’t a tie.
Default route: 0.0.0.0 route out one path, incoming traffic has two routes in; if
one ISP fails, routes will converge towards the alternate ISP.
Partial updates - Useful in a situation where two ISPs serve two areas
differently. One route out can prefer an ISP who is better in one area, while the
other route out prefers the other ISP. There are still backup routes out both ways
as a failover.
Full updates - Router will receive entire BGP table from each connected ISP
and decide best path for each network.
Packet types: 4
Open: Starts the session. Hello. After a neighbor is configured, BGP sends open
to establish peering, includes ASN RID, and hold time.
Keepalive: Resets hold down timer. 60 seconds by default.
Update: Most common. Network reachability exchanges, up/down, path
attributes.
Notification: Something bad has happened; error on conn, missed too many
packets, wrong AS; close session.
To add a neighbor:
router) neighbor [IP] remote-as [AS #]
Can’t add same router twice if it has 2 separate connections/IPs leading back:
Use loopbacks.
If there are redundant links to the ISP, use loopbacks with static routes to the
neighbor loopbacks and physical IPs.
When doing either of the above, you must also change the source IP for the
neighbors to form:
router) neighbor [IP] update-source [Loopback#]
BGP assumes that external neighbors are directly connected and that they are
peering with the IP of a directly connected interface of their neighbor. If not,
you must tell BGP to look more than one hop away for its neighbor. This breaks
the above. To resolve, use multihop:
router) neighbor [IP] eBGP-multihop [# of hops to neighbor]
The network command tells BGP what networks to advertise, regardless of
interface. Hostmasks must be identical if advertising a subnet. Networks do not
have to be connected; they just have to be in the routing table:
router) network [IP] (mask) [hostmask]
Synchronization - Do not use or advertise a route learned via iBGP until the
same route has been learned via the internal routing protocol. If other internal
routers don’t know the route, the end network will be unreachable. Off by
default in newer releases.
Next-Hop Processing:
eBGP - Change next hop address on advertised routes.
iBPG - Do not change next hop address on advertised routes. Meant for
networks that share the same segment so routes don’t have an extra hop. iBGP
routers must have a route to the network connecting their AS to the edge router.
eBGP routes (iBGP neighbors) won’t have the correct next hop address without
setting:
router) network [IP] next-hop-self
BGP Confederation
#################
Reduces full mesh IBGP requirement by splitting AS into smaller Sub-Ases
-> inside Sub-AS full mesh or RR requirement remains
-> between sub-AS acts like EBGP
Devices outside the confederation do not know about the internal structure
-> Sub-AS numbers are stripped from advertisements to “true” EBGP peers
Typically uses ASNs in private range (64512-65635)
Attributes:
Attributes are ways you can tag incoming/outgoing BGP routes that make its
metric.
The BGP update message lists a set of PAs, plus any prefixes/lengths that use
those PAs. It can also list withdrawn routes in the same update message as
newly advertised routes. It can also list multiple prefixes in a single update
message.
Well-known mandatory: Must be recognized by all BGP routers & present in all
updates: AS Path, origin, next hop.
Attributes: Work top down. Tie usually broken in 1-4. Need to know 1-5!
N WLLA OMNI: Next hop > Weight > Local_Pref > Local source > AS-Path >
Origin > MED > Neighbor Type > IPG Metric
Autonomous system path (AS-Path - Mandatory)
Next hop address (Mandatory)
Origin (Mandatory)
Local preference (Discretionary)
Atomic aggregate (Discretionary)
Aggregator (Optional)
Multi-Exit Discriminator (MED/Metric) (Optional)
sh ip bgp summary:
BGP States:-
Idle
Connect
Open sent
Open confirm
Active
Established
Idle: No peering; router is looking for neighbor. “Idle (admin)” means neighbor
has been shutdown.
Some of the reasons why a router does not progress from the Idle state are:
Active State:
If the router was unable to establish a successful TCP session, then it ends
up in the Active state.
If there is an error it is because one of the fields in the Open message doesn’t
match between the peers, e.g. BGP version mismatch, MD5 password
mismatch, the peering router expects a different My AS. The router will then
send a Notification message to the peer indicating why the error occurred.
If there is no error, a Keepalive message is sent, various timers are set and the
state is changed to Open Confirm.
Open Confirm: Router has received a reply to the open message.
Established: Routers have a BGP peering session – this is the desired state.
If there is any error in the Update message then a Notification message is sent to
the peer, and BGP transitions back to the Idle state.
If a timer expires before a Keepalive message is received, or if an error
condition occurs, the router transitions back to the Idle state.
Show commands:
sh ip bgp rib-failure: Displays routes not put into routing table and why.
sh ip bgp summary: Displays the memory used by BGP databases, activity
stats, and neighbors
(received/routes/advertised):
Lets you monitor routes received/advertised.
❖ Local preference - Set under router BGP. 100 is default. Tells iBGP peers
which path to select for traffic leaving the AS.
router) bgp default local-preference [#]
Can also use a route-map to set per network.
router) neighbor [IP] route-map (NAME) [in/out]
BGP Filtering
###########
Route Filtering Tools
•Prefix lists:
•Used for prefix-based filtering or matching of routes.
•Can be used to match on the prefix, route source, or next-hop address.
Some More:
The relationship between route maps and prefix lists (and access lists) has
two fundamental properties:
Similarly, when working with route maps for the same purpose, the
following rules apply:
#####################
What is the difference between the hard reset and soft reset in BGP?
In case of hard reset the local router brings down the neighborship, brings down the underlying
TCP connection and all the BGP table entries learned from that neighbor are removed. #clear ip
bgp * command is used for hard reset.
In case of a soft reset, the router does not bring down the BGP neighborship or the underlying
TCP connection. However, the local router resends outgoing Updates and reprocesses incoming
Updates adjusting the BGP table based on the current configuration. #clear ip bgp * soft command
is used for soft reset.
BGP Convergence
################
Defaults
keepalive: 60 seconds
holdtime: 180 seconds
Hello and keepalive timers
-lowest timers are negotiated during peering establishment
-timers bgp
-neighbor timers
Update timers
.neighbor advertisement-interval
-bgp nexthop {trigger {delay seconds | enable} | route-map map-name}
-bgp scan-time
-bgp update-delay
Route dampening
Route dampening is the feature that reduces propagation of flapping routes in
the Internet. Route flapping occurs when IP routes are removed and put back in
a routing table. This can be because of physical layer failure, routing protocol
failure, or router node failure, and so on. Route dampening applies to EBGP
neighbors only.
First, the routes to be “observed” must be identified using an access-list or
prefix-list:
Router(config)# ip prefix-list MYLIST seq 10 permit 10.1.0.0/16
Router(config)# ip prefix-list MYLIST seq 20 permit 10.2.0.0/16
Next, dampening values must be configured using a route-map:
Router(config)# route-map MYMAP permit 10
Router(config-route-map)# match ip address prefix-list MYLIST
Router(config-route-map)# set dampening 15 750 2000 60
#Show ip bgp dampened paths
BGP Backdoor:-
EBGP has an admin distance of 20,howevwe you may want to choose routes
from your IGP(OSPF,EIGRP etc) over eBGP.You can do this with the
Backdoor command. For example, if you want the network 172.0.0.0/8 to be
advertised via BGP with and AD of 200:
Router BGP 7500
Network 172.0.0.0 mask 255.0.0.0 backdoor.
ORF works by the router transmitting its inbound filters to its neighbor, which
the neighboring router then applies outbound.
Configuration
router bgp 65001
neighbor peer-group IBGP
neighbor IBGP remote-as 65001
neighbor IBGP update-source loo0
bgp listen range 10.0.0.0/8 peer-group IBGP
The failed routes are withdrawn from the BGP table, the RIB, and FIB.
Update message are sent to the neighbors to withdraw the failed routes.
The best path algorithm is run to choose new best paths.
The new best paths are installed in the BGP table, RIB, and FIB.
The new best paths are announced via Update messages to the BGP neighbors.
Therefore, BGP convergence primarily depends on the speed by which the router
runs the best-path algorithm to find an alternative path to the destination. This, in
turn, depends on the size of the BGP table, or in other words, the number of
prefixes in the table.
This is how it works: In cases where more than one path to a prefix exists, when
BGP runs the best path algorithm, instead of finding the best path only, it finds
the best path and the second-best path and installs both in the BGP, RIB, and
CEF tables. When a failure in the primary path is detected, the backup/alternative
path immediately replaces the primary path in all three tables without the need to
do any BGP table walks or running the best-path algorithm first. This is
conceptually similar to the EIGRP Feasible Successor function. The dependency
on the size of the BGP table is eliminated, and BGP convergence is dramatically
enhanced. As you can see, BGP PIC is a purely data plane feature that operates at
the RIB and CEF level.
The BGP PIC feature is enabled using the command bgp additional-paths install
under the BGP address-family configuration mode.
The BGP conditional route injection feature allows the creation of more-specific prefixes when an aggregate
exists. These prefixes are injected in to local BGP table to provide more specific routing information in local
AS than aggregated route. This can be used to optimize the exit points of the local AS.
The BGP conditional advertisement feature provides additional control of route advertisement, depending on
the existence of other prefixes in the BGP table. This can be useful for a multihomed AS that wants to only
use one ISP peering (expensive) if the other one of down.
Comments
For conditional route injection: you must use Prefix-lists, NOT ACLs.
We can only originate more specific subnets of an existing aggregate prefix.
BGP Security
These are the most common BGP threats:
•BGP DoS
•*BGP route spoofing can be prevented using filtering based on prefixes and
AS path.
BGP Security
•IOS/IOS-XE
TTL Security:
•With IOS/IOS-XE the hops value is how many hops away the
neighbor can be (the acceptable TTL would be from 255 to 255
minus the number of hops)
•With IOS-XR, only 255 is an acceptable TTL value
•HMAC-MD5 is used.
•Cisco IOS-XR supports HMAC-SHA1 with key chains.
•L3 tunneling transport can also be used within IP networks to transport VPN traffic across another
IPv4 network
Border Gateway Protocol (BGP) policy accounting measures and classifies IP traffic that is
sent to, or received from, different peers.
IOS/IOS-XE
BGP Flowspec
•Flowspecspecifies procedures for the distribution of flow specification rules via BGP and defines
procedure to encode flow specification rules as Border Gateway Protocol Network Layer
Reachability Information (BGP NLRI) which can be used in any application.
•The BGP flow specification (flowspec) feature allows you to rapidly deploy and propagate filtering
and policing functionality among a large number of BGP peer routers to mitigate the effects of a
distributed denial-of-service (DDoS) attack over your network.
•In Cisco IOS 15.5(S) release, BGP flow specification is supported only on a BGP flow specification
client and route reflector.
BGP Troubleshooting.
Problem: BGP peer is not getting establish between routers.
Cause :
1) Peer ip address is not reachable .
2) port 179 is blocked by firewall or access-list.
3) BGP configuration is not correct like wrong peer address local-as or remote-
as, wrong AS number, wrong authentication/MD5 password or wrong update-
source loopback.
4) static route is missing for loopback address end to end.
Solution:
a) Ensure BGP local and remote AS configuration is correct.
b) MD5 authentication password is correct on both sides without spaces.
c) Verify update-source loopbak and ebgp-multihop.
d) port 179 is allowed in the path boh end via access-list. Ensure firwall is not
blocking.
Cause:
1. Keep alive mismatch
2. MTU mismatch.
3. Hellos are stuck in OutQ behind update packets.
4. Remote router rebooting continually (typical with a 3-5 minute BGP peering
cycle time)
5. Remote router BGP process unstable, restarting
6.Traffic Shaping & Rate Limiting parameters
7. MTU incorrectly set on links, PMTU discovery disabled on router.
8. Output drops on the interface or congestion on the queue.
9. High CPU on the router or CPU spike on router.
Solution :
a) Make sure you have same keep alive on both routes.
b) Make sure you have same MTU and can ping MTU 1500 with df bit set.
c) If MTU mismatch can not be fixed, can use path-mtu discovery to overcome.
Tip: BGP update packets are packed to the size of the MTU – keepalives and
BGP OPEN packets are not packed to the size of the MTU ⇒ Path MTU
problem
Problem : Router is not installing routes in RIB and ignoring.
Cause :
1. Paths that are marked as not synchronized in the show ip bgp longer-
prefixes output
2. Paths for which the NEXT_HOP is inaccessible
3. Paths from an external BGP (eBGP) neighbor if the local autonomous system
(AS) appears in the AS_PATH
4. If you enabled bgp enforce-first-as and the UPDATE does not contain the
AS of the neighbor as the first AS number in the AS_SEQUENCE
5. Paths that are marked as (received-only) in the show ip bgp longer-
prefixes output
Solution:
a) Be sure that there is an Interior Gateway Protocol (IGP) route to the
NEXT_HOP that is associated with the path.
Preliminary Checks
Verify Configuration
Peering IP Address
AS Number
MD5 Authentication (Optional)
ebgp-multihop hop-count (eBGP only)
Verify Reachability
ping remote-ip source source-ip
If reachability issues found:
Use traceroute to verify where the trace is dropping
BGP will not use the default route to reach a neighbor!
Or
disable-connected-check
• For eBGP peers, BGP takes two special precautions
• Uses TTL of 1
• Verifies if NEXTHOP is on a directly attached network
• For eBGP peers more than 1 hop away, a larger TTL must be used • This
automatically disables the NEXTHOP connected check • For eBGP peers 1 hop
away, use neighbor disable-connected-check • Ideal for peering direct neighbors
through their loopbacks;
Or
Some ACLs blocking on Firewall
• Verify any Firewall / ACLs in the path for TCP port 179
• If using ASA as a firewall, make sure BGP Pass-Through is configured
• ASA / PIX offsets TCP SeqNos with a random number for every TCP session
• Causes MD5 authentication to fail
• ASA strips off TCP option 19
Or
Problem With the TCP Process:
Or
Or
Or
Stable BGP peers going into Idle State
BGP Peering has been up for months, but all of a sudden, BGP session goes
down and never comes back up
Or
Notifications – Hold Time Expired
### #########################################
Stale Routes
Symptoms and Possible Causes
Symptoms
• Stale Entry to BGP Peer
• Traffic Black-Hole
• Outage
Possible Causes
How to Troubleshoot?
• On IOS, it is difficult to get to the root cause after the problem has occurred
• Enable conditional debugs and wait for the issue to happen again
• Reproduce the problem in lab environment (hard but not impossible)
• On IOS XR, use show bgp trace and BGP debugs to understand if the
advertisement has been sent/received
• Debug
• On NX-OS, use show bgp internal event-history { events | errors } to figure
out if the prefix has been received / advertised
##################################
Route Churn
Define “High”
• Know what normal CPU utilization is for the router in question
• Is the CPU spiking due to “BGP Scanner” or is it constant?
Some Scenarios: -
Happy Reading…
Follow me for more updates: https://www.linkedin.com/in/rakesh-sa-b2b664167
Thanks
Rakesh