Sunday, November 26, 2006

BGP study notes

non client BGP device types must be fully meshed with each other, clients dont need to be fully meshed because they are connected to a route reflector. a BGP speaker is not a BGP device type.

BGP sends incremental updates that can contain only the network change

since the remote as No. is different than the As No. specified when BGP was enabled,this will be an eBGP neighbour

full mesh n(n-1)/2

since the remote as No. is different than the As No. specified when BGP was enabled,this will be an eBGP neighbour

An eBGP router will not set the NEXT_HOP attrib to itself when a route is orginated by an iBGF router in the same AS and on the same subnet as itself and the remote eBGP router

Negotion and disconnect are not valid BGP states. connect and active are valid BGP states

An eBGP router will not sent the NEXT_HOP attrb to itself when a route is orginated by an iBGP router in the same AS and on the same subnet as itself and the remote eBGP router.

Client, non-client, and route reflector are all valid BGP device types

AS: The private AS number are 64512 through 65535, the public AS no. are 1 through 64511

An origin code of incomplete is represented in the BGP routing table with the "?" symbole

If your autonomous system will be passing traffic through it from another autonomous system to a third autonomous system, it is very important that your autonomous system be consistent about these routes that it advertises. For example, if your BGP were to advertise a route before all routers in your network had learned about the route through your IGP, your autonomous system could receive traffic that some routers cannot yet route. To prevent this from happening, BGP must wait until the IGP has propagated routing information across your autonomous system. This causes BGP to be synchronized with the IGP. Synchronization is enabled by default. Only if all routers in the transit path in the AS are running BGP it is safe to turn synchronization off

IGBP routes are propagated to all IBGP peers and only the IBGP peers

The show ip bgp summary command displays the status of all BGP connections. Neighbors with corresponding AS value will be listed, both interior and external.

BGP)Private AS range = 64512 --> 65535 (RFC 1930)(1024 AS-es)

BGP Attributes =
WO MD TN == WellKnown/Optional,Mandatory/Discretionary,Transitive/Non-Transitive
WM=WellKnown Mandatory Required and Recognized by all BGP implementations.
WD = WellKnown Discretionary == Not present in all BGP update messages, if present all routers will act on the information contained.
OT = Optional Transitive == A Rtr might not recognize this attr., so if it does not it marks it as partial and passes it on.
ON = Optional NonTransitive == These are NOT transmitted to BGP Peers. If a router does not recognize them it ignores them.
WM == As-Path, Next-Hop, Origin
WD ==LocalPref, AtomicAggregate
OT == Can be partial; Aggregator, Community
ON == MED, OriginatorID
Cisco Defined = Weight
As-path = a,b,c (a is first hop next as to go to, b is next and so on)
Origin = WM, Lower Preferred == IGPMED = ON (Optional NonTransitive)=Lower Preferred, def = 0. To influence external AS-es on selecting appropriate entry ino the AS. MED is not passed beyond neighbor AS.
LocalPref = WD, Higher preferred, def = 100. Local to AS and not sent to EBGP peers.
Community = OT, ability to tag routes that have something in common.
Weight = Cisco Only = 32768 = def for locally originated, others=0, higher preferred. Used for local to this router routing policy only.
Route Selection preference ==> highest Weight, highest Local pref, shortest as-path, lowest origin code, lowest med.
Atomic Aggregate Attribute: WD, indicates to neighbor AS that originator has aggregated routes.
Aggregator = OT = BGP Router ID and AS # of router that performed the route aggregation.


BGP Rules:
(Learn these 3 rules, the test has these mingled and to understand the fine differences will be great advantage)
Synchronization Rule: A BGP router should not use or advertise to an external (EBGP) neighbor a router learned by IBGP, unless that route is local or is learnt from IGP. Only if all routers in the transit path in the AS are running BGP is it safe to turn synchronization off. Use no synchronization (router config) command to turn synch off, this command will aloow a rtr to use and advert to ebgp neighbor routes learnt by ibgp before learning them from IGP.
Split Horizon Rule: Causes the need for RouteReflectors: Routes Learnt from ibgp WILL not be advertised to ibgp peers.
Next Hop Rule : For IBGP: next hop advertised by EBGP should be carried into IBGP. For EBGP, the next hop is the ip address of the neighbor that sent the update.


-BGP RouterID == same as OSPF RouterID, highest I/F address OR Loopback Address is used.

-BGP Operation:
BGP Message Types == Open, Keepalive, Update, Notification (for errors/special conditions, closes connection immediately).
BGP Peers will exchange full BGP routing tables. Then incremental.
Open Message == Version, my AS, hold time, BGP Id, Optional Params (Authentication).
Update message has info on one path only == Withdrawn Routes, Path Attributes, NLRI (Network Layer Reachability Info) list of prefixes reachable via this path.
BGP Neighbor states == Idle, Connect, Active, OpenSent, OpenConfirm, Established.
In Established === update, keepalive, and notification messages are sent.
Keepalive == 19 bytes/60 seconds, Other messages == 19~4096 bytes. Def Hold time = 180 s.


-Route Selection :
Do not consider unsynched internal paths.
next hop not reachable – do not use.
highest weight
highest localpref
Orig by local router
shortest as-path
lowest origin code IGP < EGP < incomplete
Lowest MED
EBGP over IBGP.
if only internal paths remain, prefer lowest cost next hop.
Else Ebgp select oldest route
Lowest neighbor bgpid.
lowest neighbor ip address.
BGP only chooses a single path per destination.

BGP Commands:
router(config)# router bgp
router(config-router)# neighbor {} remote-as
router(config-router)# neighbor {} shutdown
router(config-router)# no neighbor {} shutdown
router (config-router)#neighbor update-source loopback
in the above we are indicating that update source on this router is the loopback
router (config-router)#neighbor {} ebgp-multihop []
(use the above command in case the ebgp peers are not directly connected) (ttl in above defaults to 255)
router (config-router)#network [mask ]
the list of network commands must include all networks in your AS that you want to advertise. Note the above network/mask must match exactly an entry in the routing table.
router (config-router)#neighbor {} next-hop-self
allows an ibgp peer to receive EBGP paths with next hop set to the IBGP peer.
router (config-router)#no synchronization
disables synchronization.

-BGP route summarization:
router (config-router)#aggregate-address [summary-only] [as-set]
the networks being aggregated must be in the BGP table.

