My Countingdown

Thursday, December 15, 2011

Lab 11. BGP using AS-PATH


Now, let’s use AS-PATH for influencing path selection from R100 to R500.

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 by default

Let’s check BGP path selection 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

Now let’s use AS-PATH

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

route-map AS_PATH_OUT
  set as-path prepend 34 34 34

Then do clear ip bgp to change routing for path selection. Let’s check in R1.

R1(config-router)#do sh ip bgp 50.50.50.50
BGP routing table entry for 50.50.50.50/32, version 26
Paths: (2 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Advertised to update-groups:
        1
  34 500
    12.12.12.2 from 12.12.12.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal, best   ---> best path after change AS-PATH
  34 34 34 34 500          --- > the AS-PATH will be long so will not choose
    14.14.14.4 from 14.14.14.4 (4.4.4.4)
      Origin IGP, localpref 100, valid, external

R1(config-router)#do sh ip bgp
BGP table version is 27, 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
*> 1.1.1.1/32       0.0.0.0                  0         32768 i
*>i2.2.2.2/32       12.12.12.2               0    100      0 i
*  3.3.3.3/32       14.14.14.4                             0 34 34 34 34 i
*>i                 12.12.12.2               0    100      0 34 i
*  4.4.4.4/32       14.14.14.4               0             0 34 34 34 34 i
*>i                 12.12.12.2               0    100      0 34 i
*> 10.10.10.10/32   110.110.110.10           0             0 100 i
*>i50.50.50.50/32   12.12.12.2               0    100      0 34 500 i
*                   14.14.14.4                             0 34 34 34 34 500 i

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

R100(config)#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 12 msec 24 msec
  2 12.12.12.2 68 msec 112 msec 84 msec
  3 23.23.23.3 104 msec 120 msec 36 msec
  4 34.34.34.4 108 msec 76 msec 104 msec
  5 150.150.150.50 80 msec *  124 msec

No comments:

Post a Comment