Ccie BGP
Ccie BGP
2
Bi-lateral Non-transit.
L2 PAIX You can get to Level 3
Settlement our prefixes and
Customer Free Peer we can get to Transit
your prefixes.
Prefixes No charge. Buy transit per Mb/s per
month for routes not know
Public IP EBGP from non-transit AS’s
Address Sta
Cabrillo
t ic CENIC (non-transit AS) Google
De
fau Redistribute
lt
static Commodity
Peer
MED LocPref SVL-Agg1
SVL SAC
AS and EBGP
Public IP P
UCSC EBG
Address Hurricane Elec
EBGP
Fully-meshed IBGP
Commodity
AS and EBGP Peer
Public IP UCLA
Address LAX RVR
LAX-Agg1
tic
Sta Comcast
lt IGP: IS-IS used for next-hop reachability
fau
Public IP De Commodity
Address
EBGP
Cuesta Peer
Non-transit. You can get to our prefixes and
we can get to your prefixes. No charge.
Note: Non-customer prefixes (networks connecting peers) are not included in EBGP updates to peers.
IGP is not redistributed into IS-IS and IS-IS is not redistributed into BGP. 3
Note: This diagram is by no means accurate but only a very simplified representation of an AS.
4
www.cenic.org
5
Path Attributes
Each route has its own set of defined attributes, which can include:
Path information
Route preference
Next-hop
Aggregation information
Administrators use these values to enforce routing policy.
Based on attribute values, you can configure BGP to:
filter routing information
prefer certain paths
customize its behavior
Every UPDATE message has a variable-length sequence of path attributes.
6
Path Attributes
7
Path Attributes
Well-known mandatory
An attribute that has to exist in the BGP UPDATE packet.
It must be recognized by all BGP implementations.
If a well-known attribute is missing, a notification error will be generated
This ensures that all BGP implementations agree on a standard set of
attributes.
Example: AS_PATH attribute
8
Path Attributes
Well-known discretionary
An attribute that is recognized by all BGP implementations
But may or may not be sent in the BGP UPDATE message.
Example: LOCAL_PREF
9
Path Attributes
Optional transitive
An attribute that may or may not be, recognized by all BGP
implementations (thus, optional).
Because the attribute is transitive:
BGP should accept and advertise the attribute even if it isn’t
recognized.
Example: COMMUNITY
10
Path Attributes
Optional non-transitive
An attribute that may or may not be, recognized by all BGP
implementations.
Whether or not the receiving BGP router recognizes the attribute, it is non-
transitive:
Should NOT be passed along to other BGP peers.
Example: MED
11
The Route Selection
WLam Decision Process (Cisco)
Summary of the BGPWeight Path Selection Process
BGP uses the following Localcriteria, in the order presented, to select a path for a
Preference
destination:
NOTE: Not all of these as path
are commonly used and will be examined in more
detail later in this presentation
med and in the next presentation.
1. If the path specifies a next hop that is inaccessible, drop the update.
2. Prefer the path with the largest weight.
3. If the weights are the same, prefer the path with the largest local preference.
4. If the local preferences are the same, prefer the path that was originated by
BGP running on this router.
5. If no route was originated, prefer the route that has the shortest AS_path.
6. If all paths have the same AS_path length, prefer the path with the lowest
origin type (where IGP is lower than EGP, and EGP is lower than Incomplete).
7. If the origin codes are the same, prefer the path with the lowest MED
attribute.
8. If the paths have the same MED, prefer the external path over the internal
path.
9. If the paths are still the same, prefer the path through the closest IGP
neighbor.
10. Prefer the path with the lowest IP address, as specified by the BGP router ID
12
The AS-Path
Attribute
WLam
Weight My path to
192.168.1.0 is
Local Preference
(65500, 64520)
as path
med
My path to
192.168.1.0 is
My path to (65500, 64520)
192.168.1.0 is
(64520)
14
show ip bpg – Shows the BGP Table
AS Path to 44.0.0.0 is via AS: 7018, 22822, 22822, 2152, 7377
2282 twice?
AS Path prepend (later)
15
The Next-Hop
Attribute
EBGP: The next-hop is the IP address of the neighbor that sent the update.
Router A advertises (EBGP) 172.16.0.0 to Router B, with a next hop of
10.10.10.3
IBGP: The next-hop is carried into IBGP unchanged.
Router B advertises (IBGP) 172.20.0.0 to Router C, with a next hop of
10.10.10.3.
Router B uses 10.10.10.3 as the next-hop attribute to get to 172.16.0.0
Router C’s next hop to reach 172.16.0.0 is 10.10.10.3 not 172.20.10.1
17
The Next-Hop
Attribute
Very important that Router C knows how to reach the 10.10.10.3 (10.0.0.0
or 10.10.10.0)
IGP
static route
Otherwise, Router C will drop packets destined for 172.16.0.0, because it
will not be able to get to the next-hop address for that network.
Must either:
Advertise the next-hop network, the network between AS’s, (10.10.10.0)
into the AS
18
Change the next-hop address (Router B’s 172.20.10.0 network) - later
The Next-Hop
Attribute
Recursive Lookup
IBGP router performs a recursive lookup to find out how to reach the BGP next-
hop address by using its IGP entries in the routing table.
Router C has a packet to send to 172.16.100.1
Finds the longest-match for 172.16.100.1 (172.16.0.0/16) in the routing table
and finds a BGP route with a next hop of 10.10.10.3.
Does a recursive lookup in the routing table for a path to network 10.10.10.3
If there is an IGP route to 10.10.10.3 (ex: 10.10.10.0) in the routing table with
a next hop of 172.20.10.1
Forwards the packet destined for 172.16.100.1 to 172.20.10.1
Otherwise, drops the packet 19
Third-Party Next- 172.30.0.0
Hop
I’m your EBGP peer but
your best next-hop path
to 172.30.0.0 is via
Router C at 10.10.10.2 EBGP
Third-party Next-Hop:
When running BGP over a multiaccess network such as Ethernet, a BGP
router uses the appropriate address as the next-hop address (by changing
the next-hop attribute) to avoid inserting additional hops into the path.
Because the network among the three routers A, B, and C is a multiaccess
network, it makes more sense for Router A to use Router C as a next hop to
reach 172.30.0.0, rather than making an extra hop via Router B.
20
Third-Party Next- 172.30.0.0
Preference
Attribute
WLam
IBGP
Weight
Local Preference
as path
med
IBGP
Attribute
WLam
Weight
Local Preference
as path
med
Attribute
My MED is 200 for
My MED is 150 for 172.20.0.0 so send
172.20.0.0 so send those packets this
those packets this way.
way.
By default, a router compares the MED attribute only for paths from
neighbors in the same AS.
By using the MED attribute, BGP is the only protocol that can affect
how routes are sent into an AS.
Router B has set the MED attribute to 150 for 172.20.0.0
Router C has set the MED attribute to 200 for 172.20.0.0
Router A receives EBGP updates from Routers B and C
Chooses Router B as the best next hop to get to AS 65500
26
AS 65000 AS
AS
172.20.0.0 65002
The MED 65001
Attribute
My MED is 200 for
My MED is 150 for 172.20.0.0 so send
172.20.0.0 so send those packets this
those packets this way to AS 65002.
way to AS 65001.
By default, a router compares the MED attribute only for paths from
neighbors in the same AS.
If these were two different AS’s then Router A would use MED for best path
selection
27
The Weight
Attribute
(Cisco Only)
WLam
Weight
Local Preference
as path
med
Router A
30
The Route Selection Decision Process (Cisco)
Summary of the BGP Path Selection Process
BGP uses the following criteria, in the order presented, to select a path for a
destination:
NOTE: Not all of these are commonly used and will be examined in more
detail later in this presentation and in the next presentation.
WLam
1. If the path specifies a next hop that is inaccessible, drop the update.
Weight
2. Prefer the path with the largest weight.
3. If the weights areLocal Preference
the same, prefer the path with the largest local preference.
4. If the local preferences
as pathare the same, prefer the path that was originated by
BGP running on this router.
med
5. If no route was originated, prefer the route that has the shortest AS_path.
6. If all paths have the same AS_path length, prefer the path with the lowest
origin type (where IGP is lower than EGP, and EGP is lower than Incomplete).
7. If the origin codes are the same, prefer the path with the lowest MED
attribute.
8. If the paths have the same MED, prefer the external path over the internal
path.
9. If the paths are still the same, prefer the path through the closest IGP
neighbor.
10. Prefer the path with the lowest IP address, as specified by the BGP router ID
31
The Route Selection Decision Process (ROUTE)
Step 1 Prefer the route with the highest weight. (Recall that the weight is Cisco-proprietary
and is local to the router only.)
Step 2 If multiple routes have the same weight, prefer the route with the highest local
preference. (Recall that the local preference is used within an AS.)
Step 3 If multiple routes have the same local preference, prefer the route that was originated
by the local router. (network command)
Step 4 If none of the routes were originated by the local router, prefer the route with the
shortest AS-path.
Step 5 If the AS-path length is the same, prefer the lowest origin code (IGP < EGP <
incomplete).
Step 6 If all origin codes are the same, prefer the path with the lowest MED. (Recall that the
MED is exchanged between autonomous systems.) The MED comparison is done only if the
neighboring AS is the same for all routes considered, unless the bgp always-compare-med
router configuration command is enabled.
Step 7 If the routes have the same MED, prefer external paths (EBGP) over internal paths
(IBGP).
Step 8 If synchronization is disabled and only internal paths remain, prefer the path through
the closest IGP neighbor. This means that the router prefers the shortest internal path
within the AS to reach the destination (the shortest path to the BGP next-hop).
Step 9 For EBGP paths, select the oldest route, to minimize the effect of routes going up
and down (flapping).
Step 10 Prefer the route with the lowest neighbor BGP router ID value.
Step 11 If the BGP router IDs are the same, prefer the route with the lowest neighbor IP 32
address.
The Route Selection Decision Process (ROUTE) 1
2
Step 1 Prefer the route with the highest weight. (Recall
that the weight is Cisco-proprietary and is local to the
router only.)
Step 2 If multiple routes have the same weight, prefer the 3
route with the highest local preference. (Recall that the
local preference is used within an AS.)
Step 3 If multiple routes have the same local preference, 5
prefer the route that was originated by the local router.
(network command)
Step 4 If none of the routes were originated by the local 4
router, prefer the route with the shortest AS-path.
Step 5 If the AS-path length is the same, prefer the
lowest origin code (IGP < EGP < incomplete). 7
Step 6 If all origin codes are the same, prefer the path
6
with the lowest MED. (Recall that the MED is exchanged
between autonomous systems.) The MED comparison is
done only if the neighboring AS is the same for all routes
considered, unless the bgp always-compare-med router
configuration command is enabled.
Step 7 If the routes have the same MED, prefer external 8 9
paths (EBGP) over internal paths (IBGP).
Step 8 If synchronization is disabled and only internal
paths remain, prefer the path through the closest IGP
neighbor. This means that the router prefers the shortest
internal path within the AS to reach the destination (the
shortest path to the BGP next-hop).
Step 9 For EBGP paths, select the oldest route, to
minimize the effect of routes going up and down 10 11
(flapping).
Step 10 Prefer the route with the lowest neighbor BGP
router ID value.
Step 11 If the BGP router IDs are the same, prefer the 33
route with the lowest neighbor IP address.
R1(config)#router bgp 65201
R1(config-router)# maximum-paths 2
35
Entering BGP Configuration Mode
RTA(config)#router bgp 100
RTA(config-router)#
36
Defining BGP Neighbors and Activating BGP
Sessions
RTA(config)#router bgp 100
RTA(config-router)#neighbor 10.1.1.1 remote-as 200
37
router bgp 65101
neighbor 10.2.2.2 remote-as 65101
neighbor 10.1.1.2 remote-as 65101
38
Router(config)# router bgp as
Router(configrouter)# neighbor {ipaddress | peergroupname} shutdown
39
Defining the Source IP Address
RTA(config)#router bgp 100
RTA(config-router)#neighbor 10.1.1.1 remote-as 200
The BGP neighbor statement tells the BGP process the destination IP
address of each update packet.
The source IP address must match the address in the corresponding
neighbor statement on the other router.
BGP does not accept unsolicited updates.
40
RouterD(config)#router bgp 65102
RouterD(config-router)#neighbor 10.3.3.1 remote-as 650102
41
Router(config)#router bgp as
Router(config-router)# neighbor {ipaddress | peergroupname}
updatesource loopback interfacenumber
RouterA(config)#router bgp 65102
RouterA(config-router)#neighbor 192.168.4.4 remote-as 650102
RouterA(config-router)#neighbor 192.168.4.4 update-source loopback0
RouterD(config)#router bgp 65102
RouterD(config-router)#neighbor 192.168.1.1 remote-as 650102
RouterD(config-router)#neighbor 192.168.1.1 update-source loopback0
Solution: Establish the IBGP session using a loopback interface when there
are multiple paths between the IBGP neighbors.
Causes the router to use the address of the specified loopback interface
as the source address for BGP connections to this neighbor.
42
Need to make sure loopback address is reachable (TCP session)
Router B has Router A as an EBGP neighbor
Only reachable via directly connected address 172.16.1.1
Router C has Router D as an EBGP neighbor
Only reachable via directly connected address 192.168.1.1
43
However, Router B has multiple paths to reach Router C (IBGP neighbor)
Router B and C: All networks are reachable via IGP EIGRP including
loopback interfaces
Neighbor relationship between Routers B and C are loopback interfaces
If one of the links between Router B and C goes down the BGP peering is
not affected.
Without the loopbacks as source interfaces If one of the links between
Router B and C goes down the BGP neighbor relationship would be lost.
44
EBGP Multihop
45
EBGP Multihop
EBGP Multihop
Each router instead:
Uses its loopback address as the source IP address for its BGP updates
Points to the loopback address of the other router
IGP is not used between autonomous systems, so neither router can reach
the loopback of the other router without assistance.
Assistance: Each router needs to use two static routes:
A path to reach the loopback address of the other router.
neighbor ebgp-multihop: Must also be configured to change the default
setting of BGP and inform the BGP process that this neighbor IP address is
47
more than one hop away (2 hops in this example).
Changing the Next-Hop
Attribute
An internal protocol, such as RIP, EIGRP, or OSPF, always uses the source
IP address of a routing update as the next-hop address for each network
from that update that is placed in the routing table.
IBGP: The next-hop is carried into IBGP unchanged.
neighbor {ip-address | peer-group-name} next-hop-self router
configuration command
Used to force BGP to use the source IP address of the update as the
next hop for each network it advertises to the neighbor
48
Rather than using the next-hop AS IP address (default).
192.168.15.0
EBGP: The next-hop is the IP address of the neighbor that sent the update.
Router A advertises (EBGP) 192.168.15.0 to Router B, with a next hop of 172.16.1.1
Router C advertises (EBGP) 192.168.15.0 to Router B, with a next hop of 192.168.1.1
IBGP: The next-hop is carried into IBGP unchanged.
Router B advertises (IBGP) 192.168.15.0 to Router C, with a next hop of 172.16.1.1
Router B uses 172.16.1.1 as the next-hop attribute to get to 192.168.15.0 and
Router C uses 172.16.1.1 as the next-hop attribute to get to 192.168.15.0
Router C’s next hop to reach 192.168.15.0 is 172.16.1.1 not one of it’s local interfaces
Very important that Router C knows how to reach the 172.16.1.1:
IGP
Static route
Otherwise, Router C will drop packets destined for 192.168.15.0, because it will not be able
to get to the next-hop address for that network.
Must either:
Advertise the next-hop network, the network between AS’s, (172.16.0.0) into the AS
49
Change the next-hop address to Router B’s local interface
192.168.15.0
50
Defining the Networks That BGP
Advertises
RTA(config)#router bgp as
RTA(config-router)#network networknumber
network networknumber [mask networkmask] [routemap map
tag]
Permits BGP to advertise a network if it is present in the IP routing table
No mask: Classful default mask is assumed.
Different than IGP network command:
Determines which networks this router advertises.
Does not determine which interfaces send/receive routing protocol updates
Sole purpose of the network command is to notify BGP which networks to
advertise
If the mask is not specified router announces only the classful network
address
At least one subnet of the specified major network must be present in the
IP routing table for BGP to announce the classful network as a BGP route.
If you specify the network-mask:
An exact match to the network (both address and mask) must exist in the
routing table for the network to be advertised. 52
Auto-summary
RTA(config)#router bgp as
RTA(config-router)# no autosummary
53
BGP Neighbor Authentication
?
OSPF IBGP
AS 65000 networks
Into OSPF
?
OSPF IBGP
AS 65000 networks
Into OSPF
56
Resetting BGP Sessions
57
Resetting BGP Sessions
BGP can potentially handle huge volumes of routing information.
Cisco IOS Software applies changes on only those updates received or
transmitted after the BGP policy configuration change has been performed.
If the network administrator wants the policy change to be applied on all
routes, he or she must trigger an update to force the router to let all routes
pass through the new filter.
Outgoing information, the router has to resend its BGP table through the
new filter
Incoming information, the router needs its neighbor to resend its BGP
table so that it passes through the new filter
There are three ways to trigger an update:
Hard reset
Soft reset
Route refresh
58
RTA(config)#router bgp 65500
RTA(config-router)# no synchronization
59
RTA(config)#router bgp 65500
RTA(config-router)# clear ip bgp *
Or
RTA(config-router)# clear ip bgp neighbor-address
Router A:
Has eight neighbors
Each neighbor sends Router A the full Internet table
assume that is about 32 MB in size
If the clear ip bgp * command is issued on Router A:
All eight routers resend their 32 MB table at the same time.
Router A will need 256 MB of RAM
Router A will have to process all of this information.
This will take a considerable number of CPU cycles
This will further delaying the routing of user data
clear ip bgp neighboraddress - one neighbor is reset at a time is
less severe
60
RTA# clear ip bgp * soft out
Or
RTA# clear ip bgp neighbor-address soft out
61
RTA(config)#router bgp 65500
RTA(config-router)# neighbor {ipaddress} softreconfiguration inbound
RTA# clear ip bgp {* | neighboraddress} soft in
63
When a BGP session is reset using soft reconfiguration, the following
commands can be useful for monitoring the BGP routes received, sent, or
filtered:
show ip bgp neighbors {address} receivedroutes: displays all
received routes (both accepted and rejected) from the specified neighbor.
show ip bgp neighbors {address} routes: displays all routes that
are received and accepted from the specified neighbor.; this output is a
subset of the output displayed by the received-routes keyword.
show ip bgp: displays entries in the BGP table.
show ip bgp neighbors {address} advertisedroutes: displays
all BGP routes that have been advertised to neighbors 64
BGP Configuration Examples
65
Basic BGP
66
IBGP and
EBGP
Router B
router bgp 65000
neighbor 10.1.1.2 remote-as 64520 EBGP peer to Router A
neighbor 192.168.2.2 remote-as 65000 IBGP peer to Router C’s loopback
neighbor 192.168.2.2 update-source loopback0 IBGP-RTC: Use Lo0 as source
neighbor 192.168.2.2 next-hop-self IBGP-RTC: Changes next-hop attribute to its own Lo0
network 172.16.10.0 mask 255.255.255.0 Advertises LAN 172.16.10.0/24 via BGP
network 192.168.1.0 Advertises serial link 192.168.1.0/24 via BGP
network 192.168.3.0 Advertises serial link 192.168.3.0/24 via BGP
no synchronization May be default if IOS 12.2(8)T or later. Must be fully-meshed IBGP
router eigrp 10
network 192.168.2.1 255.255.255.255 Advertises Lo0 192.168.2.1/32 via EIGRP so
RTC can reach it with it’s neighbor statement.
RTC will advertise 192.168.2.2/32 67
Verifying and Troubleshooting BGP
You can verify BGP operation using show EXEC commands, including the
following:
show ip bgp—Displays entries in the BGP topology database (BGP table).
Specify a network number to get more specific information about a particular
network.
show ip bgp rib-failure—Displays BGP routes that were not installed in the
routing information base (RIB), and the reason that they were not installed.
show ip bgp neighbors—Displays detailed information about the TCP and
BGP connections to neighbors.
show ip bgp summary—Displays the status of all BGP connections.
Use the show ip bgp ? command on a router to see other BGP show
commands.
debug commands display events as they happen on the router. For BGP,
the debug ip bgp privileged EXEC command has many options, including
the following:
dampening—BGP dampening
events—BGP events
keepalives—BGP keepalives
68
updates—BGP updates
show ip bgp
show ip bgp - Displays the BGP topology database (the BGP table).
The origin codes are shown at the end of each line.
The status codes are shown at the beginning of each line of output
In this output, most of the rows have an asterisk (*) in the first column.
Means that the next-hop address is valid.
The next-hop address is not always the router that is directly connected to this
router. (IBGP)
A locally originated route has a next hop of 0.0.0.0 69
Please review on your own…
s: indicates that the specified routes are suppressed
(usually because routes have been summarized and
only the summarized route is being sent).
d: for dampening, indicates that the route is being
dampened (penalized) for going up and down too often.
Although the route might be up right now, it is not
advertised until the penalty has expired.
h: for history, indicates that the route is unavailable and
is probably down; historic information about the route
exists, but a best route does not exist.
r: for RIB failure, indicates that the route was not
installed in the RIB.
The reason that the route is not installed can be
displayed using the show ip bgp rib-failure
command, as described in the next section.
S: for stale, indicates that the route is stale (this is used
in a nonstop forwarding-aware router
70
A greater-than sign (>) in the second column indicates the best path for a route
selected by BGP
This route is offered to the IP routing table.
asterisk (*) - means that the next-hop address is valid. 71
Third column is either blank or has an i:
Blank: BGP learned that route from an external peer (EBGP)
72
i: BGP learned that route from an internal peer (IBGP) .
The fourth column lists the networks that the router learned.
The fifth column lists all the next-hop addresses for each route. This next-hop address
column might contain 0.0.0.0, which signifies that this router originated the route.
The next three columns list three BGP path attributes associated with the path:
metric (MED)
local preference
weight. 73
“Path” header may contain a sequence of autonomous systems in the path.
The first AS listed is the adjacent AS from which this network was learned.
The last AS this network’s originating AS.
If the path column is blank, the route is from the current AS (this AS)
74
The last column signifies how this route was entered into BGP on the original router
(the origin attribute).
i: The original router probably used a network command to introduce this network into
BGP.
e: The original router learned this network from EGP (legacy, not likely).
?: The original BGP process cannot absolutely verify this network’s availability,
because it is redistributed from an IGP into the BGP process 75
show ip bgp rib-failure
Displayed routes were not installed because a route(s) with a better administrative
distance already existed in the RIB.
show ip bgp rib-failure - Displays BGP routes that were not installed in the
RIB (IP routing table) and the reason that they were not installed.
76
show ip bgp summary
77
BGP Router ID
When the
session is in
the established
state, this
value
represents the
number of
BGP network
BGP Number of Number of The last entries
The amount of The current received from
version BGP BGP version of
time this BGP state. If this neighbor
messages messages the BGP
neighbor has established,
Neighbors AS received sent to this table sent to
been in the not shown,
from this neighbor this neighbor
current BGP instead a value
neighbor
state is in the
(established, Pfx/Rcd 78
active or idle)
debug ip bgp updates
79
show ip bgp neighbors
Character Description
81
1 9 2 .1 0 .2 .0 /2 4
AS 300
R o u te rA
1 3 0 .1 .5 0 .3 2 /3 0 2 0 0 .2 0 0 .2 0 0 .6 4 /3 0
AS 200 AS 400
R o u te rB R o u te rC
1 2 .0 .0 .0 /8 1 1 .0 .0 .0 /8
RouterC#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 11.0.0.0 0.0.0.0 0 32768 i
*> 12.0.0.0 200.200.200.65 0 300 200 i
*> 192.10.2.0 200.200.200.65 0 0 300 i
82
1 9 2 .1 0 .2 .0 /2 4
AS 300
R o u te rA
1 3 0 .1 .5 0 .3 2 /3 0 2 0 0 .2 0 0 .2 0 0 .6 4 /3 0
AS 200 AS 400
R o u te rB R o u te rC
1 2 .0 .0 .0 /8 1 1 .0 .0 .0 /8
RouterC#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 11.0.0.0 0.0.0.0 0 32768 i
*> 12.0.0.0 200.200.200.65 0 300 200 i
*> 192.10.2.0 200.200.200.65 0 0 300 i
83
1 9 2 .1 0 .2 .0 /2 4
AS 300
R o u te rA
1 3 0 .1 .5 0 .3 2 /3 0 2 0 0 .2 0 0 .2 0 0 .6 4 /3 0
AS 200 AS 400
R o u te rB R o u te rC
1 2 .0 .0 .0 /8 1 1 .0 .0 .0 /8
RouterC#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 11.0.0.0 0.0.0.0 0 32768 i
*> 12.0.0.0 200.200.200.65 0 300 200 i
*> 192.10.2.0 200.200.200.65 0 0 300 i
84
1 9 2 .1 0 .2 .0 /2 4
AS 300
R o u te rA
1 3 0 .1 .5 0 .3 2 /3 0 2 0 0 .2 0 0 .2 0 0 .6 4 /3 0
AS 200 AS 400
R o u te rB R o u te rC
1 2 .0 .0 .0 /8 1 1 .0 .0 .0 /8
RouterC#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 11.0.0.0 0.0.0.0 0 32768 i
*> 12.0.0.0 200.200.200.65 0 300 200 i
*> 192.10.2.0 200.200.200.65 0 0 300 i
85
AS 200 AS 100
2.0.0.0 1.0.0.0
AS50#show ip bgp
Network Path
*> 5.0.0.0 i
*> 1.0.0.0 100 i
*> 2.0.0.0 100 200 i
*> 3.0.0.0 300 i
*> 4.0.0.0 300 400 i
*> 10.0.0.0 300 400 1000 I
86
AS 200 AS 100
2.0.0.0 1.0.0.0
AS50#show ip bgp
Network Path
*> 5.0.0.0 i
*> 1.0.0.0 100 i
*> 2.0.0.0 100 200 i
*> 3.0.0.0 300 i
*> 4.0.0.0 300 400 i
*> 10.0.0.0 300 400 1000 I
87
AS 200 AS 100
2.0.0.0 1.0.0.0
AS50#show ip bgp
Network Path
*> 5.0.0.0 i
*> 1.0.0.0 100 i
*> 2.0.0.0 100 200 i
*> 3.0.0.0 300 i
*> 4.0.0.0 300 400 i
*> 10.0.0.0 300 400 1000 I
88
AS 200 AS 100
2.0.0.0 1.0.0.0
AS50#show ip bgp
Network Path
*> 5.0.0.0 i
*> 1.0.0.0 100 i
*> 2.0.0.0 100 200 i
*> 3.0.0.0 300 i
*> 4.0.0.0 300 400 i
*> 10.0.0.0 300 400 1000 I
89
AS 200 AS 100
2.0.0.0 1.0.0.0
AS50#show ip bgp
Network Path
*> 5.0.0.0 i
*> 1.0.0.0 100 i
*> 2.0.0.0 100 200 i
*> 3.0.0.0 300 i
*> 4.0.0.0 300 400 i
*> 10.0.0.0 300 400 1000 I
90
Configuring BGP Attributes
91
The Route Selection Decision Process (ROUTE) 1
2
Step 1 Prefer the route with the highest weight. (Recall
WLam
that the weight is Cisco-proprietary and is local to the
router only.)
Step 2 If multiple routes haveWeight
the same weight, prefer the 3
route with the highest local preference. (Recall that the
local preference is used within an AS.)
Local Preference
Step 3 If multiple routes have the same local preference, 5
prefer the route that was originated by the local router.
(network command) as path
Step 4 If none of the routes were originated by the local 4
med
router, prefer the route with the shortest AS-path.
Step 5 If the AS-path length is the same, prefer the
lowest origin code (IGP < EGP < incomplete). 7
Step 6 If all origin codes are the same, prefer the path
6
with the lowest MED. (Recall that the MED is exchanged
between autonomous systems.) The MED comparison is
done only if the neighboring AS is the same for all routes
considered, unless the bgp always-compare-med router
configuration command is enabled.
Step 7 If the routes have the same MED, prefer external 8 9
paths (EBGP) over internal paths (IBGP).
Step 8 If synchronization is disabled and only internal
paths remain, prefer the path through the closest IGP
neighbor. This means that the router prefers the shortest
internal path within the AS to reach the destination (the
shortest path to the BGP next-hop).
Step 9 For EBGP paths, select the oldest route, to
minimize the effect of routes going up and down 10 11
(flapping).
Step 10 Prefer the route with the lowest neighbor BGP
router ID value.
Step 11 If the BGP router IDs are the same, prefer the 92
route with the lowest neighbor IP address.
Changing the Weight
WLam
Weight
Local Preference
as path
med
93
Routing policy dictates the selection of AS 65030 as the primary way out of
AS 65040 for the traffic destined to any network originated by the AS 65020.
94
AS _65020$
Weight=150
This route map set-weight is linked to neighbor 10.0.0.1 as an inbound route map.
The match condition is defined by the match as-path path-list-number
The path-list-number parameter is the number of the AS access-list (10)
Checks the AS-path attributes of networks to see which are permitted by AS
access list 10.
as-path AS access-list 10 permits networks whose:
AS-path attribute ends with 65020; these are networks originating in AS 65020.
set weight 150: The route map sets these networks to a weight of 150
95
AS _65020$
Weight=150
Can also set the weight in the neighbor statement (for all routes received from
that neighbor)
E1(config)#router bgp 100
E1(config-router)# neighbor 10.1.1.2 weight 2000
E1(config-router)# neighbor 10.1.1.6 weight 2000
E1(config-router)# neighbor 128.107.1.2 weight 1000
E1(config-router)# neighbor 128.107.2.1 weight 1000
100
172.16.0.0: shortest AS-path is via 192.168.28.1, Router X (65002 65003)
172.24.0.0: shortest AS-path is via 172.20.50.1, Router Y (65005)
172.30.0.0: shortest AS-path is via 172.20.50.1, Router Y (65005 65004)
101
A traffic analysis reveals the following:
The link going through:
Router B to 172.20.50.1 is heavily used
Router A to 192.168.28.1 is hardly used at all
The three largest-volume destination networks on the Internet from AS
65001 are: 172.30.0.0, 172.24.0.0, and 172.16.0.0.
30% of Internet traffic is going to network 172.24.0.0 (via Router B)
20% of Internet traffic is going to network 172.30.0.0 (via Router B)
10% of Internet traffic is going to network 172.16.0.0 (via Router A)
40%% of Internet traffic is going to other destinations
You have decided to divert traffic to network 172.30.0.0 and send it out
Router A to the next hop of 192.168.28.1
Better load balancing 102
172.30.0.0
Router A LocPref=400
Router A: The route map is linked to neighbor 192.168.28.1 as an inbound route map.
Receives updates from 192.168.28.1
Processes them through the local_pref route map
Sets the local preference accordingly and adds them to the BGP table.
The first route map statement
Match condition checks all networks to see which are permitted by access list 65.
Access list 65 permits 172.30.0.0 network
set local-preference 400 sets these networks to a local preference of 400
The second route map statement does not have any match or set statements.
Similar to a permit any statement in an access list.
Because there are no match conditions for the remaining networks, they are all permitted with their
current settings.
103
So, the local preference for networks 172.16.0.0 and 172.24.0.0 stays set at the default of 100.
172.30.0.0
LocPref=400
WLam
Weight
Local Preference
as path
med
Router C learns about the new local preference value (400) coming from Router A for
network 172.30.0.0.
Only change: the new best route to network 172.30.0.0 is via 192.168.28.1
Local preference = 400; higher than the default local preference of 100 via 172.20.50.1.
The AS-path through 172.20.50.1 is still shorter than the path through 192.168.28.1, but
AS-path but local preference takes precedence.
104
By default, the preferred way (shortest
path) to reach networks in AS65010 to
Setting AS Path reach 65040 is via R1
AS Prepending
108
To change this value, use the default-metric number router configuration
command.
To reach networks in AS 65001 all routers in AS 65004 see:
A MED of 1001 through the next hop of Router A
A MED of 99 through the next hop of Router B
If AS 65004 has no overriding policy, all routers in AS 65004 choose to exit
their AS through Router Y to reach the networks in AS 65001
This could result in suboptimal bandwidth utilization.
109
Setting the
MED using
Route Maps
110
Router A
Router B
111
Router A
Router B
Router A:
Networks permitted by ACL 66
(192.168.25.0/24 and
192.168.26.0/24)
Set MED to 100
All other networks
(192.168.24.0/24)
Set MED to 200
112
Router A
Router B
Router B:
Networks permitted by ACL 66
(192.168.24.0/24)
Set MED to 100
All other networks
(192.168.25.0/24 and
192.168.26.0/24)
Set MED to 200
113
Router Z BGP table: Indicating the networks learned from AS 65001.
114
Bi-lateral Non-transit.
L2 PAIX You can get to Level 3
Settlement our prefixes and
Customer Free Peer we can get to Transit
your prefixes.
Prefixes No charge. Buy transit per Mb/s per
month for routes not know
Public IP EBGP from non-transit AS’s
Address Sta
Cabrillo
t ic CENIC (non-transit AS) Google
De
fau Redistribute
lt
static Commodity
Peer
MED LocPref SVL-Agg1
SVL SAC
AS and EBGP
Public IP P
UCSC EBG
Address Hurricane Elec
EBGP
Fully-meshed IBGP
Commodity
AS and EBGP Peer
Public IP UCLA
Address LAX RVR
LAX-Agg1
tic
Sta Comcast
lt IGP: IS-IS used for next-hop reachability
fau
Public IP De Commodity
Address
EBGP
Cuesta Peer
Non-transit. You can get to our prefixes and
we can get to your prefixes. No charge.
Note: Non-customer prefixes (networks connecting peers) are not included in EBGP updates to peers.
IGP is not redistributed into IS-IS and IS-IS is not redistributed into BGP. 115
Note: This diagram is by no means accurate but only a very simplified representation of an AS.
Peer Groups
Filtering BGP Updates
Additional Attribute Examples
These sections are fairly straight forward. Please read
this material on your own.
116
Peer Groups
In BGP, many neighbors are often configured with the same update policies
(for example, they have the same filtering applied).
On a Cisco Systems router, neighbors with the same update policies can be
grouped into peer groups to simplify configuration and, more importantly, to
make updating more efficient and improve performance.
Peer group – A group of BGP neighbors of the router being configured that
all of the same update policies.
A neighboring router can only be a part of one peer group.
When you have many peers, this approach is highly recommended.
You can use neighbor peer-group-name peer-group or neighbor peer-
group command, the neighbor ip-address peer-group peer-group-name 117
Router C
120
BGP may receive a high number of routing updates.
To optimize BGP configuration, route filtering may be applied.
Filter lists, prefix lists, and route maps can be applied to either incoming or outgoing
BGP information, or in any combination.
Incoming prefix list, filter list, and route map must all permit the routes that are
received from a neighbor before they will be accepted into the BGP table.
Outgoing routes must pass the outgoing filter list, prefix list, and route map
before they will be transmitted to the neighbor.
Redistribution from an IGP into BGP, the routes must successfully pass any prefix list
or route map applied to the redistribution process before the route is injected into the
BGP table.
121
BGP Filtering Using Prefix Lists
123
0.0.0.0/0
Weight=100
0.0.0.0/0
Weight=150
100
125
neighbor weight
command
126
Before modifying WEIGHT.
With WEIGHTs equal, E1 prefers ISP2
because of shorter AS_PATH
E1#show ip bgp
E1#show ip route
127
AS 100
AS 1 (E2)
(ISP1) 1000
Higher 2000
weight
preferred
E1
E1#show ip route
E2#show ip route
E1#show ip route
E2#show ip route
134
EX#show ip bgp
EX#show ip route
135
MED (Multi-Exit Discriminator) Attribute
WLam
Weight
Local Preference
as path
med
New Topology
No ISP2
ISP1 prefers path to 128.0.0.0/7 via E1
AS 100 wants ISP1 to prefer path to 128.0.0.0/7 via E2 136
MED (Multi-Exit Discriminator) Attribute
WLam
Weight
Local Preference
as path
med
The multi-exit discriminator (MED) attribute is a hint to external neighbors about the
preferred path into an AS when there are multiple entry points into the AS.
A lower MED value is preferred over a higher MED value.
The default value of the MED attribute is 0.
Unlike local preference, the MED attribute is exchanged between AS’s, but a MED
attribute that comes into an AS does not leave the AS. 137
ISP1#show ip bgp
ISP1#show ip route
Currently…
138
E1(config)#router bgp 100
E1(config-router)#neighbor 10.1.1.2 route-map SETMEDOUT out
139
ISP1#show ip bgp
MED is sometimes referred to as the metric
Network Next Hop Metric LocPrf Weight Path
*> 99.0.0.0 0.0.0.0 0 32768 i
* 128.107.0.0/19 10.1.1.1 50 0 100 i
*> 10.1.1.5 10 0 100 i
*> 180.0.0.0 0.0.0.0 0 32768 i
ISP1#show ip route
ISP1(config)#router bgp 1
ISP1(config-router)#network 99.0.0.0
ISP1(config-router)#neighbor 10.1.1.1 route-map set-99 out
ISP1(config-router)#neighbor 10.1.1.5 route-map set-99 out
142
ISP1(config)#ip prefix-list only-99 seq 5 permit 99.0.0.0/8
ISP2(config)#inter loop 99
ISP2(config-if)#ip add 99.0.0.1 255.0.0.0
ISP2(config)#router bgp 1
ISP2(config-router)#network 99.0.0.0
ISP2(config-router)#neighbor 192.168.1.1 route-map set-99 out
E1#show ip route
E2#show ip route
EX#show ip route
146
CIS 185 CCNP ROUTE
Ch. 6 Border Gateway Protocol Solution
for ISP Connectivity – Part 2
Rick Graziani
Cabrillo College
[email protected]