BGP Attributes: MED
· Multi-Exit Discriminator, MED, sometimes called the Metric for BGP.
· Since it is a metric, always lower value is preferred
· Unlike local preference, a metric is exchanged between ASs.
· Metric is a Non-transitive attribute, simply means if AS1 sends it to AS2, AS2 will not send it to another AS.
· Metric default value is 0, which means if AS1 sends an update to AS2, without setting the MED value, AS2 will see a metric of 0.
R2---------------R1--------------R3
· R2: Ser1/1 – 10.1.12.2 ßà R1: Ser1/1 – 10.1.12.1
· R1: Ser1/0 – 100.1.13.1 ßà R3: Ser1/0 – 100.1.13.3
· AS 100: R1
· AS 200: R2
· AS 300: R3
· eBGP between R1 & R2
· eBGP between R1 & R3
· Created a loopback 23.23.23.23/32 on R2 and R3 and advertised into BGP.
· Now, R1 gets 2 updates for the same prefix, one from R2 and another one from R3
· Let’s see how to modify MED attribute in order to change the default path
BGP Configs:
R3(config-router)#do show run | begin router bgp 300
router bgp 300
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
network 23.23.23.23 mask 255.255.255.255
neighbor 100.1.13.1 remote-as 100
no auto-summary
!
R2(config-router)#do show run | begin router bgp 200
router bgp 200
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 23.23.23.23 mask 255.255.255.255
neighbor 10.1.12.1 remote-as 100
no auto-summary
!
R1(config-router)#do show run | begin router bgp 100
router bgp 100
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
neighbor 10.1.12.2 remote-as 200
neighbor 100.1.13.3 remote-as 300
no auto-summary
!
R3(config-router)#do show ip bgp sum
BGP router identifier 3.3.3.3, local AS number 300
BGP table version is 2, main routing table version 2
1 network entries using 117 bytes of memory
1 path entries using 52 bytes of memory
2/1 BGP path/bestpath attribute entries using 248 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 417 total bytes of memory
BGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
100.1.13.1 4 100 7 7 2 0 0 00:03:41 0
R3(config-router)#
R2(config-router)#do show ip bgp sum
BGP router identifier 2.2.2.2, local AS number 200
BGP table version is 2, main routing table version 2
1 network entries using 117 bytes of memory
2 path entries using 104 bytes of memory
3/1 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 617 total bytes of memory
BGP activity 1/0 prefixes, 2/0 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.12.1 4 100 7 7 2 0 0 00:03:53 1
R2(config-router)#
R1(config-router)#do show ip bgp sum
BGP router identifier 1.1.1.1, local AS number 100
BGP table version is 2, main routing table version 2
1 network entries using 117 bytes of memory
2 path entries using 104 bytes of memory
3/1 BGP path/bestpath attribute entries using 372 bytes of memory
2 BGP AS-PATH entries using 48 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 641 total bytes of memory
BGP activity 1/0 prefixes, 2/0 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.12.2 4 200 8 8 2 0 0 00:04:09 1
100.1.13.3 4 300 8 8 2 0 0 00:04:17 1
R1(config-router)#
R3(config-router)#do show ip bgp
BGP table version is 2, 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
*> 23.23.23.23/32 0.0.0.0 0 32768 i
R3(config-router)#
R2(config-router)#do show ip bgp
BGP table version is 2, local router ID is 2.2.2.2
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
* 23.23.23.23/32 10.1.12.1 0 100 300 i
*> 0.0.0.0 0 32768 i
R2(config-router)#
R1(config-router)#do show ip bgp
BGP table version is 2, local router ID is 1.1.1.1
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
* 23.23.23.23/32 10.1.12.2 0 0 200 i
*> 100.1.13.3 0 0 300 i
R1(config-router)#
· R1 has chosen the path through R3 to reach the prefix 23.23.23.23/32
· But if R3 doesn’t want this traffic to come from R1, it can try to influence R1 not to choose R3 as the best path.
· Let me configure Higher MED value from R3 to R1 outbound direction, so that R1 prefers the path through R2.
R3(config-router)#route-map MED
R3(config-route-map)#set metric 3333
R3(config-route-map)#router bgp 300
R3(config-router)#neighbor 100.1.13.1 route-map MED out
R3(config-router)#
R1(config-router)#do show ip bgp
BGP table version is 2, local router ID is 1.1.1.1
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
* 23.23.23.23/32 100.1.13.3 3333 0 300 i
*> 10.1.12.2 0 0 200 i
R1(config-router)#
Observations:
· R3 sending the route with MED value of “3333”
· Now, R1 got 2 updates for 23.23.23.23/32; one from R2 which has a MED value 0, and another from R3, which has a MED value 3333.
· R1 has selected the path through R2 to reach 23.23.23.23/32, as it has the lower MED value.
· ***But remember, though R3 has tried to influence the path selection in R1, R1 has the better control of the traffic leaving its own AS.
· Hence, if R1 configures Weight or Local Preference, that comes first in the BGP Best Path Selection and overrides R3’s influence.
No comments:
Post a Comment