So as can be seen we have no NBMA in this topology, only Serial Links and an Ethernet segment, which almost makes feel naked without a Frame-Switch in there somewhere.
So to begin, my last post included on the tail end a “sh ip bgp” to demonstrate something with a bunch of loopbacks being advertied via network statements, however for this lab I had to remove those, and instead R4 now has Lo4 (4.4.4.4) and Lo44 (44.4.4.4) while the other routers have been cleansed of the network statements and bgp tables reset with “clear ip bgp * soft out”.
Now to start off, I’d like to point out that MED is the attribute I pointed out in an earlier post regarding attributes, that IT IS A “OPTIONAL NON-TRANSIT ATTRIBUTE” ! MED is THE ONLY attribute we have looked at so far that is both optional AND non-transit, so wr mem that to your brain for exam day!
MED, which is another way of saying Metric, is used to advertise routes to a BGP Speaker manipulated by Route-Maps (and ACL’s to call out networks) to a remote BGP Speaker. You can either send all traffic over a single link, multiple subnets over one link and multiple over the other, etc.
So the name “Multi-Exit Discriminator” is really exactly right, because we are manipulating the multiple exits for these route advertisements, and using route-maps to discriminate them to the remote router.
To begin, I first would like to review R3’s current view (pre-MED) of R4’s advertisement:
R3#sh ip bgp
BGP table version is 11, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
* 4.4.4.4/32 172.12.23.1 0 124 i
*> 172.12.13.1 0 124 i
* 44.4.4.4/32 172.12.23.1 0 124 i
*> 172.12.13.1 0 124 i
R3#
That through me for a loop at first glance, but it is network “13” and “23” so it is seeing the advertisement from both R1 and R2, however its determined the Best Path for both networks is through R1.
Why is this?
Let’s look at the routes:
R3#sh ip bgp 4.4.4.4
BGP routing table entry for 4.4.4.4/32, version 4
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Advertised to update-groups:
1
124
172.12.23.1 from 172.12.23.1 (2.2.2.2)
Origin IGP, localpref 100, valid, external
124
172.12.13.1 from 172.12.13.1 (1.1.1.1)
Origin IGP, localpref 100, valid, external, best
R3#sh ip bgp 44.4.4.4
BGP routing table entry for 44.4.4.4/32, version 6
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Advertised to update-groups:
1
124
172.12.23.1 from 172.12.23.1 (2.2.2.2)
Origin IGP, localpref 100, valid, external
124
172.12.13.1 from 172.12.13.1 (1.1.1.1)
Origin IGP, localpref 100, valid, external, best
R3#
Without the MED configured, going all the way down the list of 10 considered BGP Best Path attributes, this actually made it to #10 – The BGP RID (Lowest RID Preferred). That is why I said in my previous post, you will “almost” never see it get THAT far down the list.
So to split up these two networks, so that 4.4.4.4/32 continues to use the connection to R1, we will configure MED so that traffic from 44.4.4.4/32 is directed out R2, and use ACL’s to be called out by “Mirrored” Route-Maps on router R1 and R2 to help manipulate Path Selection.
By default, the lowest metric / MED will be the Preferred Path, so let’s start by setting the ACL’s and mirrored Route-Maps:
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#access-list 4 permit 4.4.4.4
R1(config)#access-list 44 permit 44.4.4.4
R1(config)#
R1(config)#route-map MedSet permit 10
R1(config-route-map)#match ip address 4
R1(config-route-map)#set ?
as-path Prepend string for a BGP AS-path attribute
automatic-tag Automatically compute TAG value
clns OSI summary address
comm-list set BGP community list (for deletion)
community BGP community attribute
dampening Set BGP route flap dampening parameters
default Set default information
extcommunity BGP extended community attribute
interface Output interface
ip IP specific information
ipv6 IPv6 specific information
level Where to import route
local-preference BGP local preference path attribute
metric Metric value for destination routing protocol
metric-type Type of metric for destination routing protocol
mpls-label Set MPLS label for prefix
nlri BGP NLRI type
origin BGP origin code
tag Tag value for destination routing protocol
traffic-index BGP traffic classification number for accounting
vrf Define VRF name
weight BGP weight for routing table
R1(config-route-map)#set metric ?
+/-<metric> Add or subtract metric
<0-4294967295> Metric value or Bandwidth in Kbits per second
<cr>
R1(config-route-map)#set metric 100
R1(config-route-map)#route-map MedSet permit 20
R1(config-route-map)#match ip add 44
R1(config-route-map)#set metric 200
R1(config-route-map)#^Z
R1#wr
Building configuration…
*Mar 31 06:58:04.987: %SYS-5-CONFIG_I: Configured from console by console[OK]
R1#
I wanted to show R1 first with the output to show where the metric is “set” for the sequence # that is matching the ACL / network, and the modifiers for it being #’s for metric.
So on R2 I will mirror the command, so 44.4.4.4 has the lower metric, this will be more straight forward, and without the clutter to demonstrate:
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#access-list 4 permit 4.4.4.4
R2(config)#access-list 44 permit 44.4.4.4
R2(config)#
R2(config)#route-map MedSet permit 10
R2(config-route-map)#match ip add 4
R2(config-route-map)#set metric 200
R2(config-route-map)#route-map MedSet permit 20
R2(config-route-map)#match ip add 44
R2(config-route-map)#set metric 100
R2(config-route-map)#^Z
R2#wr
Building configuration…
It is simply that easy. We aren’t done with the entirety of the configuration, but a bulk of it. Now we just have to apply the Route-Map, and that is in the router BGP configuration:
R2(config)#router bgp 124
R2(config-router)#?
Router configuration commands:
address-family Enter Address Family command mode
aggregate-address Configure BGP aggregate entries
auto-summary Enable automatic network number summarization
bgp BGP specific commands
default Set a command to its defaults
default-information Control distribution of default information
default-metric Set metric of redistributed routes
distance Define an administrative distance
distribute-list Filter networks in routing updates
exit Exit from routing protocol configuration mode
help Description of the interactive help system
maximum-paths Forward packets over multiple paths
neighbor Specify a neighbor router
network Specify a network to announce via BGP
no Negate a command or set its defaults
redistribute Redistribute information from another routing protocol
synchronization Perform IGP synchronization
table-map Map external entry attributes into routing table
template Enter template command mode
timers Adjust routing timers
R2(config-router)#neighbor 172.12.23.3 ?
activate Enable the Address Family for this Neighbor
advertise-map specify route-map for conditional advertisement
advertisement-interval Minimum interval between sending BGP routing updates
allowas-in Accept as-path with my AS present in it
capability Advertise capability to the peer
default-originate Originate default route to this neighbor
description Neighbor specific description
disable-connected-check One-hop away EBGP peer using loopback address
distribute-list Filter updates to/from this neighbor
dmzlink-bw Propagate the DMZ link bandwidth
ebgp-multihop Allow EBGP neighbors not on directly connected
networks
fall-over session fall on peer route lost
filter-list Establish BGP filters
inherit Inherit a template
local-as Specify a local-as number
maximum-prefix Maximum number of prefixes accepted from this peer
next-hop-self Disable the next hop calculation for this neighbor
next-hop-unchanged Propagate the iBGP paths’s next hop unchanged for
this neighbor
password Set a password
peer-group Member of the peer-group
prefix-list Filter updates to/from this neighbor
remote-as Specify a BGP neighbor
remove-private-as Remove private AS number from outbound updates
route-map Apply route map to neighbor
route-reflector-client Configure a neighbor as Route Reflector client
send-community Send Community attribute to this neighbor
shutdown Administratively shut down this neighbor
soft-reconfiguration Per neighbor soft reconfiguration
timers BGP per neighbor timers
translate-update Translate Update to MBGP format
transport Transport options
ttl-security BGP ttl security check
unsuppress-map Route-map to selectively unsuppress suppressed
routes
update-source Source of routing updates
version Set the BGP version to match a neighbor
weight Set default weight for routes from this neighbor
R2(config-router)#neighbor 172.12.23.3 route-map MedSet ?
in Apply map to incoming routes
out Apply map to outbound routes
R2(config-router)#neighbor 172.12.23.3 route-map MedSet out
R2(config-router)#
Please excuse the gigantic output here, but I think this demonstrates a recurring theme, that we will be using the neighbor statement quite a bit to set attributes for specific neighbors.
So set the ACL’s to call out in the route-maps, create the route-maps with the desired metric applied with “set metric #” in the correct sequence (“sh route” to view route-map sequences), and then apply it in BGP configuration mode with the neighbor command.
(A side note in Route-Maps, they must always have a direction set when being applied, generally I have used “out” as the value for Redistribution and Distribute-Lists)
The above shows that when this router receives those two routes, it will assign them that metric or “MED” on their way to R3, which will then determine R2 is the Best Path for route 44.4.4.4.
So lets do the same to R1, and then check R3 to see what we have going on:
R1(config)#router bgp 124
R1(config-router)#neighbor 172.12.13.3 route-map MedSet out
R1(config-router)#
ASR#3
[Resuming connection 3 to r3 … ]
R3#sh ip bgp
BGP table version is 11, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
* 4.4.4.4/32 172.12.23.1 200 0 124 i
*> 172.12.13.1 0 124 i
* 44.4.4.4/32 172.12.23.1 100 0 124 i
*> 172.12.13.1 0 124 i
So as can be seen, just applying it does not constitute an update in BGP, so we have to issue a “clear ip bgp * soft out” on each and have another look at R3:
R1#clear ip bgp * soft out
R1#
ASR#2
[Resuming connection 2 to r2 … ]
[OK]
R2#
R2#clear ip bgp * soft out
R2#
ASR#3
[Resuming connection 3 to r3 … ]
R3#sh ip bgp
BGP table version is 13, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
* 4.4.4.4/32 172.12.23.1 200 0 124 i
*> 172.12.13.1 100 0 124 i
*> 44.4.4.4/32 172.12.23.1 100 0 124 i
* 172.12.13.1 200 0 124 i
R3#
And there it is, MED or really Metric has become the tie breaker (#6 on tie-breaker list) for the different networks, and will now send traffic to R1 and R2 exactly how we intended it to.
To verify even further, you can use the extended “sh ip bgp” command for a network to show its path Metrics or “MED”s:
R3#sh ip bgp 4.4.4.4
BGP routing table entry for 4.4.4.4/32, version 13
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Advertised to update-groups:
1
124
172.12.23.1 from 172.12.23.1 (2.2.2.2)
Origin IGP, metric 200, localpref 100, valid, external
124
172.12.13.1 from 172.12.13.1 (1.1.1.1)
Origin IGP, metric 100, localpref 100, valid, external, best
R3#
***So to summarize, MED is a term for setting BGP Metric via applying a route-map in the neighbor statement to a remote BGP Speaking router. The router that originates the routes has no configuration done to it at all (as seen) or the remote router, only the connected routers.***
I did not see that coming! Coming up next is Local Preference attribute discussion, which I am double timing the Cisco studies to try and make my ROUTE exam date of April 28th, so that post will hopefully be up sometime pretty quick here along with some others yet tonight until my brain breaks 🙂