Routers will prefer a route if it’s locally originated, its next hop IP address is 0.0.0.0 in the BGP table..
Let's see an example..
R1(config)#router bgp 1
R1(config-router)#network 10.10.10.0 mask 255.255.255.0
R1(config-router)#network 20.20.20.0 mask 255.255.255.0
R1(config-router)#neighbor 192.168.12.2 remote-as 2
R2(config)#router bgp 2
R2(config-router)#network 10.10.10.0 mask 255.255.255.0
R2(config-router)#network 20.20.20.0 mask 255.255.255.0
R2(config-router)#neighbor 3.3.3.3 remote-as 2
R2(config-router)#neighbor 3.3.3.3 update-source Loopback0
R2(config-router)#neighbor 192.168.12.1 remote-as 1
R3(config)#router bgp 2
R3(config-router)#bgp log-neighbor-changes
R3(config-router)#network 10.10.10.0 mask 255.255.255.0
R3(config-router)#network 20.20.20.0 mask 255.255.255.0
R3(config-router)#neighbor 1.1.1.1 remote-as 2
R3(config-router)#neighbor 1.1.1.1 update-source Loopback0
Basic routing (static) on R2 & R3 to reach their loopbacks..
R2(config)#ip route 3.3.3.0 255.255.255.0 192.168.23.3
R3(config)#ip route 1.1.1.0 255.255.255.0 192.168.23.2
You can see on R2, the next hop 0.0.0.0 routes are always preferred. On R3, you cannot see the 10.10.10.0/24 & 20.20.20.0/24 routes which were originated on R1 because R2 is only advertising the best routes to R3. Because R2 takes it's locally originated routes as the best routes in R2's BGP table, it does not even advertise the routes learnt from R1..
Note:-
The true reason above routes are chosen as the best routes is the Weight because these are Cisco routers. In Cisco routers, the Weight comes the 1st attribute to make the decision..
No comments:
Post a Comment