Saturday, June 23, 2012

Using BGP MED Attribute


Using BGP MED Attribute
TOPOLOGY
The objective is to influence the routers in AS 65002 to prefer the path to R1 to reach network 172.16.0.0/24 using the BGP MED Attribute.
Current path preferred by R3 and R4 no attributes are modified.
R3
In R3 to reach the network 172.16.0.0/24 the next hop is 10.1.1.1 (Best R1)


R4
In R4 to reach the network 172.16.0.0/24 the next hop 10.2.2.2 (Best R2)
To influence the incoming from AS 65002 to prefer 10.1.1.1 as the best path to reach the
network 172.16.0.0/24, we can use a route-map.

R1(config)#router bgp 65001
R1(config-router)#neighbor 10.1.1.3 route-map MED out
R1(config-router)#exit
R1(config)#route-map MED
R1(config-route-map)#set metric 150

R2(config)#router bgp 65001
R2(config-router)#neighbor 10.2.2.4 route-map MED out
R2(config-router)#exit
R2(config)#route-map MED
R2(config-route-map)#set metric 160

Verify:


Test:
R3#traceroute 172.16.0.1

Type escape sequence to abort.
Tracing the route to 172.16.0.1

  1 10.1.1.1 44 msec *  24 msec
R3#traceroute 172.16.0.2

Type escape sequence to abort.
Tracing the route to 172.16.0.2

  1 10.1.1.1 52 msec 28 msec 48 msec
  2 172.16.0.2 [AS 65001] 68 msec *  48 msec

R4#traceroute 172.16.0.1

Type escape sequence to abort.
Tracing the route to 172.16.0.1

  1 192.168.30.3 56 msec 32 msec 24 msec
  2 10.1.1.1 76 msec *  104 msec
R4#traceroute 172.16.0.2

Type escape sequence to abort.
Tracing the route to 172.16.0.2

  1 192.168.30.3 80 msec 32 msec 24 msec
  2 10.1.1.1 36 msec 52 msec 36 msec
  3 172.16.0.2 [AS 65001] 44 msec *  76 msec

Now both R3 and R4 in AS 65002 prefer the path going to R1 as the metric for is set to 150 (the lowest MED value means more preferred)

Shutting down R1’s interface serial 1/0 will make AS 65002 to prefer the link to R2 with MED 160 as the backup link. Let’s see the result:




R1#
*Mar  1 01:23:25.879: %SYS-5-CONFIG_I: Configured from console by console
*Mar  1 01:23:26.095: %LINK-5-CHANGED: Interface Serial1/0, changed state to administratively down
R1#
*Mar  1 01:23:27.095: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down



Now the next hop 10.2.2.2 is the best path with a MED of 160 works as a backup once the link to R1 is down.

No comments:

Post a Comment