-Resetting bgp:
Clear ip bgp {* } [soft [in out]

-Route Reflectors: BGP split horizon: routes learnt via IBGP are never propagated to other IBGP peers.

-RRs : modify BGP SH by allowing RRs to propagate to IBGP clients routes learned by IBGP, except those learned from the client itself.

-RR Operation:
Update from Client Peer: send update to all non-client peers and to client peers (except originator).
Update from Non-Client IBGP Peer: send update to all client peers.
Update from EBGP peer: send update to all non-client peers and to client peers.
router (config-router)#neighbor route-reflector-client

-prefix lists:
better than ACLs as they allow incremental changes and deletion of individual lines.
Router(config)#ip prefix-list [seq ] {deny permit} / [ge ] [le ]
router (config-router)#neighbor { } prefix-list {in out}

To set weight attribute:
router (config-router)#neighbor { } weight
-To set default local preference value to something other than 100
router (config-router)#bgp default local-preference

Troubleshooting BGP:
Show ip bgp ===BGP Table Version,local router ID, Network, Next Hop, Metric, LocPrf, Weight, Path
Show ip bgp === Paths, number of paths, Advertised to peers,
Show ip bgp summary === BGP table version, main routing table version, # of network entries, # of paths, Neighbor, version, AS, messages received, messages sent, Table version, input Q, output Q, Up/Down for, State/Prefixes received.
Show ip bgp neighbors === neighbor ip, remote-as, type of link, bgp version, neighbor router id, BGP state, table version, up for, hold time, keepalive interval, received message count, number of notifications, number queued, sent messages, sent notification count, sent queue depth, # of prefixes advertised, last reset and reason for reset.
The above command is also used to show RR clients.
Show ip prefix-list [detail summary]


-(BGP) The configuration of the multiple connections to the ISPs can be classified depending on the routes that are provided to the AS from the ISPs. Three common ways of the configuring the connections are:
All ISPs pass only default routes to the AS.
All ISPs pass default routes, and selected specific routes (for example, from customers with who the AS exchanges a lot of traffic) to the AS.
All ISPs pass all routes to the AS (A).

BGP attributes:
Well-known mandatory attributes:AS-path/Next-hop/Origin
Well-known discretionary attributes:Local preference/Atomic aggregate/
Optional transitive attributes:Aggregator/Communities
Optional non-transitive attribute:Multi-Exit-Discriminator (MED)

AS Numbers:
This autonomous system number is a 16-bit number, with a range of 1 to 65535, 64512 - 65535 are reserved for private use.

The command “clear ip bgp *”:clears all the entries from the BGP routing table and reset BGP sessions. This command is used after every configuration change to ensure that the change is activated and that peer routers are informed.

The command “clear ip bgp
” ex: clear ip bgp 172.31.0.0 removes the specified network from the BGP table.

The assignable BGP autonomous system numbers are from 1 to 65,535 (I.e. 65,535 in total). Autonomous system numbers are of 16 bit length. There are 2 ^ 16 = 65536 -1 possible ASNs. ASN of all 0s is not assigned. Out of this, the Internet Assigned Numbers Authority (IANA) has reserved the following block of AS numbers for private use: 64512 through 65535.

-External BGP (eBGP) is used to establish session and exchange route information between two or more autonomous systems. Internal BGP (iBGP) is used by routers that belong to the same Autonomous System (AS).

-Routers running BGP in an AS use network Policy to choose the best path. Metrics are not used in BGP. Remember that Internet is made of autonomous systems (AS) that are connected together based on Policies specific to each AS. Also, AS numbers (ASN) are assigned by AINA and are unique over the Internet. In an internet (not big I) the ASNs can be assigned by the corporation itself that is implementing internet.

-The following are the four possible message types in a BGP header:
Type 1: OPEN message - This is the first message sent after TCP session is established.
Type 2: UPDATE message - An UPDATE message contains a new route or a route to be withdrawn or both. Note that only one new route can be advertised with one UPDATE message.
Type 3: NOTIFICATION message - this message is sent if an error occurs during a BGP session. This message can be used to troubleshoot the problem.
Type 4: KEEPALIVE message - KEEPALIVE message is used to confirm that the connection between the neighboring routers is still active.

-Command to set the router RouterA to autonomous system number 1340:
The correct syntax for the command is:
RouterA(config)#router bgp 1340
where 1340 is the AS number which can have a value between 1 and 65535 in an internetwork.

-Port number 179 is used to establish a session between two routers running BGP.

-Well-Known mandatory attributes must appear in all BGP update messages. The well-known mandatory messages are:
AS_PATH: BGP messages carry the sequence of AS numbers indicating the complete path a message has traversed.
NEXT_HOP: This attribute indicates the IP address of the next-hop destination router.
ORIGIN: This attribute tells the receiving BGP router, the BGP type of the original source of the NLRI information.

-Any two routers that have formed a TCP connection in order to exchange BGP routing information are called peers, or neighbors. BGP peers initially exchange their full BGP routing tables. After this exchange, routing table changes are sent as incremental updates. BGP keeps a version number of the BGP table, which should be the same for all of its BGP peers. The version number changes whenever BGP updates the table, likely due to routing information changes. Keep alive packets are sent to ensure that the connection is alive between the BGP peers.

-show ip bgp neighbors
This is a very useful command in troubleshooting BGP connections. When the connection is established, the peer/ neighbor router exchanges BGP information. If a TCP connection (BGP session) is not established, a BGP router can not exchange any BGP routing information with the adjacent router.

-Few recommended scenarios, where you use BGP are:
Connect two or more ISPs
The traffic flow out of your network need to be managed to suit the requirements of your organization.The traffic need to be sent through one AS to get to another AS.

-The weight attribute in BGP has a range from 0 to 65535. This attribute can be set using "neighbor" command. The default value is 32,768.

-Various debug commands useful in troubleshooting bgp are:
Debug ip bgp events: Displays all bgp events as they occur.
Debug ip bgp dampening: Displays bgp dampening events as they occur.
Debug ip bgp keepalives: Displays all events related to bgp keepalive packets.
Debug ip bgp updates: Displays information on all bgp update packets.

-Prefix lists (filtering) are available only in Cisco IOS versions 12.0 and later.

-Characteristics of Prefix lists:
These are used for filtering BGP routing updates, so that certain path policy is applied.
Prefix lists put less load on the processor compared to Access lists.
Prefix lists are easier to configure and implement.
Prefix lists are read one line at a time.
There is an implicit deny all at the bottom of the Prefix list. However, if the prefix list is empty, there will be an implicit permit any.
The statement with the smallest sequence numbers is read first.
Sequence values are generated in increments of 5. The first sequence value generated in a prefix list would be 5, then 10, then 15, and so on.

-The following are a few examples of how a prefix list can be used (while configuring BGP policies to filter route updates):
To deny the default route 0.0.0.0/0:
ip prefix-list mylist1 deny 0.0.0.0/0
or
To permit the prefix 20.0.0.0/8:
ip prefix-list mylist1 permit 20.0.0.0/8

-A stub AS is a single-homed network with only one entry and exit point. This type of AS can be connected to the external world through the use of a statically configured route.
-Transit AS: Data from one AS need to reach a remote AS, then it has to travel through intermediate AS. The AS or Autonomous Systems which carry the data from one AS to another AS is (are) called Transit AS (es).

-eBGP: External BGP is used between two or more Autonomous Systems.
iBGP: Internal BGP is used within an AS.

-In BGP, to disable automatic summarization of subnet routes into network level routes use the command:”no auto-summary”
To enable automatic summarization of subnet routes into network level routes use the command:
“auto-summary”
Note that by default, auto-summary is enabled.

-BGP is an exterior routing protocol, whereas RIP, IGRP, and OSPF are all Interior routing protocols (IRP). Interior routing protocols run inside a company's network and can't run on the Internet. The Internet consists of numerous autonomous systems (AS) which are connected by Exterior Routing protocols like BGP.

-BGP commands:Suppose, RouterA and RouterB are running iBGP. The correct syntax for establishing neighbor relationship is:
router bgp 100
neighbor 175.23.1.2 remote-as 100
iBGP routers don't have to be directly connected, as long as there is some IGP running, that allows the two neighbors to reach one another. If two routers belong to the same AS, then they run iBGP, whereas, if they belong to different ASs, they need to run eBGP.

-The output is that of "show ip bgp summary". It contains the following among other details:
BGP router identifier: Router identifier specified by the bgp router-id command, loop back address, or lowest IP address.
BGP table version: Internal version number of BGP database.
Main routing table version: Last version of BGP database that was injected into main routing table.
Neighbor: IP address of a neighbor.
V: BGP version number spoken to that neighbor.
AS: Autonomous system.

-To specify the networks to be advertised by the Border Gateway Protocol (BGP) use the network command.
To remove an entry, use the no network form of this command.
“network network-number [mask network-mask]”
To remove,
“no network network-number [mask network-mask]”

-To distribute Border Gateway Protocol (BGP) neighbor information as specified in a prefix list, use the neighbor prefix-list command in address family or router configuration mode.
The following router configuration mode example applies the prefix list named mylist1 to outgoing advertisements from the neighbor 192.10.0.0:
!
router bgp 100
network 120.101.0.0
neighbor 192.10.0.0 prefix-list mylist1 out

-To distribute Border Gateway Protocol (BGP) neighbor information as specified in an access list, use the neighbor distribute-list command in address family or router configuration mode.

-Route maps are used with BGP to control and modify routing information and to define the conditions by which routes are redistributed between Autonomous Systems. The format of a route map is as follows:
“route-map map-name [[permit deny] [sequence-number]]”
The map-name is a name that identifies the route map, and the sequence number indicates the position that an instance of the route map is to have in relation to other instances of the same route map.

-Some of the terms used commonly with route reflectors in BGP are:
Route reflector: It is a router that is configured to advertise the routes that are learned from iBGP neighbors.
Client: A router that shares information with the router configured as route reflector.
Cluster: The set of all routers configured as route reflectors and clients.
Cluster ID: If there are one route reflector in a cluster, then, cluster ID is used to identify the route reflectors uniquely in the specified cluster.
-Do not apply both a neighbor distribute-list and a neighbor prefix-list command to a neighbor in any given direction (inbound or outbound) on a BGP router. These two commands are mutually exclusive, and only one command (neighbor prefix-list or neighbor distribute-list) can be applied to each inbound or outbound direction.

-BGP peer groups:
A BGP peer group significantly reduces the overhead of configuring policies on every individual BGP neighbor in an AS. When a peer group is created, policies are assigned to the name of the peer group itself and not to the individual neighbors.
Route maps, distribution lists, and filter lists usually set update policies.
Members of the peer group can be configured to override the configuration options for incoming updates, but not to the outgoing updates.

-The command (BGP)
neighbor peer-group
is used to add a neighbor to a peer-group.
The complete commands to add a neighbor are:
!
RouterA(config)#router bgp 100
RouterA(config-router)#neighbor mygroup peer-group
RouterA(config-router)#neighbor 1.1.1.1 peer-group mygroup

-When a route reflector in a BGP AS receives an update, it takes the following actions, depending on the type of peer that sent the update:
If the update is from a non-client peer : It sends the update to all clients in the cluster.
If the update is from a client peer: It sends the update to all nonclient peers and to all client peers.
If the update is from eBGP peer: It sends the update to all nonclient peers and to all client peers.

-The following are well known communities in BGP:
Internet: All routers belong to this community by default. Advertises the route to internet community.
No-export: This indicates not to advertise a route to eBGP
No-advertise: This indicates not to advertise a router to peers.
The community attribute in BGP can contain a value in the range 0 to 4294967200.

-The correct syntax to configure a router as a BGP route reflector is:
RouterA(config-router)#neighbor route-reflector-client
Here, it is:
RouterA(config-router)#neighbor route-reflector-client 144.44.44.1
The above command will configure RouterA as a route reflector with the specified neighbor 144.44.44.1 as the route reflector's client.

-Methods available for filtering BGP updates:
Distribute lists: To restrict the routing information can be filtered based on routing updates to/from a particular neighbor. An access list that is applied to updates to/from a neighbor serves as a filter.
AS_Path filtering: Here, you specify an access list on both incoming and outgoing updates based on the value of the AS_path attribute.
Route Map Filtering: Here, the "neighbor route-map" command is used to apply a route map to incoming and outgoing routes.
Community Filtering: You can filter by setting the community attribute on router updates.

-External and summary routes are not injected into a totally stubby area in an OSPF network. The advantages of totally stubby areas are reduced routing tables, faster convergence, and stability.

-To enable the synchronization between Border Gateway Protocol (BGP) and Interior Gateway Protocol (IGP) system, synchronization command is used. To advertise a network route without waiting for the IGP, use the no synchronization command. By default, synchronization is enabled.

-The following router configuration mode is an example that enables a router to advertise a network route without waiting for the IGP:
!
router bgp 160
no synchronization

-Show ip bgp neighbors is a command most often used to see neighbor details, which include the following:
AS number,Uptime,BGP messages received / sent,Hold time, Keepalive intervals,Remote router ID .

-BGP AS-PATH length:
You can increase the AS-PATH length by adding dummy AS numbers.
The route map configuration command:
set as-path prepend 100
causes a router to prepend 100 once to the value of the AS_path attribute before it sends updates to the specified neighbor.
If you want to prepend 100 twice, use the command
set as-path prepend 100 100
This will increase the AS-PATH length in the updates being sent to the neighbor and hence the path selection.

-BGP Distribute lists are created using IP standard access lists and IP extended access lists. The range of numbers for standard access list is 1 to 99 and extended access list is 100 to 199. Therefore, the allowed range of numbers is 1 to 199.

-The three multi-homing classifications are:
Basic: Here the ISP will offer only the default route to the AS. This kind of connection is least processor intensive and recommended for simple networks with only one ISP connection.
Medium: This uses default routes and BGP. Internal AS can select the best ISP to use depending on the preferences.
Full: Full multi-homing uses only BGP. Here the routes are learned using the AS_PATH attribute information to make routing decisions.

-BGP can load balance up to six links. You can have up to six links to ISPs and use those links for Internet traffic. This arrangement provides redundancy as well as load balancing.

In BGP, the term Multihoming is used when one AS is connected to two or more ASP. The purpose of multihoming is:
To improve the reliability of connectivity to the Internet, that even if one connection fails, the other connection will be available.
To share the traffic load, resulting in the performance improvement.

-While selecting best route in BGP, the order of preferences are as below:
Weight - If multiple routes exist, the route with the highest weight is preferred.
Local preference - If multiple routes have the same weight, the route with the highest local preference is preferred.
Local router - If multiple routes have same local preference, prefer the route originated by the local router.
AS path - If multiple routes have the same local preference, prefer the route with shortest AS path.

-BGP:peers(nei) not only a phy link,but TCP connection established.
only one instance of BGP can be configured on the router at a single time,A BGP router with synchronization enabled will not advertise iBGP-learned routes to other eBGP peers if it is not able to validate those routes in its IGP.
if you have all your routers in the AS running BGP and you are not running any IGP, the router has no way of knowing that, and your router will be waiting forever for an IGP update about a certain route before sending it to external peers.

-BGP is an AS-by-AS routing proto,not a router-by-router routing proto,in BGP,next hop doesnt mean the next router,it means the IP addr to reach the next AS,so iBGP wont change the NEXT-HOP addr,unless [same subnet]

-peer-group: useful when many nei have the same outbound policies, members can have a diff inbound policy

-debug ip bgp events
Idle:router is searching routing table to see if a route exists to reach the nei -> check for an IGP prob, is the nei announcing the route?
Connect:Router found the route n has completed three-way TCP handshake
Active:the router has sent out an open packet n is waiting for a response
Established:[sh ip bgp summary] -> the state is blank or has a number ( number: how many routes have been learnt)

-sh ip bgp:sh all bgp routes: origin code: i (IGP), status code: i (internal)

-The use of secondary addresses can contribute to congestion on the network.

-optional transitive:if not recognized,are marked as partial n propagated to others

-MED is sent to eBGP nei only, choose the lowest one,DF:0, is considered the metric of BGP (router)#default-metric [number]
Weight not sent to any BGP nei, Local-pref sent only within AS thru iBGP

-BGP is not designed to perform load balancing, paths are chosen bcoz of policy,not chosen based upon BW, BGP is designed for manipulating routing paths.

bgp bestpath as-path/metric ,bgp always-compare-med

multihoming is for redundancy n increased routing efficiency/BW, not load balancing,one of the link will always be better than the other one. 50/50 is impossible!
static route ( default route ) can specific a route
common IGP: send all/any routes along with the df route, may still not select the best
BGP: use policy-based to filter, send partial routing table


-BGP has its own table,in addition to the IP routing table, info can be xchanged betw them.

-single-homed multi-ISP -> enable syn

-multi-homed multi-ISP -> disable syn for using IGP

BGP header: if open,then all 1s
distribute-list relys on acl -> acl 1 permit xxxxxx / nei [ip] distribute-list 1 out
in IGP: (router)#distribute-list 1 out e0(rip)

BGPv4:RFC 1771
Weight -> LocPre -> originated -> AS_Path -> lowest origin type( IGP MED -> external>internal -> lowest metric IGP nei -> lowest IP addr

The route betw 2 BGP can be leant with IGP ,but no df route allowed
debug ip bgp dampaning: locate loops

BGP is an Advanced Distance Vector protocol. Routers running BGP exchange network reachability information, called path vectors or attributes that include a list of the full path (of BGP AS numbers) that a route should take in order to reach a destination network.

-You should use BGP when at least one of the following conditions exist:
An AS allows packets to transit through it to reach other AS’s (for example, a service provider) An AS has multiple connections to other AS’s
The flow of traffic entering and leaving your AS must be manipulated

-You should not use BGP when the following conditions exist:
A single connection to the Internet
Routing policy and route selection are not a concern for your AS
Lack of memory or processor power on BGP routers to handle constant updates
Limited understanding of route filtering and BGP path selection process
Low bandwidth between AS’s

-You should use static routes if any of the preceding conditions are true. Remember that BGP, if not properly controlled and filtered, has the potential to allow an outside AS to affect your routing decisions.

Two routers speaking BGP form a TCP connection with one another and exchange messages to open and confirm the connection parameters. Once a connection is made between these neighbors (or peers routers), full routing tables are exchanged. From then on, BGP routers need only send changes (incremental updates). Since periodic updates are not required, triggered updates are used.

-BGP neighbors send keepalive messages, similar to the hello messages of EIGRP and OSPF.

-BGP provides a loop free path, because a router running BGP will not accept a routing update that already includes its AS number in the path list, since this would mean that the update has already passed through its AS.

-BGP comes in two flavors, Internal BGP (iBGP) and External BGP (eBGP). iBGP is when BGP is running between routers within the same AS, while eBGP runs between routers in different autonomous systems. -Routers running eBGP are usually directly connected. Routers running iBGP do not have to be directly connected.

-An important distinction between iBGP and eBGP is that an iBGP AS would be considered a transit AS, meaning packets not originated in the AS are moving through it.

-BGP allows administrators to define policies, or rules, for how data will flow through the AS.

-BGP metrics are called path attributes. An attribute can fall into four separate categories:
Well-known mandatory: Must be present in all update messages
Well-known discretionary: Could be present in update messages
Well-known attributes must be recognized by all compliant BGP implementations and are propagated to peers
Optional transitive: If not recognized, are marked as partial, and propagated to other neighbors
Optional nontransitive: Discarded if not recognized
Optional attributes: Recognized by some implementations, expected not to be recognized by everyone, and recognized optional attributes are propagated to other neighbors based on their meaning

-BGP attributes include:
AS-path (Well-known mandatory): The AS-path attribute is actually the list of AS numbers that a route has traversed in order to reach a destination.
Next-hop (Well-known mandatory): Indicates the next-hop IP address that is to be used to reach a destination.
Local preference (Well-known discretionary): Provides an indication to routers in the AS about which path is preferred to exit the AS.
Multi-exit-discriminator (MED): Optional nontransitive attribute- An indication about the preferred path into an AS.
Origin- Well-known mandatory- Defines the origin of the path information.
Community (Optional transitive attributes): Allow routers to tag routes with an indicator (the community) and allow other routers to make decisions based upon that tag.
Atomic aggregate (Well-known discretionary): Informs the neighbor AS that the originating router has aggregated the routers.
Aggregator: Optional transitive attributes
Weight (Cisco defined): Configured locally to a router and not propagated- Values from 0 to 65535. Default of 32768 for paths the router originates and 0 for other paths. Routes with a higher weight are preferred when multiple routes exist to the same destination.
The BGP synchronization rule states that a BGP router should not use, or advertise to an external neighbor, a route learned by iBGP, unless that route is local or is learned from an IGP. BGP synchronization is on by default. Basically, disabling BGP synchronization allows a router to advertise routes in BGP before learning them in IGP.

-Route Selection BGP route selection is based on metrics in the following order:
Highest weight /Highest local preference /Originated by the local router / Shortest AS-path Lowest origin code /Lowest MED

Configuring BGP:BGP configuration is similar to other routing protocols. Here is an example configuration connecting two neighbors in a different autonomous system.
RouterA(config)#router bgp 64500
RouterA(config-router)#neighbor 10.1.1.1 remote-as 65000
RouterA(config-router)#network 172.16.0.0 mask 255.255.0.0
RouterB(config)#router bgp 65000
RouterB(config-router)#neighbor 10.1.1.2 remote-as 64500
RouterB(config-router)#network 172.17.0.0 mask 255.255.0.0

-Multihoming :Multihoming describes an AS that is connected to more than one ISP. The three common ways to configure connections are: Default routes from all providers - Low memory and CPU usage. Provider sends BGP default route. AS sends all of its routes to the provider.Customer routes and default routes from all providers - Medium memory and CPU usage. Best path is usually shortest AS-path. Can override path choice. IGP metric to default route used for all other destinations. Full routes from all providers - Higher memory and CPU usage. Reach all destinations by best path. Can still manually tune path choice. Advertising Routes with BGP

-When we redistribute BGP with IGPs, BGP has its own table in addition to the IGP routing tables. Redistribution is the process of exchanging the routing information between the two dissimilar routing tables. You can advertise networks into BGP via:Using the network command Redistributing static routes using the null 0 Redistributing dynamic IGP routes - Cisco recommends not redistributing from the IGP, as it may cause instability.


Always use: update-source loopback0 for iBGP.

When a prefix is received from an eBGP neighbor, it must be advertised to both eBGP & iBGP neighbors.

When a prefix is received from an iBGP neighbor, it is advertised ONLY to eBGP neighbors and NOT to any iBGP neighbors. This requires that all iBGP routers must be fully meshed or the use of route-reflectors or confederations.

The synchronization rule only applies to iBGP learned prefixes. It states that an iBGP learned prefix cannot be considered best unless you have a matching IGP route for that BGP prefix.

There are only 3 ways to originate prefixes in BGP:
Network statement
Aggregate statement
Redistribute an IGP into BGP

When iBGP speakers are NOT fully meshed and there is no route-reflector or confederation, any prefix learned from an iBGP neighbor will only be advertised to eBGP neighbors and not to any iBGP neighbors.

BGP only advertises what it considers the best path. If the iBGP path is not synchronized, it's not included in the best path calculation.

Implications:
NO SYNC or Synchronize by redistributing BGP into the IGP at the router that introduced the BGP route.

Redistribute eBGP into IGP at the border router.

The BGP Router-id is used with the synchronization and in iBGP the BGP Router-id is used as tie breaker for the BGP path selection

Just because the next hop is pingable, it does not mean it's a valid next hop.
Next hop addresses that are reachable only via a default route aren't valid.
Next hop addresses that are reachable only via another BGP route are also not valid.
By default, BGP does not accept subnets redistributed from Interior Gateway Protocol (IGP).

To advertise and carry subnet routes in BGP, use an explicit network command or the no auto-summary command.

The no auto-summary command is NOT needed if there is no redistribution from IGP into BGP.


BGP communities
Helps with scalability in large networks
Group of destinations that share some common property
no-export Do not advertise to EBGP peers
will go to sub-confed peers
no-advertise Do not advertise to any peer will go to next-hop only
internet Advertise to any peer
none Removes the community with: set community none

BGP Debug Info
show ip bgp neighbor: Detailed information on TCP and BGP neighbor connections
show ip bgp summary: Summary of BGP neighbor status
show ip bgp path: Path information
show ip bgp: shows the BGP routing table
show ip bgp x.x.x.x: Shows all the attributes for the route
sho ip bgp neighbor x.x.x.x advertised-routes: Shows the advertised routes by neighbor x.x.x.x
sho ip bgp nei x.x.x.x routes: Shows the routes from neighbor x.x.x.x
show ip bgp neighbor x.x.x.x received-route: to view the routes received from neighbor
debug ip bgp: display all BGP activity [not very resource intensive]
debug ip bgp update [access-list]
access-list 1 permit host 10.108.10.0 [prefix 10.108.10.0]
access-list 101 permit host 10.108.10.0 host 255.255.255.0
network 10.108.10.0/24
show ip bgp route-map xxx: Will show the routes to which the route-map was applied to


BGP regular expressions
sh ip bgp regexp {pattern}: Will displays the result of the RegEx
[0-9]*: All routes from this AS
^[0-9]*$: This AS only
_.*: Matches everything [permit any/all] [a space and anything]
_100_: Match any route going through AS100
_100 200_: Match any route passed through 100 and 200
_100$: Match any route originated in AS100
^100$: Match only routes originated in AS100 that did not pass through any other AS
^100_: Match only routes transiting directly connected AS100, anything else behind
^100 .*: Match only routes received from AS100 or 1000..., anything else behind
^$ Match only routes originated from this AS
.*: Match anything [usually at end as: permit .*]
( .*): matches a space plus a AS
( .*)*: matches a space plus a AS or a null string
?: To type ?: either Ctrl-V or Esc-Q
.: Matches any single character, including white space.
*: Matches 0 or more sequences of the pattern.
+: Matches 1 or more sequences of the pattern.
?: Matches 0 or 1 occurrences of the pattern.
^: Matches the beginning of the input string.
$: Matches the end of the input string.
_: Matches a comma (,), left brace ({), right brace (}), left parenthesis, right parenthesis, the beginning of the input string, the end of the input string, or a space.
[]: Designates a range of single-character patterns.
-: Separates the end points of a range.
(): (Border Gateway Protocol (BGP) specific) Designates a group of characters as the name of a confederation.

BGP selection process: Before anything -- if a route is not synchronized, it is thrown out!!
The address/network given for the next hop is available in the IP routing table
The route with the highest Weight attribute (the Weight attribute is Cisco proprietary)
The route with the highest Local_Preference attribute
Any routes that were learned Locally (next-hop = 0.0.0.0)
The route with the shortest AS_Path attribute (confed learned paths are not included.)
The route with the lowest Origin [internal (0), external (1), incomplete (2)]
The route with the lowest Multi-Exit Discriminator (MED)
The route learned via EBGP (iBGP routes are discarded at this point)
The route with the nearest IGP neighbor
The oldest learned route
The route with the lowest BGP router-id

BGP synchronization rules
The BGP synchronization rules only apply to iBGP, If your autonomous system is passing traffic from another AS to a third AS, BGP should not advertise a route before all routers in your AS have learned about the route via IGP. BGP will wait until the IGP has propagated the route within the AS and then it will advertise that route to external peers. If you will not be passing traffic from a different autonomous system through your AS, or if all routers in your AS will be running BGP, you can disable synchronization. Disabling this feature can allow you to carry fewer routes in your IGP and allow BGP to converge more quickly.

How BGP advertises
Split horizon is always enabled, NO MATTER WHAT. A prefix learned from a neighbor will never be advertised back to that neighbor if that was the best route.
eBGP ==> eBGP: Next-hop for the destination will be set to: The interface doing the advertisement unless use: update-source
eBGP ==> iBGP: Next-hop for the destination will be set to: The interface of the eBGP doing the advertisement unless use: update-source, the iBGP peer must have a route [via IGP] to next-hop subnet, or won't go into BGP routing table Have the iBGP router do the next-hop-self If next-one does not have ebgp interface in routing table ==> next-hop-self
iBGP ==> eBGP: Next-hop for the destination will be set to: The interface doing the advertisement unless you use: update-source
iBGP ==> iBGP: Next-hop for the destination will be set to: iBGP peers do not advertise routes to other iBGP peers

How BGP attributes are applied
Weight: It is applied to neighbor/route-map IN with an eBGP neighbor to influence which interface to use to go out. Affects this router only
Local preference: It is applied with a route-map IN to influence outbound traffic, affects the whole AS eBGP
As-path prepend: It is applied with a route-map OUT with an eBGP neighbor to influence inbound traffic
MED: It is applied with:
route-map OUT with an eBGP neighbor to influence which router to use to come in
route-map IN with an eBGP neighbor to influence which router to use to come in
Distribute-list/route-filters: They are applied with a route-map IN/OUT to control which routes come in or go out
Communities: They are applied with a:
route-map OUT to propagate the community route-map IN to take action based on the community must do a: neighbor x.x.x.x send-community or the community will not be sent must do a: cle ip bgp * or the community will not be sent
Soft-reconfiguration: neighbor x.x.x.x soft-reconfiguration with an INBOUND eBGP neighbor
IP access-lists & IP distribute-lists: ONLY use route-map OUT
IP AS-PATH: It is applied with a route-map IN
TRY USING IP AS-PATH AS MUCH AS POSSIBLE INSTEAD OF IP ACCESS-LIST

Distances and routes
Modify the distance when you try to manipulate the choice of one protocol over another.
If there are multiple routes within a protocol, use the metric to modify the path.
SETTING THE DISTANCE IS ONLY LOCALLY SIGNIFICANT AND DOES NOT AFFECT OTHER ROUTERS.

Remember that a Route Reflector actually only reflects the best route and NOT all routes.

When you want to announce network you can either choose to use the “network” commands, the “aggregate-address” command or the “redistribution” commands. You do NOT need to have “network” commands if you use redistribution. Aggregate address will ONLY look in the BGP table. So you will need to get networks into BGP before using aggregate address to summarize them (you get them in there using either “network” or redistribute).

BGP, a distance vector routing protocol , uses TCP as its layer four transport (TCP port 179), does not use triggered updates , uses periodic keepalives to verify TCP connectivity , is extremely scalable, but is slow to converge

BGP, It is most useful when you have multiple or redundant Internet connections since it can then find the service provider with the fastest path to your destination.

BGP does not dynamically discover other neighboring BGP routers. They must be statically configured. This is beneficial since the service provider keeps its BGP connections under tight security. Use the following syntax to configure a BGP neighbor relationship:
Router(config)# router bgp
Router(config-router)# neighbor remote-as

You can only configure a Cisco router for a single BGP autonomous system (AS) (you cannot enter multiple router bgp numbers). However, you can connect to a practically limitless number of neighboring autonomous systems.

Once you have formed your neighbor relationships (neighbors no longer show the idle or active states from the show ip bgp summary output), you are now able to specify which internal networks you would like to advertise into the BGP routing process. Remember, service provider will propagate the networks you advertise to the entire Internet.

The BGP network command operates differently than any other routing protocol. Typically, the network statement tells a routing process the networks on which it should operate. For example, if you typed network 10.0.0.0 when using the RIP routing protocol, RIP would send advertisements out any interface that was using an address from the 10.0.0.0/8 network. In BGP, the statement network 10.0.0.0 causes BGP to advertise the 10.0.0.0/8 network to all neighbor relationships it has formed (provided a 10.0.0.0/8 network is installed on the interior routing table).

Because BGP is responsible for transmitting the entire Internet routing table, the amount of routes received by your router could be enormous. If your network requires redundant service providers, you would receive multiple copies of this routing table! In order to manage such a large amount of incoming routes, you must implement policy-based filtering techniques.

AS-Path filters will allow or deny BGP routes based on the autonomous system (AS) string attached to the route advertisement. For example, you could choose to block all incoming routes that originated, passed through, or most recently came from AS 50. You could choose to apply a filter that only permitted routes that have an empty AS-path string. This would effectively block all routes except those which originate from your autonomous system (these routes have an empty AS-path string).

Because AS-Path filters can match any criteria in the AS-path string, it is critical for you to understand regular expressions. Regular expressions allow you to use wildcard characters to provide flexible methods for matching exact AS numbers from the AS-path string.

Prefix-list filters allow you to filter specific networks from incoming or outgoing BGP advertisements. A prefix-list performs the same role as an access-list, however, Cisco has added many improved features. Individual entries in prefix-lists can be inserted or deleted. Prefix-lists also consume less CPU cycles than an access-list due to tree-structure rather than sequential processing. To create a prefix list, use the following syntax:
Router(config)# ip prefix-list list_name [seq sequence_number] [permit deny] address/prefix [ge value] [le value]

The ge and le values give you greater flexibility when using prefix lists. They allow you to match ranges of subnets rather than a specific subnet.
For example, if you wanted to permit a specific subnet (192.168.1.0/24), your prefix-list would look like the following:
Router(config)# ip prefix-list Example seq 10 permit 192.168.1.0/24
If you wanted to match any non-classful subnets of 192.168.1.0/24, you would use the following prefix-list:
Router(config)# ip prefix-list Example seq 10 permit 192.168.1.0/24 ge 25
The above statement is like saying, “match any address that starts with 192.168.1.0, but has a subnet mask of 25 bits or greater.” This would effectively match any subnet of the classful address 192.168.1.0/24.
If you wanted to match a range of subnets, for example, any 172.16.0.0/16 subnet between 16-bits and 24-bits in length, you would use the following prefix-list:
Router(config)# ip prefix-list Example seq 10 permit 172.16.0.0/16 le 24
The above statement is like saying, “match any address that starts with 172.16.0.0, but has a subnet mask between 16-bits and 24-bits in length.”

Route-maps give you the most administrative flexibility for filtering BGP routes. The route-map you create is comprised of match and set statements. These are analogous to the if and then statements in many programming languages. The route-map will match one or more routes on defined criteria and then set some parameter for those routes. Most administrators prefer to use route-map filtering because they are able to identify (match) routes based on any number of criteria (such as the network number, subnet mask, route origination, AS-path, etc…). Once the route-map matches a route, it can then modify (set) nearly any attribute of that route (such as origin, the next hop address, weight, local preference, etc…). In addition, route-maps can also be combined with prefix-lists to permit or deny routes from entering the local BGP table.

route-map:
Router(config)# route-map name [permit deny] sequence_number
Router(config-route-map)# match condition
Router(config-route-map)# set parameter

Well-known means that all implementations must support the attribute.
Optional attributes do not need to be recognized by the BGP implementation.

There are two categories of well-known attributes. They are mandatory and discretionary.
Mandatory attributes must be included in all messages.
Discretionary attributes do not need to be included in a message.
Mandatory Well-Known attributes are as follows:
Origin AS-Path Next-hop IP Discretionary Well-Known attributes are those below:
Local Preference Atomic Aggregate

Optional attributes can be either transitive or nontransitive.
Nontransitive means the metric is not carried far.

Transitive means that they are kept and carried beyond the local neighbors.
The MED is an optional nontransitive attribute.
The aggregator and community are optional transitive attributes.
The AS-path stores the list of AS numbers traversed for a network advertisement.

Weight is the first attribute considered in route selection. A higher weight is preferred. Weight is not advertised. It is only used to influence the path selection to an outbound network from a single router.

Local Preference works like the weight attribute for path selection. However, it affects the entire AS.

AS-Path Prepending influences how other autonomous systems reach your network. Remember to prepend your own AS number, otherwise the advertisement will be dropped. Prepend additional AS numbers onto the path that you are attempting to devalue.

The Multi-Exit Discriminator, AKA “metric”, is used to influence how a neighboring AS reaches your network. Higher metric values are perceived as worse.
Communities allow route tagging. Once routes have been tagged, they may be filtered. Communities are 32 bit values represented in decimal values separated by a colon. 2000:100 is an example of a community value. The first 16 bits represent the AS number. The last 16 bits represent the tag value.

There are four special community values.
No-export: will not be advertised beyond the confederation
Internet: equivalent to any
No-advertise: never advertise this route
Local-AS: will not be advertised outside of the AS (even with regards to confederations)

The private AS range is from 64512 through 65535. These are often provided by service providers to customer networks, or can be used in confederations. An easy way to remember the range is to subtract 1024 from 65536. This will provide the starting private AS. If a customer is using a private autonomous system the service provider must use the following command when peering with eBGP neighbors.

neighbor ip-address remote-private-as

If a customer is multihomed, a public AS should be used.

A common method of attaching to a service provider is to advertise a default route via an IGP, pointing to the router connecting to the service provider.

Load balancing can be achieved with parallel links between two BGP peers. To configure load balancing between the neighbors, configure static routes to the loopback IPs. Use the loopback IPs as the update-source. EBGP multihop is necessary if the peers are external. Then peer to these loopback IPs. When this is done, a recursion process will take place and static routing will accomplish load balancing between the two routers.

Example configuration.
router bgp 65000
neighbor 1.1.1.1 remote-as 65001
neighbor 1.1.1.1 ebgp-multihop
neighbor 1.1.1.1 update-source lo 0
ip route 1.1.1.1 255.255.255.255 10.1.1.2
ip route 1.1.1.1 255.255.255.255 10.1.2.2

If two ISPs provide different AS numbers, AS number translation may be used to communicate with the service providers without problem.

When an AS functions as a transit system for other autonomous systems, the following considerations must be made:
Do not redistribute BGP into your IGP
Do not use default routing

IGPs are responsible for advertising next-hop-ips for iBGP peers

Include the links to eBGP neighbors in the IGP process to allow reachability to the next hop IP. Next-hop-self can also be used to prevent reachability issues.

Avoid conflicts with IGP and BGP routes. If both protocols learn of the same network by different protocols, administrative distance will be used to choose the route to use. This can cause disastrous results if uncontrolled. Below you will find the administrative distance of common routing protocols.

neighbor ip-address update-source interface – Peer to stable interfaces for iBGP peers
no synchronization – Use if an IGP is not enabled.
distance bgp external internal local – Use to modify the AD of a route

BGP carries customer and provider routes
IGPs carry only internal routes used to supply routers with an understanding of the next-hop-IP. This may include loopback IPs for IBGP neighborships.
Do not redistribute BGP into your IGP
IBGP does not scale well as a full mesh, and create too much update traffic
Use route-summarization whenever possible
Route Reflectors overcome the full mesh requirement of IBGP neighborship.

When a router receives an update from an external peer, it will propagate that advertisement to all peers (eBGP and iBGP).
When a router receives an update from a non-client internal peer, if it is a router reflector, it will propagate that advertisement to all clients and eBGP peers.
When a route reflector receives an update from a client, it will be reflected to all iBGP peers. Route-reflectors may be single points of failure unless clusters are used. Clusters allow for redundancy without problems such as routing loops.
A hierarchy of route-reflectors may be used to overcome scaling very large autonomous systems.

Confederations allow a large autonomous system to be carved up into smaller AS numbers. To the outside world, the autonomous systems participating in the BGP confederation are seen as a single AS. This can help overcome scalability by reducing peering.

An iBGP full mesh is needed for member-autonomous systems. eBGP neighborships can be used in any manner to provide connectivity between all participating member-ASs.

BGP Commands:
bgp cluser-id cluster-id – Configured the route reflector cluster
neighbor ip-address route-reflector-client – Informs a route reflector of its clients
router bgp member-as-number – Configures the member-AS of a router within a confederation
bgp confederation identifier external-as-number – Configures the external AS
bgp confederation peers list-of-intra-confederation-as – Informs an intermember EBGP speaker in a confederation of the other member-autonomous systems participating in the confederation

The creators of the BGP routing protocol designed it for slow convergence. Although this seems illogical, it becomes clear when you realize the sheer size of a BGP network. If BGP propagated routes quickly, a single, flapping network could cause an instant worldwide routing table recalculation. Considering the number of flapping routes that exist on a daily basis, this would be disastrous.

Using a variety of BGP configuration commands, you are able to lower the convergence time of BGP. If you are dealing with Internet-sized routing tables, Cisco recommends that you do NOT adjust the following timers. However, if you are using BGP to manage an enterprise-sized routing table, modifying the following timers can increase network performance and convergence time.

There are two timers you can adjust to lower the convergence time of BGP: the scanner interval and the hello interval.

The scanner interval is how often the BGP routing process “walks through” the BGP routing table and ensures all routes are still reachable. By default, this occurs once every 60 seconds. By lowering this interval you allow BGP to modify the table more quickly in the event that a next-hop address becomes unreachable. Keep in mind that decreasing this interval does adversely affect your router CPU load. Use the following syntax to modify the scanner interval
Router(config-router)# bgp scan-time seconds

The hello interval is how often BGP sends a hello message to a neighboring router. By default, BGP sends hello messages every 30 seconds for EBGP neighbors and every 5 seconds for IBGP neighbors. By decreasing this interval, the BGP routing process can detect a disconnected neighbor sooner resulting in faster convergence. Use the following syntax to modify the hello interval:
Router(config-router)# neighbor ip_address advertisement-interval seconds

Limiting the number of BGP prefixes from a neighbor: This feature allows you to limit the number of route advertisements you receive from a particular neighbor. This is necessary to protect yourself from a misconfigured neighbor who could send multiple copies of the Internet routing table to your router. This would quickly result in a memory overflow and potentially cause the router to crash. Use the following syntax to limit the number of prefixes you can receive from a neighbor:
Router(config-router)# neighbor ip_address maximum-prefix number_of_prefixes [threshold] [warning-only] [restart minutes]
threshold – This is a number from 0-100 representing a percentage. When a router reaches this percentage of prefixes (in relation to the maximum number of prefixes), it will begin generating warning messages.
warning-only – This causes the BGP router process to ONLY send warning messages when the neighbor exceeds the maximum number of prefixes. The default behavior is to drop the neighbor connection.
restart minutes – This instructs the router to try to re-establish the session after the specified interval in minutes

BGP peer groups are primarily designed to ease BGP neighbor configuration. However, peer groups also provide a slight performance boost. Peer groups allow you to group common neighbor parameters under a peer group name. This is useful if you have many BGP neighbors with similar parameters. You can then assign all the neighbors to a common peer group rather than assigning all the neighbor parameters individually. The syntax to create a peer group is as follows:
Router(config-router)# neighbor peer_group_name peer-group
Router(config-router)# neighbor peer_group_name (assign parameters to the peer group such as remote-as, route-map, filter-list, etc…)

Assigning peer groups
Router(config-router)# neighbor ip_address peer_group_name
Because the Internet is such a large entity, the probability for routing table changes is extremely high. At any given time of day or night, there are routes being added and removed from the BGP routing table. When a router connected to the Internet is failing, a common symptom is the connection going up and dropping continuously. Administrators commonly refer to this as route flapping. Uninhibited route flapping can cause constant, worldwide BGP routing table changes, thus decreasing Internet performance.

Route dampening is a method that allows a service provider to detect flapping routes and suppress them. This keeps a route that could potentially flap for hours or even days from propagating across the Internet. The architecture of route dampening is fairly easy to understand. When a route flaps (goes down and back up), the service provider assigns that route a penalty. After a route has been assigned too many penalties, the service provider suppresses the route and no longer advertises it for a certain amount of time.

Suppress Limit – The penalty limit at which a route is suppressed. Once a route reaches this limit, it is no longer advertised.
Reuse Limit – The point at which the route is re-advertised to the Internet. Once the penalty assigned to a route reaches this amount, the service provider will re-advertise the route. (in addition, service provider erases all penalties assigned to a route once the penalty drops below half of the reuse limit)
Maximum Suppress Limit – The maximum amount of time the service provider will suppress a route. Router(config-router)# bgp dampening [half-life reuse suppress max-suppress-time]

Most service providers use the default route dampening parameters:
half-life – How long before the service provider reduces the penalty of a route by half (Half-life/15 minutes)
reuse – The penalty value at which a route is reused (Reuse/750)
suppress – The penalty value at which a route is suppressed (Suppress/2000)
max-suppress-time – The maximum amount of time a route can be suppressed(Max-suppress-time/60min)
Per-flap penalty/1000 (nonconfigurable)

The ebg-multihop tells bgp to expect to have to traverse more hops
in that direction to reach the neighbor. Normally (for Ebgp), the
expectation is that the peer is directly connected to the network, and
will fail to establish the TCP connection when the specified neighbor
address is not found.


The bgp dampening command sets the half-life, un-suppress limit,
suppress-limit, and the max-time to suppress a route.
Is there a way to change the default cost per flap (1000) in bgp dampening

You can set the bgp dampening parameters using either the bgp dampening
statement or using the set dampening statement in a route map.
In the documentation Cisco states that the default value for the
max-suppress-time is 4 times the half-life.

You can enter however other values, lower so 3 times or so, but you can
enter also higher ratios. So half-time of 15 minutes and max-suppress-time
of 120 minutes. When doing a debug ip bgp dampening I see the dampening
being disabled however when I use a value greater than 4 times the
half-life.
Multihomed clients must create BGP sessions with both ISPs and have a public AS number

Using BGP, you have the ability to influence the direction traffic leaves your autonomous system. However, once the traffic has left your immediate AS, it is no longer under your control. As stated in RFC 1771, "BGP does not enable one AS to send traffic to neighbor AS intending that the traffic take a different route from that taken by traffic originating in the neighbor AS."

The update-source command is used to specify a link behind the neighboring router to allow for load sharing. For example, many administrators will create a loopback interface on the router and advertise the loopback interface to the neighboring router. Then, you can use the command neighbor update-source loopback 0 to use the ip address assigned to your loopback interface whenever you are communicating with the neighbor. This way, you do not need to create a neighbor relationship over only one of the two (or more) redundant links.

Based on the BGP route selection criteria, a route with a higher weight is considered before a route with a higher local preference.

You can filter routes based on AS number information only with an AS-path filter. While route-maps can use AS-path filters to accomplish this task, they cannot perform this feature without the use of an AS-path filter. Prefix-lists and Distribute-lists both filter on network prefix information.

The no-export BGP community string keeps a route from leaving the autonomous system.

You can use the default information-originate command from router configuration mode to inject a default route into the OSPF area. This is useful for clients with a single Internet connection out of the network.

Outbound Route Filters (ORFs) are a relatively new feature allowing an inbound BGP prefix-list to replicate to a service provider router who, in turn, will apply the prefix-list in the outbound direction. This can potentially save a significant amount of needless route replication.

The community attribute simply tags routes. You could use this attribute to perform any one the first three answers if used in conjunction with BGP filters

Idle, Active, and Open states all indicate that the router is attempting to form a relationship with its neighbor router(s). The only indication of success is if there is no state information displayed in the output. Rather, you should see a number in the State/PrxRcvd column indicating the routers have synchronized tables.

The ^ symbol matches any AS number at the beginning of a string.

The > symbol in the show ip bgp output denotes the best path to a destination. When there are two or more routes to the same destination, only the route tagged with the > symbol will be placed in the routing table

The MED does not leave a neighboring AS, making it a non-transitive attribute.

The _ delimiting character matches the beginning of a string, the end of a string, or white space. In this case, we are using it to match the white space on either side of 512. This would indicate that it is located in the middle of the AS-path string.

The BGP topology table will contain all routes from all neighbors with which the router has established a BGP session. The BGP routing process then chooses the best routes from the list and places them in the routing table.

The next-hop, as-path, and origin are the three well-known, mandatory attributes in every BGP advertisement.

The no-advertise BGP community string keeps a route from leaving the neighboring router.

BGP route refresh allows the neighbor to resend their entire BGP topology table when you request it without tearing down the TCP neighbor session (which occurs when you clear the BGP session). This does not store the neighbor's topology table in memory as soft-reconfiguration does.

Prefix-lists will only match the specific subnet in this case. It does not match any derivatives of this network.

If the BGP neighbor IP address is unreachable or the partnering neighbor is misconfigured, the status will remain active. This means the router is actively attempting to find and create a TCP session with this neighbor. You can verify the connectivity failure through the use of the ping command.

One of the most common problems administrators encounter when configuring BGP is attempting to create an EBGP neighbor relationship with a router that is not directly on the connected network. You can remedy this problem through the use of the neighbor ip_address ebgp-multihop number where number is the number of hops you must go to reach the neighbor.

Customers this size have no need for BGP. A default static route should suffice.

The weight attribute affects only the local router. It is never included in a BGP route advertisement.

Without any additional configuration, the routes originating from the ISPs will have no local preference or weight settings. In this case, the router will prefer routes that have the shortest AS-path.

The syntax to apply a prefix-list to an interface is neighbor ip_address prefix-list list_name [in/out] from router configuration mode.

If you allow routes to pass through your AS, both the backup and primary ISP may recognize you as a transit network. This means that they will begin forwarding traffic through your AS that does not belong to you.

BGP is an application-layer protocol that uses the TCP and IP protocols for reliable connections. It uses TCP port 179.

The show ip bgp summary command displays a listing of all statically configured BGP neighbors along with the current status of the neighbor connection. The show ip bgp neighbor command will give you extended information about each BGP neighbor. The other two commands result in syntax errors.

The default BGP timers include a keepalive interval of 60 seconds and a holdtime value of 180 seconds. This can be adjusted, however, this can considerably affect the CPU cycles your router must spend on the BGP routing process.

Routes with an origin of "?" (Unknown) have most likely originated from the redistribution of IGP routes into the BGP routing table. This symptom occurs anytime routes are redistributed from an IGP.

The "e" origin code is rarely seen in modern times. This is because it represents routes that are learned from the Exterior Gateway Protocol (EGP). EGP was the predecessor to modern day BGP.

BGP supports only MD5 authentication. This assists in avoiding common Denial of Service (DoS) attacks.
BGP is a distance vector protocol. This means that it will announce to its neighbors those networks that it can reach itself. The receivers of that information will say "if that AS can reach those networks, then I can reach them via the AS."

The AS-Path attribute (which lists all autonomous systems the route has passed through) is used to detect looping routes. If a BGP router receives a route and finds its own AS number located in the AS-Path, the router will recognize that the route has looped.

The syntax to configure BGP weight is neighborip_address weight

The correct syntax to establish a neighbor relationship is neighbor remote-as

When you set up inbound soft-reconfiguration for a BGP neighbor, your router will store the entire, original BGP routing table from the neighbor before any filters are applied in memory. This keeps the neighbor router from having to send the entire BGP topology table when you apply a new policy, but it does consume an excessive amount of memory.

If all other criteria is equal, BGP will break the tie by choosing the route originating from the BGP router with the lowest router-id.

The local preference attribute allows you to set the preference of routes. The higher the local preference, the more preferred the route becomes. This attribute remains with the route advertisement up to the edge of the local autonomous system.

Since the router has a base BGP configuration, the metric (MED) is not factored into the best route decision calculations. Instead, the router will use the shortest AS-path to choose the best route. By using AS-path prepending, you can add additional AS numbers to the AS-path string of the non-preferred link and make it less desirable.

Once traffic leaves your AS, you do not have the ability to influence the path it takes. You can only influence how the traffic leaves your AS.

Based on the BGP decision criteria, routes with higher weights are preferred over routes with a higher local preference. In this case, the first ISP has a higher weight and is preferred over the second.

The Metric (also called MED) allows you to "recommend" the path a neighboring AS should use to reach your system. The neighboring AS can choose to ignore this recommendation, however.

The show ip bgp command will give you a summary output of the BGP topology table. Routes that have been entered in the routing table are marked with the ">" symbol. If you would like to see extended output regarding a specific route, you can use the show ip bgp route/prefix command.

Unlike an access-list, an empty route-map statement permits all routes to pass through. In this case, there will be no local preference changes to the routes; the routes are simply permitted to pass through the filter

Soft outbound reconfiguration allows you to resend the BGP topology table without tearing down the neighbor session.

Private AS numbers work similarly to private IP addresses. For autonomous systems not advertised to the Internet, an address from the range 64512-65535 can be used.

The command bgp default local-preference changes the local preference of all routes received by the router to the preference you designate. Answer C will only set the local preference on routes received by a specific neighbor, and Answers A and B will produce syntax errors.

Multihomed clients must create BGP sessions with both ISPs and have a public AS number

You must use the bgp confederation peers to define all other confederation autonomous systems. BGP route dampening allows you to assign penalties to routes when they flap. Once a route hits a specific penalty limit (definable by you), the route is suppressed.By default, BGP will choose a single path to a destination and install it in the routing table. It will not load balance, even if multiple paths have exactly identical attributes The no-advertise BGP community string keeps a route from leaving the neighboring router. The default administrative distance of EBGP routes is 20.

Unlike an access-list, an empty route-map statement permits all routes to pass through. In this case, there will be no local preference changes to the routes; the routes are simply permitted to pass through the filter.

BGP peer-groups allow for easier configuration of BGP by applying a single configuration to multiple neighbors.Floating static routes do not work correctly with BGP. Once the floating static route makes it into the routing table, it will not be removed, even if the primary link comes back online. Floating static routes also rely on an increased administrative distance (AD), which cannot be matched with a route-map. This makes it more difficult to integrate these routes into the BGP process.

The half-life of a route is the length of time in which a penalty is cut in half. This directly effects how long a route is suppressed by the router.

Using a loopback interface as your update-source ensures that the BGP neighbor session is not tied to a physical interface. This allows for the most redundancy in your IBGP connections since there may be multiple paths to a loopback interface.

If a route reflector receives an update from a non-client, it will send the update only to configured EBGP and client IBGP peers. External BGP (EBGP) is always used for the exchange of routes between autonomous systems.

The BGP Scanner and Router processes consume the most router resources. These processes are responsible for scanning the routing table to ensure route reach ability and creating the BGP routing table, respectively.

The correct syntax to configure a route-reflector cluster is to join all route reflectors into a common cluster by issuing bgp cluster-id cluster_number on each route reflector.

Both Route Reflectors and BGP confederations are alternatives to creating a full IBGP neighbor mesh. These allow specific routers to be designated as "reflector" or "edge" routers. These routers disable the BGP split-horizon rule, eliminating the full mesh requirement.

Redundant route reflectors are configured into a cluster. This unique cluster ID is added to each outgoing route update. If a route reflector cluster ever receives a route with its cluster ID, the route is identified as "looping" and dropped

Because IGPs are not as scalable as BGP, they should never be used to handle the BGP routing table. In a transit system, they should only be used to propagate BGP next hop IP addresses. Confederation AS numbers are encased by parentheses in the AS-Path. These numbers are typically stripped and replaced with the real AS number before advertising a route to an external system.

Because each service provider is typically assigned a unique range of addresses, these addresses can be easily aggregated by the service providers. Thus, if you change service providers, you must return the old range and accept a new range from your new ISP. Otherwise, address aggregation would be extremely difficult, if not impossible.

Since transit systems typically run BGP on all routers (internal and external), it is safe to disable synchronization once all BGP peers have been meshed. This ensures there are no "black holes" in the AS.

By default, a route is suppressed when it reaches a penalty limit of 2000.

BGP Split Horizon states that your router should never send a route to an IBGP neighbor that was received via IBGP. This will require you to use either a full mesh IBGP environment or route reflectors.

Since the router has a base BGP configuration, the metric (MED) is not factored into the best route decision calculations. Instead, the router will use the shortest AS-path to choose the best route. By using AS-path prepending, you can add additional AS numbers to the AS-path string of the non-preferred link and make it less desirable.

When a route reaches half of the reuse limit (which is assigned a value of 750, by default), the penalty assigned to a route is completely erased and the route begins with a "clean slate."

By default, EBGP neighbors will form only if they are directly connected. You can change this behavior by using the syntax neighbor ebgp-multihop hops, where hops is the number of hops the router must travel through to reach the neighbor.

The BGP split horizon rule says, "never send a route learned by IBGP to another IBGP peer." The route-reflector effectively disables this rule. Improper placement of a route reflector can result in routing loops.

Routers belonging to an internal BGP confederation should have their routing process started with the confederation AS number. The real AS number is defined using the bgp confederation identifier command under router configuration mode.

Any of the above parameters can be applied to a BGP peer group except outbound prefix-lists. The two restrictions for a peer group are per-neighbor BGP parameters that affect outbound updates, and IBGP and EBGP neighbors cannot be mixed in a peer group.

BGP confederations allow you to split a single AS into multiple sub-autonomous systems. The AS is still represented by a single AS number, however EBGP sessions are used between internal sub-autonomous systems. This is one way to alleviate the full-mesh IBGP requirement. The other is route-reflectors.

AS-Path length is one of the common factors used when deciding on the best path to reach a given destination. AS-Path prepending allows you to add AS numbers to the beginning of the AS string, thus making a path less desirable.

You can use the maximum-paths command from router configuration mode to configure BGP to load balance between a maximum of six paths.

Increasing the BGP hello interval allows you to detect neighbor failure more quickly. This allows for faster convergence on the BGP network. However, the smaller the hello interval becomes, the more resources the BGP process will consume.

If a route reflector receives an update from an internal client, it will act no differently than any other BGP router and will send the update to all configured neighbors. By default, all routes sent through an IBGP neighbor relationship will have the next-hop address of the originator of the route. This behavior can be changed with the next-hop-self argument attached to the neighbor statement.

By default, all routes sent through an EBGP neighbor relationship will have the next-hop address of the router sending the routes.

If you are connected to multiple ISPs, you will most likely use provider-independent addressing. This keeps your organization from being tied to the specific range of a certain ISP (which is provider-assigned addressing).
The default packet size between BGP peers is 536 bytes. This can be inefficient in many circumstances. This can be increased using theip tcp path-mtu-discovery command.
The no-export BGP community string keeps a route from leaving the autonomous system.
Cisco recommends that you should always use private AS numbers (AS numbers above 64512) when configuring internal confederations.
By default, BGP will only install a single path to a destination network in the routing table. You can increase this up to a maximum of six paths using the maximum-paths command from router configuration mode

The use of a loopback interface ensures that the neighbor stays up and is not affected by
malfunctioning hardware.
BGP uses the IP address configured on the physical interface directly connected to the BGP peer as the source address when it establishes the BGP peering session, by default. Issue the neighbor update−source command in order to change this

behavior and configure the BGP that speaks to the router to establish peering with the use of a loopback address as the source address.

Internal BGP (iBGP) sessions preserve the next hop attribute learned from eBGP peers.
This is why it is important to have an internal route to the next hop. The BGP route is
otherwise unreachable. In order to make sure you can reach the eBGP next hop, include the
network that the next hop belongs to in the IGP or use the next−hop−self neighbor command
to force the router to advertise itself, rather than the external peer, as the next hop. Refer to the BGP Nexthop Attribute section of BGP Case Studies for a more detailed explanation.

There are three most important keywords which we should have in mind while setting up BGP neighbor relationship. Even sometimes when we have successful BGP relationship, we are not able to see routes in the routing table. Following are the three important keywords.

1)ebgp-multihop :- In EBGP, neighbor relationships are only formed if we have directly connected networks. We would require to use ebgp-multihop keyword with neighbor statement so that neighbors which are not directly connected can form relationship with each other. We need to specify a number with ebgp-multihop keyword, number can be between 1-255. This number represents how many hop counts is the router away.

2)update-source. We need to specify the interface which will be used to update neighbor table incase routers are not directly connected. Without update-source we will not be able to form BGP neighbor relationships. update-source keyword will update the interface which will be used to form neighbor relationship. see configuration example below for better understanding.

