|
Overview:
Local preference is an indication to the AS about which path is preferred to exit the AS in order to reach a certain network. A path with a higher local preference is more preferred. The default value for local preference is 100. The metric attribute which is also called Multi_exit_discriminator (MED) is a hint to external neighbors about the preferred path into an AS. This is a dynamic way to influence another AS on which way to choose in order to reach a certain route given that we have multiple entry points into that AS. A lower value of a metric is more preferred. Unlike local preference, metric is exchanged between ASs. A metric is carried into an AS but does not leave the AS.
Our Diagram:

***************************************************************** CHANGE LOCAL PREFERENCE ON R2 ***************************************************************** ================================================ R2 config =================================================
router bgp 1 no synchronization bgp router-id 2.2.2.2 bgp default local-preference 500 network 2.2.2.2 mask 255.255.255.255 network 10.1.1.0 mask 255.255.255.0 network 10.1.2.0 mask 255.255.255.0 network 10.1.3.0 mask 255.255.255.0 neighbor 1.1.1.1 remote-as 1 neighbor 1.1.1.1 ebgp-multihop 255 neighbor 1.1.1.1 update-source Loopback0 neighbor 1.1.1.1 route-reflector-client neighbor 3.3.3.3 remote-as 1 neighbor 3.3.3.3 ebgp-multihop 255 neighbor 3.3.3.3 update-source Loopback0 neighbor 3.3.3.3 route-reflector-client neighbor 4.4.4.4 remote-as 2 neighbor 4.4.4.4 ebgp-multihop 255 neighbor 4.4.4.4 update-source Loopback0 no auto-summary ! ip classless ip route 1.1.1.1 255.255.255.255 10.1.1.1 ip route 3.3.3.3 255.255.255.255 10.1.3.2 ip route 4.4.4.4 255.255.255.255 10.1.2.2
r6#traceroute 1.1.1.1 Type escape sequence to abort. Tracing the route to 1.1.1.1 1 10.1.6.1 4 msec 0 msec 4 msec 2 10.1.4.1 128 msec 36 msec 36 msec 3 10.1.3.1 [AS 1] 36 msec 32 msec 36 msec 4 10.1.1.1 [AS 1] 48 msec * 48 msec r6#

r1#traceroute 6.6.6.6 Type escape sequence to abort. Tracing the route to 6.6.6.6 1 10.1.1.2 16 msec 16 msec 16 msec 2 10.1.2.2 32 msec 32 msec 32 msec 3 10.1.5.2 [AS 2] 48 msec 48 msec 44 msec 4 10.1.6.2 [AS 2] 44 msec * 40 msec r1#
================================================ R3 Output: =================================================

r3#traceroute 6.6.6.6 Type escape sequence to abort. Tracing the route to 6.6.6.6 1 10.1.3.1 16 msec 20 msec 20 msec 2 10.1.2.2 36 msec 32 msec 28 msec 3 10.1.5.2 [AS 2] 28 msec 28 msec 28 msec 4 10.1.6.2 [AS 2] 28 msec * 24 msec r3#
***************************************************************** CHANGE MED *****************************************************************
================================================ R6 Return traffic: =================================================
r6#traceroute 1.1.1.1 Type escape sequence to abort. Tracing the route to 1.1.1.1 1 10.1.6.1 4 msec 0 msec 4 msec 2 10.1.4.1 128 msec 36 msec 36 msec 3 10.1.3.1 [AS 1] 36 msec 32 msec 36 msec 4 10.1.1.1 [AS 1] 48 msec * 48 msec r6#
================================================ R2 Change med - config: =================================================
router bgp 1 no synchronization bgp router-id 2.2.2.2 bgp default local-preference 500 network 2.2.2.2 mask 255.255.255.255 network 10.1.1.0 mask 255.255.255.0 network 10.1.2.0 mask 255.255.255.0 network 10.1.3.0 mask 255.255.255.0 neighbor 1.1.1.1 remote-as 1 neighbor 1.1.1.1 ebgp-multihop 255 neighbor 1.1.1.1 update-source Loopback0 neighbor 1.1.1.1 route-reflector-client neighbor 3.3.3.3 remote-as 1 neighbor 3.3.3.3 ebgp-multihop 255 neighbor 3.3.3.3 update-source Loopback0 neighbor 3.3.3.3 route-reflector-client neighbor 4.4.4.4 remote-as 2 neighbor 4.4.4.4 ebgp-multihop 255 neighbor 4.4.4.4 update-source Loopback0 neighbor 4.4.4.4 route-map setmetricout out <=== Change metric with route-map no auto-summary ! ip classless ip route 1.1.1.1 255.255.255.255 10.1.1.1 ip route 3.3.3.3 255.255.255.255 10.1.3.2 ip route 4.4.4.4 255.255.255.255 10.1.2.2 no ip http server ! route-map setmetricout permit 10 <=== Change metric with route-map set metric 100
================================================ R3 Change med - config: =================================================
! router bgp 1 no synchronization bgp router-id 3.3.3.3 network 3.3.3.3 mask 255.255.255.255 network 10.1.3.0 mask 255.255.255.0 network 10.1.4.0 mask 255.255.255.0 neighbor 2.2.2.2 remote-as 1 neighbor 2.2.2.2 ebgp-multihop 255 neighbor 2.2.2.2 update-source Loopback0 neighbor 2.2.2.2 route-map setnexthop in neighbor 5.5.5.5 remote-as 2 neighbor 5.5.5.5 ebgp-multihop 255 neighbor 5.5.5.5 update-source Loopback0 neighbor 5.5.5.5 route-map setmetricout out <=== Change metric with route-map no auto-summary ! ip classless ip route 2.2.2.2 255.255.255.255 10.1.3.1 ip route 5.5.5.5 255.255.255.255 10.1.4.2 no ip http server ip as-path access-list 1 permit ^2$ ! access-list 1 permit any route-map setmetricout permit 10 <=== Change metric with route-map set metric 200 ! route-map setnexthop permit 10 set ip next-hop peer-address ! route-map setweightin permit 10 match as-path 1 set ip next-hop peer-address set weight 100 !
================================================ R6 output: =================================================

================================================ R6 new trace: =================================================
r6#traceroute 1.1.1.1 Type escape sequence to abort. Tracing the route to 1.1.1.1 1 10.1.6.1 4 msec 0 msec 0 msec 2 10.1.5.1 20 msec 20 msec 16 msec 3 10.1.2.1 36 msec 32 msec 32 msec 4 10.1.1.1 [AS 1] 52 msec * 48 msec r6#
Notice path has now changed!!!
================================================ R6 trace to new loop on R3 =================================================
r6#traceroute 9.9.9.9 Type escape sequence to abort. Tracing the route to 9.9.9.9 1 10.1.6.1 4 msec 0 msec 0 msec 2 10.1.5.1 20 msec 20 msec 20 msec 3 10.1.2.1 32 msec 32 msec 36 msec 4 10.1.3.2 [AS 1] 48 msec * 48 msec r6#
|