|
Overview:
The weight attribute is a Cisco attribute and is local the the router. The weight is the first choice in the best path selection process. It is a value that only makes sense to the specific router and which is not propagated or carried through any of the route updates. A weight can be a number from 0 to 65535. Paths that the router originates have a weight of 32768 by default and other paths have a weight of zero.
Our Diagram:

***************************************************************** Network traffic BEFORE SETTING WEIGHT: *****************************************************************
================================================ R1 config =================================================
router bgp 1 no synchronization bgp router-id 1.1.1.1 network 1.1.1.1 mask 255.255.255.255 network 10.1.1.1 mask 255.255.255.255 neighbor 2.2.2.2 remote-as 1 neighbor 2.2.2.2 ebgp-multihop 255 neighbor 2.2.2.2 update-source Loopback0 neighbor 2.2.2.2 route-map setnexthop in <=== Have to do this else cannot ping 3.3.3.3 as next-hop wrong no auto-summary ! ip classless ip route 2.2.2.2 255.255.255.255 10.1.1.2 no ip http server ! route-map setnexthop permit 10 <=== Have to do this else cannot ping 3.3.3.3 as next-hop wrong set ip next-hop peer-address ! !
================================================= R2 config =================================================
router bgp 1 no synchronization bgp router-id 2.2.2.2 network 2.2.2.2 mask 255.255.255.255 network 10.1.1.0 mask 255.255.255.0 network 10.1.2.0 mask 255.255.255.0 network 10.1.3.0 mask 255.255.255.0 neighbor 1.1.1.1 remote-as 1 neighbor 1.1.1.1 ebgp-multihop 255 neighbor 1.1.1.1 update-source Loopback0 neighbor 1.1.1.1 route-reflector-client neighbor 3.3.3.3 remote-as 1 neighbor 3.3.3.3 ebgp-multihop 255 neighbor 3.3.3.3 update-source Loopback0 neighbor 3.3.3.3 route-reflector-client neighbor 4.4.4.4 remote-as 2 neighbor 4.4.4.4 ebgp-multihop 255 neighbor 4.4.4.4 update-source Loopback0 no auto-summary ! ip classless ip route 1.1.1.1 255.255.255.255 10.1.1.1 ip route 3.3.3.3 255.255.255.255 10.1.3.2 ip route 4.4.4.4 255.255.255.255 10.1.2.2
================================================= R3 config =================================================
router bgp 1 no synchronization bgp router-id 3.3.3.3 network 3.3.3.3 mask 255.255.255.255 network 10.1.3.0 mask 255.255.255.0 network 10.1.4.0 mask 255.255.255.0 neighbor 2.2.2.2 remote-as 1 neighbor 2.2.2.2 ebgp-multihop 255 neighbor 2.2.2.2 update-source Loopback0 neighbor 2.2.2.2 route-map setnexthop in neighbor 5.5.5.5 remote-as 2 neighbor 5.5.5.5 ebgp-multihop 255 neighbor 5.5.5.5 update-source Loopback0 no auto-summary ! ip classless ip route 2.2.2.2 255.255.255.255 10.1.3.1 ip route 5.5.5.5 255.255.255.255 10.1.4.2 no ip http server ! route-map setnexthop permit 10 set ip next-hop peer-address !
================================================= R4 config =================================================
router bgp 2 no synchronization bgp router-id 4.4.4.4 network 4.4.4.4 mask 255.255.255.255 network 10.1.2.0 mask 255.255.255.0 network 10.1.5.0 mask 255.255.255.0 network 10.1.5.0 mask 255.255.255.0 neighbor 2.2.2.2 ebgp-multihop 255 neighbor 2.2.2.2 update-source Loopback0 neighbor 5.5.5.5 remote-as 2 neighbor 5.5.5.5 ebgp-multihop 255 neighbor 5.5.5.5 update-source Loopback0 neighbor 5.5.5.5 next-hop-self neighbor 5.5.5.5 route-map setnexthop in no auto-summary ! no ip http server ip classless ip route 2.2.2.2 255.255.255.255 10.1.2.1 ip route 5.5.5.5 255.255.255.255 10.1.5.2 ! route-map setnexthop permit 10 set ip next-hop peer-address
================================================= R5 config =================================================
router bgp 2 no synchronization bgp router-id 5.5.5.5 bgp cluster-id 167839233 network 5.5.5.5 mask 255.255.255.255 network 10.1.4.0 mask 255.255.255.0 network 10.1.5.0 mask 255.255.255.0 network 10.1.6.0 mask 255.255.255.0 neighbor 3.3.3.3 remote-as 1 neighbor 3.3.3.3 ebgp-multihop 255 neighbor 3.3.3.3 update-source Loopback0 neighbor 4.4.4.4 remote-as 2 neighbor 4.4.4.4 ebgp-multihop 255 neighbor 4.4.4.4 update-source Loopback0 neighbor 4.4.4.4 route-reflector-client neighbor 4.4.4.4 next-hop-self neighbor 6.6.6.6 remote-as 2 neighbor 6.6.6.6 ebgp-multihop 255 neighbor 6.6.6.6 update-source Loopback0 neighbor 6.6.6.6 route-reflector-client neighbor 6.6.6.6 next-hop-self no auto-summary ! no ip http server ip classless ip route 3.3.3.3 255.255.255.255 10.1.4.1 ip route 4.4.4.4 255.255.255.255 10.1.5.1 ip route 6.6.6.6 255.255.255.255 10.1.6.2 !
================================================= R6 config =================================================
router bgp 2 no synchronization bgp router-id 6.6.6.6 network 6.6.6.6 mask 255.255.255.255 network 10.1.6.0 mask 255.255.255.0 neighbor 5.5.5.5 remote-as 2 neighbor 5.5.5.5 ebgp-multihop 255 neighbor 5.5.5.5 update-source Loopback0 neighbor 5.5.5.5 route-map setnexthop in no auto-summary ! ip classless ip route 5.5.5.5 255.255.255.255 10.1.6.1 no ip http server ! access-list 1 permit any route-map setnexthop permit 10 match ip address 1 set ip next-hop peer-address ! route-map setnexthop permit 20 !
***************************************************************** OUTPUT from Trace Tests: *****************************************************************
================================================= R1 output: =================================================
r1#traceroute 6.6.6.6 Type escape sequence to abort. Tracing the route to 6.6.6.6 1 10.1.1.2 16 msec 20 msec 20 msec 2 10.1.2.2 32 msec 32 msec 28 msec 3 10.1.5.2 [AS 2] 48 msec 44 msec 44 msec 4 10.1.6.2 [AS 2] 44 msec * 44 msec r1#
NOTICE: Path taken by traffic is R2 ==> R4 ==> R5 ==> R6
================================================= R6 output: =================================================
r6#traceroute 1.1.1.1 Type escape sequence to abort. Tracing the route to 1.1.1.1 1 10.1.6.1 0 msec 4 msec 0 msec 2 10.1.4.1 20 msec 16 msec 20 msec 3 10.1.3.1 [AS 1] 36 msec 36 msec 32 msec 4 10.1.1.1 [AS 1] 52 msec * 48 msec r6#
NOTICE: Path taken by traffic is R5 ==> R3 ==> R2 ==> R1
Therefore traffic is taking different routes (asynchronous routing) - we want to force all traffic to use R2 when leaving AS1, and use R4 coming back
================================================= R3 output: =================================================
r3#traceroute 6.6.6.6 Type escape sequence to abort. Tracing the route to 6.6.6.6 1 10.1.4.2 16 msec 20 msec 20 msec 2 10.1.6.2 [AS 2] 20 msec * 20 msec r3#
NOTICE: R3 is going directly to R5 then R6 - we want to change this.
**************************************************************** NOTICE weights: *****************************************************************
================================================= R2 output: =================================================