3) next-hop-self:- When ebgp relation replicates , next hop always changes.IBGP routers only connected with other ibgp routers in same AS will not be able to talk with routers outside the AS, if they are not directly connected with each other. We would require a next-hop-self keyword in the ibgp router which is directly connected with ebgp neighbor so that other router in same AS (IBGP) can talk with ebgp routers. Refer to configuration
router BGP 34 –> As soon as we type 34 BGP process will start in the background
neighbor 192.168.1.2 remote-as 34 –> Bgp will know that this is IBGP looking at AS
neighbor 172.16.1.2 remote-as 400 –> neighbor relationship with ebgp peer.
neighbor 3.3.3.3 ebgp-multihop 255 –> 255 is number of hops that neighbor is away. we can use any number from 1-255, it can be more specific by using 1 or 2 but my personal fav is 255 as it avoids confusion.
neighbor 3.3.3.3 update-source loopback 0 –> Here is the idea, when its sourcing the packets its sourcing it from serial interface, we need to inform the otherside that source interface is not serial interface, it is looback interface so that it cann match ip ip’s with the right interface and form neighbor relationship.


Use network commands to add neighbors in routing table. Network command in BGP is bit different then Network command in other routing protocols. we ‘ll need to define mask keywork with network command in order to advertise clasless network where as if it is using a default mask we can ignore the same.

