BGP Weight Attribute
lets see the configuration:-
GOAL:
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 10.1.1.1 YES NVRAM up up
Serial3/0 1.1.1.1 YES NVRAM up up
Serial3/3 4.1.1.2 YES NVRAM up up
Loopback0 11.0.0.1 YES NVRAM up up
Loopback1 11.0.1.1 YES NVRAM up up
Loopback2 11.0.2.1 YES NVRAM up up
Loopback3 11.0.3.1 YES NVRAM up up
R1(config)#router bgp 65111
R1(config-router)#neighbor 1.1.1.2 remote-as 65111
R1(config-router)#neighbor 4.1.1.1 remote-as 65444
R1(config-router)#neighbor 1.1.1.2 next-hop-self
R1(config-router)#network 10.0.0.0
R1(config-router)#network 1.0.0.0
R1(config-router)#network 4.0.0.0
R1(config-router)#network 11.0.0.0 mask 255.255.255.0
R1(config-router)#no auto-summary
R1(config-router)#no synchronization
R2(config)#router bgp 65111
R2(config-router)#neighbor 1.1.1.1 remote-as 65111
R2(config-router)#neighbor 2.1.1.2 remote-as 65333
R2(config-router)#neighbor 1.1.1.1 next-hop-self
R2(config-router)#network 20.0.0.0
R2(config-router)#network 2.0.0.0
R2(config-router)#network 1.0.0.0
R2(config-router)#network 12.0.0.0 mask 255.255.255.0
R2(config-router)#no auto-summary
R2(config-router)#no synchronization
R3(config)#router bgp 65333
R3(config-router)#neighbor 2.1.1.1 remote-as 65111
R3(config-router)#neighbor 3.1.1.2 remote-as 65444
R3(config-router)#network 30.0.0.0
R3(config-router)#network 3.0.0.0
R3(config-router)#network 2.0.0.0
R3(config-router)#network 13.0.0.0 mask 255.255.255.0
R3(config-router)#no synchronization
R3(config-router)#no auto-summary
BGP table version is 21, local router ID is 14.0.3.1
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
*> 1.0.0.0 4.1.1.2 0 0 65111 i
* 3.1.1.1 0 65333 65111 i
* 2.0.0.0 4.1.1.2 0 65111 i
*> 3.1.1.1 0 0 65333 i
*> 3.0.0.0 0.0.0.0 0 32768 i
* 3.1.1.1 0 0 65333 i
*> 4.0.0.0 0.0.0.0 0 32768 i
* 4.1.1.2 0 0 65111 i
* 3.1.1.1 0 65333 65111 i
*> 10.0.0.0 4.1.1.2 0 0 65111 i
* 3.1.1.1 0 65333 65111 i
*> 11.0.0.0/24 4.1.1.2 0 0 65111 i
* 3.1.1.1 0 65333 65111 i
*> 12.0.0.0/24 4.1.1.2 0 65111 i
Network Next Hop Metric LocPrf Weight Path
* 3.1.1.1 0 65333 65111 i
* 13.0.0.0/24 4.1.1.2 0 65111 65333 i
*> 3.1.1.1 0 0 65333 i
*> 14.0.0.0/24 0.0.0.0 0 32768 i
*> 20.0.0.0 4.1.1.2 0 65111 i
* 3.1.1.1 0 65333 65111 i
* 30.0.0.0 4.1.1.2 0 65111 65333 i
*> 3.1.1.1 0 0 65333 i
*> 40.0.0.0 0.0.0.0 0 32768 i
Type escape sequence to abort.
Tracing the route to 30.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 3.1.1.1 168 msec 60 msec 24 msec
To reach the 30.1.1.1 router 4 by default using 3.1.1.1 interface because it has less numbers of AS.
but we want to router 4 go via 4.1.1.1 interface to reach all the networks.
R4(config)#router bgp 65444
R4(config-router)#neighbor 4.1.1.2 weight 20000
Type escape sequence to abort.
Tracing the route to 30.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 4.1.1.2 8 msec 56 msec 4 msec
2 1.1.1.2 [AS 65111] 52 msec 40 msec 36 msec
3 2.1.1.2 [AS 65111] 52 msec 40 msec 64 msec
BGP routing table entry for 30.0.0.0/8, version 22
Paths: (2 available, best #1, table default)
Advertised to update-groups:
4.1.1.2 from 4.1.1.2 (11.0.3.1)
Origin IGP, localpref 100, weight 20000, valid, external, best
rx pathid: 0, tx pathid: 0x0
3.1.1.1 from 3.1.1.1 (13.0.3.1)
Origin IGP, metric 0, localpref 100, valid, external
rx pathid: 0, tx pathid: 0
BGP table version is 29, local router ID is 14.0.3.1
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
*> 1.0.0.0 4.1.1.2 0 20000 65111 i
* 3.1.1.1 0 65333 65111 i
*> 2.0.0.0 4.1.1.2 20000 65111 i
* 3.1.1.1 0 0 65333 i
*> 3.0.0.0 0.0.0.0 0 32768 i
* 3.1.1.1 0 0 65333 i
*> 4.0.0.0 0.0.0.0 0 32768 i
* 4.1.1.2 0 20000 65111 i
* 3.1.1.1 0 65333 65111 i
*> 10.0.0.0 4.1.1.2 0 20000 65111 i
* 3.1.1.1 0 65333 65111 i
*> 11.0.0.0/24 4.1.1.2 0 20000 65111 i
* 3.1.1.1 0 65333 65111 i
*> 12.0.0.0/24 4.1.1.2 20000 65111 i
Network Next Hop Metric LocPrf Weight Path
* 3.1.1.1 0 65333 65111 i
*> 13.0.0.0/24 4.1.1.2 20000 65111 65333 i
* 3.1.1.1 0 0 65333 i
*> 14.0.0.0/24 0.0.0.0 0 32768 i
*> 20.0.0.0 4.1.1.2 20000 65111 i
* 3.1.1.1 0 65333 65111 i
*> 30.0.0.0 4.1.1.2 20000 65111 65333 i
* 3.1.1.1 0 0 65333 i
*> 40.0.0.0 0.0.0.0 0 32768 i
Originally published at https://www.internetworks.in.