================================================= R3 output: =================================================

**************************************************************** Method 1: CHANGE WEIGHTS ON R3 *****************************************************************
In this method we set the weight for all routes to neighbors
================================================= R3 Changes: =================================================
router bgp 1 no synchronization bgp router-id 3.3.3.3 network 3.3.3.3 mask 255.255.255.255 network 10.1.3.0 mask 255.255.255.0 network 10.1.4.0 mask 255.255.255.0 neighbor 2.2.2.2 remote-as 1 neighbor 2.2.2.2 ebgp-multihop 255 neighbor 2.2.2.2 update-source Loopback0 neighbor 2.2.2.2 weight 100 <==== Notice, weight changed to 100 neighbor 2.2.2.2 route-map setnexthop in neighbor 5.5.5.5 remote-as 2 neighbor 5.5.5.5 ebgp-multihop 255 neighbor 5.5.5.5 update-source Loopback0 no auto-summary ! ip classless ip route 2.2.2.2 255.255.255.255 10.1.3.1 ip route 5.5.5.5 255.255.255.255 10.1.4.2
================================================= R3 Output =================================================

Notice: Weights have changed for 2.2.2.2 to 100 whereas before it was 0.
================================================= R3 Output =================================================
r3#traceroute 6.6.6.6 Type escape sequence to abort. Tracing the route to 6.6.6.6 1 10.1.3.1 16 msec 16 msec 20 msec 2 10.1.2.2 36 msec 28 msec 32 msec 3 10.1.5.2 [AS 2] 28 msec 28 msec 28 msec 4 10.1.6.2 [AS 2] 28 msec * 24 msec r3#
Notice - R3 now sends traffic via R2 instead of direct to the other AS2
**************************************************************** CHANGE WEIGHTS ON R5: Second Method *****************************************************************
In this method we set the weight using as path and filter lists
================================================= R5 output before routing changes =================================================