There are times when route propagated in BGP doesn't exist. As we know that even in link down situation, BGP takes its own sweet time to converge. In this kind of scenario we need to clear advertised routes and in some cases we use the following command
clear ip bgp *

You can also verify the advertised routes with following command
sh ip bgp neighbors A.B.C.D advertised-routes
Even in cases when you change the inbound/outbound policy , you need to reset your BGP session.But using clear ip bgp * can impact all other links as BGP will create routing table from scratch. This is as good as rebooting the router. To minimise impact we can use following command.

clear ip bgp A.B.C.D soft out –> When you make changes in outbound policy
and use clear ip bgp A.B.C.D soft in –> When you make changes in inbound policy .

There is a way to tag a route advertisements with additional information. you can tag route using bgp communities. A community defines a property of a prefix, in such a way that a router can be configured to treat all prefixes with a certain community in a certain way, for example, to give those a higher preference. This way, one does not have to build an access list to match all the prefixes explicitly. A prefix can be tagged with multiple communities, and a community can be attached to multiple prefixes.RFC1997 gives you more details on BGP communities.

Most important communities are NO_ADVERTISE and NO_EXPORT, indicating that a prefix should not be re-advertised beyond the router or the autonomous system receiving the prefix respectively. The latter is useful if you want to announce a more-specific prefix to one of your upstreams without polluting the global routing table.


WARNING: Setting the
no-export, no-advertise, or no-export-subconfed
communities can have the (possibly unwanted) side effect that no routes are announced, even if there are other routes that would otherwise be eligible for announcement.

For instance, if we have 2 ISP's ISP A and ISP B,if you set the
no-advertise community on routes announced to ISP B, other customers of ISP Bwon't see these routes because they aren't advertised. This is as intended. But routes with the same NLRI that ISP B has learned from ISP A will not be advertised either, because ISP B considers the directly received routes with the no-advertise community best, and only the best route is eligible for further announcement over BGP.



Router# clear ip bgp {* address peer-group-name} soft in
this performs a dynamic soft reset on the connection specified in the command

The following examples shows the clear ip bgp 131.108.1.1 soft in command used to initiate a dynamic soft reconfiguration in the BGP peer 131.108.1.1. This command requires that the peer supports the route refresh capability.
Router# clear ip bgp 131.108.1.1 soft in

No comments: