Wednesday, July 30, 2014

Lab 10 - BGP Bestpath Selection - Weight

This lab and the next several labs will focus on BGP the bestpath selection parameters used by BGP to choose the prefer path to a given prefix. This lab will focus on the WEIGHT attribute which is the first attribute look at by the best path algorithm.

Concepts covered
-BGP path selection
-BGP Weight
-Applying attributes to prefixes using route-maps

Topology



GNS3 files: Link


Solution

Let's being by setting up our basic BGP peering

R1(config)#router bgp 10
R1(config-router)#neighbor 192.168.21.2 remote
R1(config-router)#neighbor 192.168.21.2 remote-as 20
R1(config-router)#neighbor 192.168.13.3 remote-as 30

R2(config)#router bgp 20
R2(config-router)#neighbor 192.168.21.1 remote-as 10
R2(config-router)#neighbor 192.168.24.4 remote-as 40

R3(config)#router bgp 30
R3(config-router)#neighbor 192.168.13.1 remote-as 10
R3(config-router)#neighbor 192.168.34.4 remote-as 40

R4(config)#router bgp 40
R4(config-router)#neighbor 192.168.24.2 remote-as 20
R4(config-router)#neighbor 192.168.34.3 remote-as 30

Now let's advertise our loopback addresses

R1(config)#router bgp 10
R1(config-router)#network 11.11.11.0 mask 255.255.255.0

R2(config)#router bgp 20
R2(config-router)#network 22.22.22.0 mask 255.255.255.0

R3(config)#router bgp 30
R3(config-router)#network 33.33.33.0 mask 255.255.255.0

R4(config)#router bgp 40
R4(config-router)#network 44.44.44.0 mask 255.255.255.0

To apply the WEIGHT attribute to the AS 40 prefixes we will use an as-path access list in concert with a route map and apply that route map to the neighbor statement for our preferred path

R1(config)#ip as-path access-list 1 permit _40$

R1(config)#routerrouter bgp 10
R1(config-router)#neighbor 192.168.13.3 route-map PREFER_AS30 in

After clearing the BGP neighbors to flush the BGP RIB we get the following results.

R1#sh ip bgp
BGP table version is 5, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network                 Next Hop               Metric LocPrf Weight Path
 *>  11.11.11.0/24     0.0.0.0                        0         32768 i
 *>  22.22.22.0/24     192.168.21.2             0             0 20 i
 *                                   192.168.13.3                             0 30 40 20 i
 *   33.33.33.0/24      192.168.21.2                            0 20 40 30 i
 *>                                192.168.13.3              0             0 30 i
 *   44.44.44.0/24      192.168.21.2                            0 20 40 i
 *>                                  192.168.13.3                     1000 30 40 I

And when we trace

R1#traceroute 44.44.44.44 source loopback 10
Type escape sequence to abort.
Tracing the route to 44.44.44.44
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.13.3 28 msec 48 msec 24 msec
  2 192.168.34.4 32 msec *  72 msec


Sources:


No comments:

Post a Comment