My Countingdown

Thursday, December 15, 2011

Lab 9. BGP using Local Preference


We already did using weight to influence outbound traffic from R100 to R500 via R1>R2>R3>R4. Now let’s try using local preference.

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 to go to 50.50.50.50 from R1

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

Let’s use local preference so traffic to R500 will route via R1>R2>R3>R4 from R100

R1#
router bgp 12
   neighbor 12.12.12.2 route-map LOCAL_PREF in

route-map LOCAL_PREF permit 10
  set local-preference 200

Again you need to clear ip bgp first to get new change BGP best path. Please be patient this is BGP bro!

R1(config-route-map)#do clear ip bgp *

Let’s check the path selection already change via R2.

R1(config-route-map)#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)
Flag: 0x820
  Advertised to update-groups:
        1
  34 500
    14.14.14.4 from 14.14.14.4 (4.4.4.4)
      Origin IGP, localpref 100, valid, external
  34 500
    12.12.12.2 from 12.12.12.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 200, valid, internal, best

Make sure trace route from R100 to R500 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 48 msec 92 msec 16 msec
  2 12.12.12.2 32 msec 92 msec 92 msec
  3 23.23.23.3 128 msec 104 msec 156 msec
  4 34.34.34.4 32 msec 108 msec 124 msec
  5 150.150.150.50 40 msec *  108 msec

No comments:

Post a Comment