================================================= R5 config changes: =================================================
router bgp 2 no synchronization bgp router-id 5.5.5.5 bgp cluster-id 167839233 network 5.5.5.5 mask 255.255.255.255 network 10.1.4.0 mask 255.255.255.0 network 10.1.5.0 mask 255.255.255.0 network 10.1.6.0 mask 255.255.255.0 neighbor 3.3.3.3 remote-as 1 neighbor 3.3.3.3 ebgp-multihop 255 neighbor 3.3.3.3 update-source Loopback0 neighbor 3.3.3.3 filter-list 1 weight 100 neighbor 4.4.4.4 remote-as 2 neighbor 4.4.4.4 ebgp-multihop 255 neighbor 4.4.4.4 update-source Loopback0 neighbor 4.4.4.4 route-reflector-client neighbor 4.4.4.4 next-hop-self neighbor 6.6.6.6 remote-as 2 neighbor 6.6.6.6 ebgp-multihop 255 neighbor 6.6.6.6 update-source Loopback0 neighbor 6.6.6.6 route-reflector-client neighbor 6.6.6.6 next-hop-self no auto-summary ! no ip http server ip classless ip route 3.3.3.3 255.255.255.255 10.1.4.1 ip route 4.4.4.4 255.255.255.255 10.1.5.1 ip route 6.6.6.6 255.255.255.255 10.1.6.2 ! ip as-path access-list 1 permit ^2$
**************************************************************** CHANGE WEIGHTS ON R3: Third Method *****************************************************************
In this method we set the weight using a route map
================================================= R3 outputs: =================================================


================================================= R3 config changes: =================================================
router bgp 1 no synchronization bgp router-id 3.3.3.3 network 3.3.3.3 mask 255.255.255.255 network 10.1.3.0 mask 255.255.255.0 network 10.1.4.0 mask 255.255.255.0 neighbor 2.2.2.2 remote-as 1 neighbor 2.2.2.2 ebgp-multihop 255 neighbor 2.2.2.2 update-source Loopback0 neighbor 2.2.2.2 route-map setweightin in <===== Point to a route-map neighbor 5.5.5.5 remote-as 2 neighbor 5.5.5.5 ebgp-multihop 255 neighbor 5.5.5.5 update-source Loopback0 no auto-summary ! ip classless ip route 2.2.2.2 255.255.255.255 10.1.3.1 ip route 5.5.5.5 255.255.255.255 10.1.4.2 no ip http server ip as-path access-list 1 permit ^2$ <=====AS-Path access-list ! route-map setweightin permit 10 <===== Point to a route-map, notice - you can put multiple set statements in match as-path 1 set ip next-hop peer-address set weight 100
================================================= R3 outputs =================================================

r3#traceroute 6.6.6.6 Type escape sequence to abort. Tracing the route to 6.6.6.6 1 10.1.3.1 20 msec 16 msec 16 msec 2 10.1.2.2 [AS 2] 32 msec 32 msec 28 msec 3 10.1.5.2 [AS 2] 28 msec 24 msec 28 msec 4 10.1.6.2 [AS 2] 28 msec * 24 msec r3#
|