selecting best path route BGP using weight parameters

In this tutorial, i will demonstrate how we can selecting best path using weight atributes on BGP. I’ve create a network topology consist 4 routers. here is the network topology :

In this scenario, i’m using GNS3 and dynagen. I’m using CISCO 3640. here is the IP address of each router :
R1 :

interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Serial0/0
description KONEK_R2
ip address 12.12.12.1 255.255.255.0
serial restart_delay 0
!
interface Serial0/1
description KONEK_R3
ip address 13.13.13.1 255.255.255.0
serial restart_delay 0

R2 :

interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Serial0/0
description KONEK_R1
ip address 12.12.12.2 255.255.255.0
serial restart_delay 0
!
interface Serial0/1
description KONEK_R4
ip address 24.24.24.2 255.255.255.0
serial restart_delay 0

R3 :

interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Serial0/0
description KONEK_R1
ip address 13.13.13.3 255.255.255.0
serial restart_delay 0
!
interface Serial0/1
description KONEK_R4
ip address 34.34.34.3 255.255.255.0
serial restart_delay 0
!

R4 :

interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Serial0/0
description KONEK_R3
ip address 34.34.34.4 255.255.255.0
serial restart_delay 0
!
interface Serial0/1
description KONEK_R2
ip address 24.24.24.4 255.255.255.0
serial restart_delay 0

On each router, you can see loopback interface is activated. it used for BGP router ID. Now, lets start our scenario, R1 advertise their network (including loopback address) to all router. Destination IP is R1’s ip address, and the path selection from R3 is R3-R4-R2-R1 not R3-R1 and R4 path is R4-R2-R1. okey, now lets start our main configuration. i will start on R1 until R4.

R1 :

router ospf 1
log-adjacency-changes
network 12.12.12.1 0.0.0.0 area 0
network 13.13.13.1 0.0.0.0 area 0
!
router bgp 1
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
neighbor 12.12.12.2 remote-as 2
neighbor 13.13.13.3 remote-as 34
no auto-summary

R2 :

router ospf 1
log-adjacency-changes
network 12.12.12.2 0.0.0.0 area 0
network 24.24.24.2 0.0.0.0 area 0
!
router bgp 2
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 12.12.12.1 remote-as 1
neighbor 24.24.24.4 remote-as 34
no auto-summary

R3 :

router ospf 1
log-adjacency-changes
network 13.13.13.3 0.0.0.0 area 0
network 34.34.34.3 0.0.0.0 area 0
!
router bgp 34
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
neighbor 13.13.13.1 remote-as 1
neighbor 34.34.34.4 remote-as 34
no auto-summary

R4 :

router ospf 1
log-adjacency-changes
network 24.24.24.4 0.0.0.0 area 0
network 34.34.34.4 0.0.0.0 area 0
!
router bgp 34
no synchronization
bgp router-id 4.4.4.4
bgp log-neighbor-changes
neighbor 24.24.24.2 remote-as 2
neighbor 34.34.34.3 remote-as 34
no auto-summary

Okey, now let us verify the BGP conectivity. I’ll verify just on R3 and R4. here’s the output on R3

R3#sh ip bgp
BGP table version is 2, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
... Network    Next Hop   Metric LocPrf Weight Path
*> 1.1.1.1/32 13.13.13.1   0              0  1 i

and the traceroute from R3 to R1 (loopback) is :

R3#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 13.13.13.1 88 msec 76 msec *

and the output of R4 is :

R4#sh ip bgp
BGP table version is 3, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
...   Network    Next Hop   Metric LocPrf Weight Path
*> 1.1.1.1/32 13.13.13.1   0        100      0  1 i
*             24.24.24.2                     0  2  1  i

and the traceroute output from R4 to R1 (loopback) is :

R4#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 34.34.34.3 112 msec 76 msec 156 msec
2 13.13.13.1 328 msec 288 msec *

As you can see from R3 and R4 sh ip bgp output, from R3 to reach R1 (1.1.1.1) via 13.13.13.1 and from R4 to reach R1 via 13.13.13.1. (default bgp, they choose the smallest AS path). And then, how we could change the default Path on R3 and R4? follow these steps :
R3 :

R3#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router bgp 34
R3(config-router)#neighbor 34.34.34.4 weight 100

(MUST!!!)restart R3 bgp peering connection to apply the changes.
and the output will look like this :

R3#sh ip bgp
BGP table version is 6, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network          Next Hop            Metric LocPrf Weight Path
*  1.1.1.1/32       13.13.13.1           0             0   1 i
*>i                 24.24.24.2           0    100    100   2 1 i

and the traceroute output from R3 to R1 (loopback address) is :

R3#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 34.34.34.4 96 msec 52 msec 24 msec
2 24.24.24.2 148 msec 236 msec 196 msec
3 12.12.12.1 260 msec 264 msec *

R4 :

R4#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#router bgp 34
R4(config-router)#neighbor 24.24.24.2 weight 100

(MUST!!!)restart R3 bgp peering connection to apply the changes.
and the output will look like this :

R3#sh ip bgp
BGP table version is 8, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network          Next Hop            Metric LocPrf Weight Path
*>i1.1.1.1/32       24.24.24.2           0    100    100   2 1 i
*                   13.13.13.1           0             0   1 i

and the traceroute output from R4 to R1 (loopback address) is :

R4#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 24.24.24.2 64 msec 116 msec 104 msec
2 12.12.12.1 240 msec 104 msec *

HOHOHOHO………..pass the first scenario 🙂

next scenario ?? wait……………..

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s