My Countingdown

Thursday, December 15, 2011

Lab 10. BGP using MED


Now, we’ll try to do lab using MED. MED is used to influence outbound traffic. For example this lab if we see R100 to R500 will go via R1 and R4 because the AS Path is smaller than other way with assumption all marks is default. Please refer to BGP summary regarding path selection in BGP! http://pursuingmydestiny.blogspot.com/2011/12/bgp-summary.html

Let’s make the lab

R1#
interface loopback 0
  ip address 1.1.1.1 255.255.255.255
interface f0/0
  ip address 14.14.14.1 255.255.255.0
  no shu
interface f0/1
  ip address 12.12.12.1 255.255.255.0
  no shu
interface s0/0
  ip address 110.110.110.1 255.255.255.0
  no shut
router bgp 12
  neighbor 12.12.12.2 remote-as 12
  neighbor 12.12.12.2 next-hop-self
  neighbor 14.14.14.4 remote-as 34
  neighbor 110.110.110.10 remote-as 100
  network 1.1.1.1 mask 255.255.255.255

R2#
interface loopback 0
  ip address 2.2.2.2 255.255.255.255
interface f0/0
  ip address 23.23.23.2 255.255.255.0
  no shu
interface f0/1
  ip address 12.12.12.2 255.255.255.0
  no shu
router bgp 12
  neighbor 12.12.12.1 remote-as 12
  neighbor 12.12.12.1 next-hop-self
  neighbor 23.23.23.3 remote-as 34
  network 2.2.2.2 mask 255.255.255.255
 
R3#
interface loopback 0
  ip address 3.3.3.3 255.255.255.255
interface f0/0
  ip address 23.23.23.3 255.255.255.0
  no shu
interface f0/1
  ip address 34.34.34.3 255.255.255.0
  no shu
router bgp 34
  neighbor 23.23.23.2 remote-as 12
  neighbor 34.34.34.4 remote-as 34
  neighbor 34.34.34.4 next-hop-self
  network 3.3.3.3 mask 255.255.255.255

R4#
interface loopback 0
  ip address 4.4.4.4 255.255.255.255
interface f0/0
  ip address 14.14.14.4 255.255.255.0
  no shu
interface f0/1
  ip address 34.34.34.4 255.255.255.0
  no shu
interface s0/0
  ip address 150.150.150.4 255.255.255.0
  no shut
router bgp 34
  neighbor 14.14.14.1 remote-as 12
  neighbor 34.34.34.3 remote-as 34
  neighbor 34.34.34.3 next-hop-self
  neighbor 150.150.150.50 remote-as 500
  network 4.4.4.4 mask 255.255.255.255

R100#
interface loopback 0
  ip address 10.10.10.10 255.255.255.255
interface s0/0
  ip address 110.110.110.10 255.255.255.0
  no shut
router bgp 100
  neighbor 110.110.110.1 remote-as 12
  network 10.10.10.10 mask 255.255.255.255

R500#
interface loopback 0
  ip address 50.50.50.50 255.255.255.255
interface s0/0
  ip address 150.150.150.50 255.255.255.0
  no shut
router bgp 500
  neighbor 150.150.150.4 remote-as 34
  network 50.50.50.50 mask 255.255.255.255

Let’s check routing table to R500 in R1

R1(config-router)#do sh ip bgp 50.50.50.50
BGP routing table entry for 50.50.50.50/32, version 7
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to update-groups:
        1    2
  34 500
    12.12.12.2 from 12.12.12.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal
  34 500
    14.14.14.4 from 14.14.14.4 (4.4.4.4)
      Origin IGP, localpref 100, valid, external, best   --- > best path choose by default

Let’s check BGP path selection from R100 to R500

R100(config-router)#do tracer 50.50.50.50 sour 10.10.10.10
Type escape sequence to abort.
Tracing the route to 50.50.50.50

  1 110.110.110.1 4 msec 72 msec 68 msec
  2 14.14.14.4 60 msec 48 msec 88 msec
  3 150.150.150.50 160 msec *  60 msec

So let’s make change path selection from R100 to R500 via R1>R2>R3>R4…
There are 2 solution by influencing inbound traffic
  1. Using MED attribute. Lowest MED will be preferred
  2. Using AS-PATH. Shortest AS-PATH will be preferred
Let’s use MED first. Using weight & local preference applied in R1 but using MED & AS-PATH applied in R4. Ask your self, why like that??? J 

R4#
router bgp 34
  neighbor 14.14.14.1 route-map MED_OUT out

route-map MED_OUT
  set metric 200

Then do clear ip bgp to change routing for path selection. Let’s check in R1. Why in R1??? Because MED influence inbound traffic to R3 from R1. So it will change best path selection in R1 to R500.

R1(config-router)#do sh ip bgp 50.50.50.50
BGP routing table entry for 50.50.50.50/32, version 14
Paths: (2 available, best #1, table Default-IP-Routing-Table)
Flag: 0x4860
  Not advertised to any peer
  34 500
    12.12.12.2 from 12.12.12.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal, best
  34 500
    14.14.14.4 from 14.14.14.4 (4.4.4.4)
      Origin IGP, metric 200, localpref 100, valid, external

Make sure the trace route is via R1>R2>R3>R4

R100(config-router)#do tracer 50.50.50.50 sour 10.10.10.10
Type escape sequence to abort.
Tracing the route to 50.50.50.50

  1 110.110.110.1 0 msec 108 msec 0 msec
  2 12.12.12.2 96 msec 48 msec 76 msec
  3 23.23.23.3 156 msec 92 msec 108 msec
  4 34.34.34.4 112 msec 180 msec 76 msec
  5 150.150.150.50 192 msec *  84 msec

No comments:

Post a Comment