Monday, August 11, 2008

5) Tips and Tricks

The "ip as-path" Command: Part 1

For my first trick, I actually tried my suggestion I mentioned on the "Router Configs Explanation" post, at the R0 router section. But I tried it in a different topology which is very simple yet enough to demonstrate the power of the AS Path attribute together with Route-map.

Here is the topology:


Please click here to download the configurations of R0, R1 and R3.

***Sample Output when route-map Christopher is NOT applied to both neighbors:

R0#sho ip bgp neigh 192.168.10.2 adv
BGP table version is 4, local router ID is 90.90.90.90
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 20.20.20.0/24 192.168.10.6 0 0 20 i
*> 90.90.90.0/24 0.0.0.0 0 32768 i

R0#sho ip bgp neighbors 192.168.10.6 advertised-routes
BGP table version is 4, local router ID is 90.90.90.90
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 10.10.10.0/24 192.168.10.2 0 0 10 i
*> 90.90.90.0/24 0.0.0.0 0 32768 i

***Sample output when route-map Christopher is NOW applied to both neighbors:

R0#sho ip bgp neigh 192.168.10.2 adv
BGP table version is 4, local router ID is 90.90.90.90
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 90.90.90.0/24 0.0.0.0 0 32768 i

R0#sho ip bgp neighbors 192.168.10.6 advertised-routes
BGP table version is 4, local router ID is 90.90.90.90
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 90.90.90.0/24 0.0.0.0 0 32768 i

*** And that is the power of route-map and the AS PATH attribute.

*** Click here to download the final configs of this part

-==End of this Part==-


===================================================================
===================================================================

The "ip as-path" Command: Part 2

I actually had a chance to try the technique above in our actual topology, if you loaded the R0 and R5 configs without the distribute list (please click here to download the initial configurations for R0 and R5) commands (meaning just the neighbor remote-as command and nothing else) this is what you should see:

R6_AS_100#sho ip route bgp --> AS 100 is learning the networks of AS 30 and AS 50
50.0.0.0/24 is subnetted, 2 subnets
B 50.50.11.0 [200/0] via 100.100.12.1, 00:02:30
B 50.50.12.0 [200/0] via 100.100.12.1, 00:02:30
B 200.20.20.0/24 [20/0] via 60.50.10.2, 00:02:48
100.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
B 100.100.12.0/24 [200/0] via 100.100.12.1, 00:02:48
B 192.168.30.0/24 [200/0] via 100.100.12.1, 00:02:29
B 200.20.50.0/24 [20/0] via 60.50.10.2, 00:02:48
B 192.168.10.0/24 [200/0] via 100.100.12.1, 00:02:29
B 192.168.40.0/24 [200/0] via 100.100.12.1, 00:02:29
B 192.168.20.0/24 [200/0] via 100.100.12.1, 00:02:29
B 200.20.60.0/24 [20/0] via 60.50.10.2, 00:02:48
B 200.20.30.0/24 [20/0] via 60.50.10.2, 00:02:48
B 192.168.50.0/24 [200/0] via 100.100.12.1, 00:02:29
B 200.20.40.0/24 [20/0] via 60.50.10.2, 00:02:48
30.0.0.0/24 is subnetted, 2 subnets
B 30.30.11.0 [20/0] via 60.50.10.2, 00:02:21
B 30.30.12.0 [20/0] via 60.50.10.2, 00:02:21

R2_AS_30#sho ip route bgp --> AS 30 is learning the networks of AS 100
50.0.0.0/24 is subnetted, 2 subnets
B 50.50.11.0 [20/0] via 12.123.50.6, 00:04:44
B 50.50.12.0 [20/0] via 12.123.50.6, 00:05:41
B 200.20.20.0/24 [200/0] via 30.30.11.1, 00:03:04
100.0.0.0/24 is subnetted, 2 subnets
B 100.100.11.0 [200/0] via 30.30.11.1, 00:02:59
B 100.100.12.0 [200/0] via 30.30.11.1, 00:02:59
B 192.168.30.0/24 [20/0] via 12.123.50.6, 00:02:36
B 200.20.50.0/24 [200/0] via 30.30.11.1, 00:02:59
B 192.168.10.0/24 [20/0] via 12.123.50.6, 00:02:36
B 192.168.40.0/24 [20/0] via 12.123.50.6, 00:02:36
B 192.168.20.0/24 [20/0] via 12.123.50.6, 00:02:36
B 200.20.60.0/24 [200/0] via 30.30.11.1, 00:02:59
B 200.20.30.0/24 [200/0] via 30.30.11.1, 00:02:59
B 192.168.50.0/24 [20/0] via 12.123.50.6, 00:02:36
B 200.20.40.0/24 [200/0] via 30.30.11.1, 00:02:59
30.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
B 30.30.11.0/24 [200/0] via 30.30.11.1, 00:06:00

R4_AS_50#sho ip route bgp --> AS 50 is learning the networks of AS 100
50.0.0.0/8 is variably subnetted, 6 subnets, 3 masks
B 50.50.12.0/24 [200/0] via 50.50.12.1, 00:05:23
B 200.20.20.0/24 [200/0] via 50.50.12.1, 00:03:16
100.0.0.0/24 is subnetted, 2 subnets
B 100.100.11.0 [20/0] via 50.50.13.2, 00:02:36
B 100.100.12.0 [20/0] via 50.50.13.2, 00:02:36
B 192.168.30.0/24 [20/0] via 50.50.13.2, 00:03:06
B 200.20.50.0/24 [200/0] via 50.50.12.1, 00:02:46
B 192.168.10.0/24 [20/0] via 50.50.13.2, 00:03:06
B 192.168.40.0/24 [20/0] via 50.50.13.2, 00:03:06
B 192.168.20.0/24 [20/0] via 50.50.13.2, 00:03:06
B 200.20.60.0/24 [200/0] via 50.50.12.1, 00:02:46
B 200.20.30.0/24 [200/0] via 50.50.12.1, 00:02:46
B 192.168.50.0/24 [20/0] via 50.50.13.2, 00:03:06
B 200.20.40.0/24 [200/0] via 50.50.12.1, 00:02:46
30.0.0.0/24 is subnetted, 2 subnets
B 30.30.11.0 [200/0] via 50.50.12.1, 00:05:23
B 30.30.12.0 [200/0] via 50.50.12.1, 00:05:23

R0_AS_200#sho ip bgp neighbors 12.123.50.1 advertised-routes
BGP table version is 17, local router ID is 200.20.20.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 100.100.11.0/24 60.50.10.1 0 0 100 ?
*> 100.100.12.0/24 60.50.10.1 0 100 ?
*> 192.168.10.0 60.50.10.1 0 100 192 i
*> 192.168.20.0 60.50.10.1 0 100 192 ?
*> 192.168.30.0 60.50.10.1 0 100 192 ?
*> 192.168.40.0 60.50.10.1 0 100 192 ?
*> 192.168.50.0 60.50.10.1 0 100 192 ?
*> 200.20.20.0 0.0.0.0 0 32768 i
*> 200.20.30.0 0.0.0.0 0 32768 ?
*> 200.20.40.0 0.0.0.0 0 32768 ?
*> 200.20.50.0 0.0.0.0 0 32768 ?
*> 200.20.60.0 0.0.0.0 0 32768 ?

- Prefixes in blue font are learned by R0 from the AS 100

R0_AS_200#sho ip bgp neighbors 60.50.10.1 advertised-routes
BGP table version is 17, local router ID is 200.20.20.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 30.30.11.0/24 12.123.50.1 0 0 30 ?
*> 30.30.12.0/24 12.123.50.1 0 30 ?
*> 50.50.11.0/24 12.123.50.1 0 30 50 ?
*> 50.50.12.0/24 12.123.50.1 0 30 50 ?
*> 200.20.20.0 0.0.0.0 0 32768 i
*> 200.20.30.0 0.0.0.0 0 32768 ?
*> 200.20.40.0 0.0.0.0 0 32768 ?
*> 200.20.50.0 0.0.0.0 0 32768 ?
*> 200.20.60.0 0.0.0.0 0 32768 ?

- Prefixes in blue font are learned by R0 from AS 30

*** Noticed that R0 is advertising the routes it learned from AS 100 to AS 30 and the routes it learned from AS 30 are getting advertised out to AS 100, this is a clear indication that R0 is acting as a transit path between AS 30 and AS 100 and we do not want this to happen in real world.

For the case of R5 you should be getting these:

R5_AS_192#sho ip bgp neighbors 50.50.13.1 advertised-routes
BGP table version is 18, local router ID is 192.168.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 100.100.11.0/24 60.50.10.5 0 100 ?
*> 100.100.12.0/24 60.50.10.5 0 0 100 ?
*> 192.168.10.0 0.0.0.0 0 32768 i
*> 192.168.20.0 0.0.0.0 0 32768 ?
*> 192.168.30.0 0.0.0.0 0 32768 ?
*> 192.168.40.0 0.0.0.0 0 32768 ?
*> 192.168.50.0 0.0.0.0 0 32768 ?
*> 200.20.20.0 60.50.10.5 0 100 200 i
*> 200.20.30.0 60.50.10.5 0 100 200 ?
*> 200.20.40.0 60.50.10.5 0 100 200 ?
*> 200.20.50.0 60.50.10.5 0 100 200 ?
*> 200.20.60.0 60.50.10.5 0 100 200 ?

- Prefixes in blue font are learned by R5 from AS 100

R5_AS_192#sho ip bgp neighbors 60.50.10.5 advertised-routes
BGP table version is 18, local router ID is 192.168.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 30.30.11.0/24 50.50.13.1 0 50 30 ?
*> 30.30.12.0/24 50.50.13.1 0 50 30 ?
*> 50.50.11.0/24 50.50.13.1 0 0 50 ?
*> 50.50.12.0/24 50.50.13.1 0 50 ?
*> 192.168.10.0 0.0.0.0 0 32768 i
*> 192.168.20.0 0.0.0.0 0 32768 ?
*> 192.168.30.0 0.0.0.0 0 32768 ?
*> 192.168.40.0 0.0.0.0 0 32768 ?
*> 192.168.50.0 0.0.0.0 0 32768 ?

- Prefixes on blue font are learned by R5 from AS 50

*** R5 has the same problem with R0.

This problem can be resolved by adding these commands below into the configs of R0 and R5 respectively:

Config add-ons for R0
!
ip as-path access-list 1 permit ^100_
ip as-path access-list 2 permit ^30_
!
access-list 10 permit any
!
route-map FILTER-AS deny 10
match ip address 10
match as-path 1
!
route-map FILTER-AS deny 20
match ip address 10
match as-path 2
!
route-map FILTER-AS permit 30
!
router bgp 200
neighbor 12.123.50.1 route-map FILTER-AS out
neighbor 60.50.10.1 route-map FILTER-AS out
end
!
Config add-ons for R5
!
ip as-path access-list 1 permit ^100_
ip as-path access-list 2 permit ^50_
!
access-list 10 permit any
!
route-map FILTER-AS deny 10
match ip address 10
match as-path 1
!
route-map FILTER-AS deny 20
match ip address 10
match as-path 2
!
route-map FILTER-AS permit 30
!
router bgp 192
neighbor 50.50.13.1 route-map FILTER-AS out
neighbor 60.50.10.5 route-map FILTER-AS out
end
!

*** Once you have loaded these configs your network should now behave in these manner:

R0_AS_200#sho ip bgp neighbors 60.50.10.1 advertised-routes
BGP table version is 17, local router ID is 200.20.20.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 200.20.20.0 0.0.0.0 0 32768 i
*> 200.20.30.0 0.0.0.0 0 32768 ?
*> 200.20.40.0 0.0.0.0 0 32768 ?
*> 200.20.50.0 0.0.0.0 0 32768 ?
*> 200.20.60.0 0.0.0.0 0 32768 ?

R0_AS_200#sho ip bgp neighbors 12.123.50.1 advertised-routes
BGP table version is 17, local router ID is 200.20.20.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 200.20.20.0 0.0.0.0 0 32768 i
*> 200.20.30.0 0.0.0.0 0 32768 ?
*> 200.20.40.0 0.0.0.0 0 32768 ?
*> 200.20.50.0 0.0.0.0 0 32768 ?
*> 200.20.60.0 0.0.0.0 0 32768 ?

R5_AS_192#sho ip bgp neighbors 60.50.10.5 advertised-routes
BGP table version is 18, local router ID is 192.168.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 192.168.10.0 0.0.0.0 0 32768 i
*> 192.168.20.0 0.0.0.0 0 32768 ?
*> 192.168.30.0 0.0.0.0 0 32768 ?
*> 192.168.40.0 0.0.0.0 0 32768 ?
*> 192.168.50.0 0.0.0.0 0 32768 ?

R5_AS_192#sho ip bgp neighbors 50.50.13.1 advertised-routes
BGP table version is 18, local router ID is 192.168.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 192.168.10.0 0.0.0.0 0 32768 i
*> 192.168.20.0 0.0.0.0 0 32768 ?
*> 192.168.30.0 0.0.0.0 0 32768 ?
*> 192.168.40.0 0.0.0.0 0 32768 ?
*> 192.168.50.0 0.0.0.0 0 32768 ?

*** R0 and R5 advertisements to their respective neighbors are now a lot cleaner and a lot desirable.

R6_AS_100#sho ip route bgp
B 200.20.20.0/24 [20/0] via 60.50.10.2, 00:09:44
100.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
B 100.100.12.0/24 [200/0] via 100.100.12.1, 00:09:44
B 192.168.30.0/24 [200/0] via 100.100.12.1, 00:09:25
B 200.20.50.0/24 [20/0] via 60.50.10.2, 00:09:44
B 192.168.10.0/24 [200/0] via 100.100.12.1, 00:09:25
B 192.168.40.0/24 [200/0] via 100.100.12.1, 00:09:25
B 192.168.20.0/24 [200/0] via 100.100.12.1, 00:09:25
B 200.20.60.0/24 [20/0] via 60.50.10.2, 00:09:44
B 200.20.30.0/24 [20/0] via 60.50.10.2, 00:09:44
B 192.168.50.0/24 [200/0] via 100.100.12.1, 00:09:25
B 200.20.40.0/24 [20/0] via 60.50.10.2, 00:09:44

R2_AS_30#sho ip route bgp
50.0.0.0/24 is subnetted, 2 subnets
B 50.50.11.0 [20/0] via 12.123.50.6, 00:11:47
B 50.50.12.0 [20/0] via 12.123.50.6, 00:12:43
B 200.20.20.0/24 [200/0] via 30.30.11.1, 00:10:06
B 192.168.30.0/24 [20/0] via 12.123.50.6, 00:09:39
B 200.20.50.0/24 [200/0] via 30.30.11.1, 00:10:01
B 192.168.10.0/24 [20/0] via 12.123.50.6, 00:09:39
B 192.168.40.0/24 [20/0] via 12.123.50.6, 00:09:39
B 192.168.20.0/24 [20/0] via 12.123.50.6, 00:09:39
B 200.20.60.0/24 [200/0] via 30.30.11.1, 00:10:01
B 200.20.30.0/24 [200/0] via 30.30.11.1, 00:10:01
B 192.168.50.0/24 [20/0] via 12.123.50.6, 00:09:39
B 200.20.40.0/24 [200/0] via 30.30.11.1, 00:10:01
30.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
B 30.30.11.0/24 [200/0] via 30.30.11.1, 00:13:02

R4_AS_50#sho ip route bgp
50.0.0.0/8 is variably subnetted, 6 subnets, 3 masks
B 50.50.12.0/24 [200/0] via 50.50.12.1, 00:12:34
B 200.20.20.0/24 [200/0] via 50.50.12.1, 00:10:27
B 192.168.30.0/24 [20/0] via 50.50.13.2, 00:10:17
B 200.20.50.0/24 [200/0] via 50.50.12.1, 00:09:57
B 192.168.10.0/24 [20/0] via 50.50.13.2, 00:10:17
B 192.168.40.0/24 [20/0] via 50.50.13.2, 00:10:17
B 192.168.20.0/24 [20/0] via 50.50.13.2, 00:10:17
B 200.20.60.0/24 [200/0] via 50.50.12.1, 00:09:57
B 200.20.30.0/24 [200/0] via 50.50.12.1, 00:09:57
B 192.168.50.0/24 [20/0] via 50.50.13.2, 00:10:17
B 200.20.40.0/24 [200/0] via 50.50.12.1, 00:09:57
30.0.0.0/24 is subnetted, 2 subnets
B 30.30.11.0 [200/0] via 50.50.12.1, 00:12:34
B 30.30.12.0 [200/0] via 50.50.12.1, 00:12:34

*** We can now see the neither R0 and R5 are acting as a transit path between the ASes 100, 30 and 50.

*** Click here to download the final configs of this part

-==End of this Part==-

===================================================================
===================================================================

The "as-path prepend" Command

Today I'll be demonstrating the real power of the AS Path attribute, we will try to influence R5 path going to R0 (to network 200.20.x.x). Originally R5 is using the path via the AS 100 (please see the post “Verification and Testing of Configurations”). You can get the initial configuration on R0 for this part of the post.

R5_AS_192#traceroute ip

Target IP address: 200.20.20.1
Source address: 192.168.10.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 200.20.20.1

1 60.50.10.5 116 msec 72 msec 120 msec --> ISP AS 100
2 100.100.10.1 240 msec 408 msec 216 msec
3 60.50.10.2 288 msec * 288 msec

With the proper modification on R0 configuration, R5 will choose the other path (via AS 50) going to R0 by making the path via AS 100 appear longer compared to AS 50. To make this possible I made these following changes in R0 configuration:
!
router bgp 200
no neighbor 12.123.50.1 route-map FILTER-AS out
no neighbor 60.50.10.1 route-map FILTER-AS out
!
no route-map FILTER-AS deny 10
no route-map FILTER-AS deny 20
no route-map FILTER-AS permit 30
!
route-map FILTER-AS-100 deny 10
match ip address 10
match as-path 1
!
route-map FILTER-AS-100 permit 20
!
route-map FILTER-AS-30 deny 10
match ip address 10
match as-path 2
!
route-map FILTER-AS-30 permit 20
set as-path prepend 199 198 197
!
router bgp 200
neighbor 12.123.50.1 route-map FILTER-AS-100 out
neighbor 60.50.10.1 route-map FILTER-AS-30 out
!

With the “route-map FILTER-AS-30 permit 20”, R0 will tell its neighbor only to R6, that the path to get to the 200.20.x.x network is through AS 200, then to AS 199, then to AS 198 and lastly to AS 197. And this information will propagate until it gets to R5, and R5 will see the AS path to be 100, 200, 199, 198 and then to 197.

Now R5 is also getting advertisement of the same network 200.20.x.x from R4 (AS 50) and that the AS path is 50, 30, 200 which is obviously shorter compared to the advertisement from R7 (AS 100), and now R5 will make a decision and choose the path through R4 (AS 50).

Please see the router output below to prove this theory is correct and please remember that at this point I have made the modifications on R0, and only to R0:

R6_AS_100#sho ip bgp neighbors 60.50.10.2 routes
BGP table version is 36, local router ID is 100.100.11.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 200.20.20.0 60.50.10.2 0 0 200 199 198 197 i
*> 200.20.30.0 60.50.10.2 0 0 200 199 198 197 ?
*> 200.20.40.0 60.50.10.2 0 0 200 199 198 197 ?
*> 200.20.50.0 60.50.10.2 0 0 200 199 198 197 ?
*> 200.20.60.0 60.50.10.2 0 0 200 199 198 197 ?

Total number of prefixes 5

*** Notice the AS path, R0 was successful in letting R6 know that in order to get to 200.20.x.x he needs to pass through as 200, 199, 198, and lastly to 197.

R5_AS_192#sho ip bgp neighbors 60.50.10.5 routes
BGP table version is 37, local router ID is 192.168.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 100.100.11.0/24 60.50.10.5 0 100 ?
*> 100.100.12.0/24 60.50.10.5 0 0 100 ?
* 200.20.20.0 60.50.10.5 0 100 200 199 198 197 i
* 200.20.30.0 60.50.10.5 0 100 200 199 198 197 ?
* 200.20.40.0 60.50.10.5 0 100 200 199 198 197 ?
* 200.20.50.0 60.50.10.5 0 100 200 199 198 197 ?
* 200.20.60.0 60.50.10.5 0 100 200 199 198 197 ?

Total number of prefixes 7

*** R5 has appended the AS 100 with the original advertisement of R0 and so R5 will see the path to be AS 100, 200, 199, 198, and to 197 to get to the network 200.20.x.x, but also notice that R5 did not put these information to its routing table (notice the absence of the “greater than” sign) because the path appears longer compared to the advertisement of R4 (AS 50) to R5.

R5_AS_192#sho ip bgp neighbors 50.50.13.1 routes
BGP table version is 37, local router ID is 192.168.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 30.30.11.0/24 50.50.13.1 0 50 30 ?
*> 30.30.12.0/24 50.50.13.1 0 50 30 ?
*> 50.50.11.0/24 50.50.13.1 0 0 50 ?
*> 50.50.12.0/24 50.50.13.1 0 50 ?
*> 200.20.20.0 50.50.13.1 0 50 30 200 i
*> 200.20.30.0 50.50.13.1 0 50 30 200 ?
*> 200.20.40.0 50.50.13.1 0 50 30 200 ?
*> 200.20.50.0 50.50.13.1 0 50 30 200 ?
*> 200.20.60.0 50.50.13.1 0 50 30 200 ?

Total number of prefixes 9

*** Now R5 is seeing another path to the network 200.20.x.x via R4 (AS 50) and because this appears shorter, R5 made a decision to choose this path instead of the other even though in reality AS 100 has the shorter path.


*** And for the ultimate test, the traceroute:

R5_AS_192#traceroute ip

Target IP address: 200.20.20.1
Source address: 192.168.10.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 200.20.20.1

1 50.50.13.1 116 msec 24 msec 132 msec --> ISP AS 50
2 50.50.10.1 228 msec 240 msec 264 msec
3 12.123.50.5 312 msec 272 msec 352 msec
4 30.30.10.1 456 msec 528 msec 576 msec
5 12.123.50.2 480 msec * 648 msec
R5_AS_192#

*** Get R0 final configuration

-==End of this Part==-

===================================================================
===================================================================

The "local-preference" Command

There is another way of influencing the traffic and that is called the Local Preference. With this attribute we can tell the "Local" router to choose one path over the other, the higher the value the more it will be chosen as the primary path.

Note: In this part we will use our topology and please click here to see the initial configs of R0 and R5

With the initial configs, R0 will choose to pass through AS 100 to get to the 192.168.x.x network.

R0_AS_200#traceroute ip

Target IP address: 192.168.10.1
Source address: 200.20.20.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 192.168.10.1

1 60.50.10.1 116 msec 72 msec 120 msec --> AS 100
2 100.100.10.2 432 msec 408 msec 264 msec
3 60.50.10.6 504 msec * 384 msec
R0_AS_200#

The same goes for R5, it will choose the path via the AS 100.

R5_AS_192#traceroute ip

Target IP address: 200.20.20.1
Source address: 192.168.10.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 200.20.20.1

1 60.50.10.5 44 msec 120 msec 72 msec --> AS 100
2 100.100.10.1 240 msec 264 msec 264 msec
3 60.50.10.2 480 msec 432 msec *
R5_AS_192#


Now, we can make R0 and R5 to choose the path via AS 30 and AS 50 respectively by properly configuring the neighbor statements on both of these routers.

Here are the changes needed to make this working.

Config update for R0 router
!
router bgp 200
neighbor 12.123.50.1 route-map PRIMARY in
neighbor 60.50.10.1 route-map SECONDARY in
!
route-map PRIMARY permit 10
set local-preference 200
!
route-map SECONDARY permit 10
set local-preference 50
!


We set the local preference of the routes that came from AS 30 to a value of 200 and the routes that came from AS 100 to a value of 50, and because of this R0 will choose the routes from AS 30.

R0_AS_200#sho ip bgp neighbors 12.123.50.1 routes
BGP table version is 38, local router ID is 200.20.20.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 30.30.11.0/24 12.123.50.1 0 200 0 30 ?
*> 30.30.12.0/24 12.123.50.1 200 0 30 ?
*> 50.50.11.0/24 12.123.50.1 200 0 30 50 ?
*> 50.50.12.0/24 12.123.50.1 200 0 30 50 ?
*> 192.168.10.0 12.123.50.1 200 0 30 50 192i
*> 192.168.20.0 12.123.50.1 200 0 30 50 192?
*> 192.168.30.0 12.123.50.1 200 0 30 50 192?
*> 192.168.40.0 12.123.50.1 200 0 30 50 192?
*> 192.168.50.0 12.123.50.1 200 0 30 50 192?

Total number of prefixes 9

R0_AS_200#sho ip bgp neighbors 60.50.10.1 routes
BGP table version is 38, local router ID is 200.20.20.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 100.100.11.0/24 60.50.10.1 0 50 0 100 ?
*> 100.100.12.0/24 60.50.10.1 50 0 100 ?
* 192.168.10.0 60.50.10.1 50 0 100 192 i
* 192.168.20.0 60.50.10.1 50 0 100 192 ?
* 192.168.30.0 60.50.10.1 50 0 100 192 ?
* 192.168.40.0 60.50.10.1 50 0 100 192 ?
* 192.168.50.0 60.50.10.1 50 0 100 192 ?

Total number of prefixes 7

R0_AS_200#traceroute ip

Target IP address: 192.168.10.1
Source address: 200.20.20.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 192.168.10.1

1 12.123.50.1 44 msec 116 msec 96 msec --> AS 30
2 30.30.10.2 312 msec 288 msec 216 msec
3 12.123.50.6 456 msec 408 msec 312 msec
4 50.50.10.2 648 msec 480 msec 624 msec
5 50.50.13.2 624 msec 456 msec *
R0_AS_200#

Now, the config update for R5
!
router bgp 192
neighbor 50.50.13.1 route-map PRIMARY in
neighbor 60.50.10.5 route-map SECONDARY in
!
route-map PRIMARY permit 10
set local-preference 200
!
route-map SECONDARY permit 10
set local-preference 50
!
And the results are:

R5_AS_192#sho ip bgp neighbors 50.50.13.1 routes
BGP table version is 29, local router ID is 192.168.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 30.30.11.0/24 50.50.13.1 200 0 50 30 ?
*> 30.30.12.0/24 50.50.13.1 200 0 50 30 ?
*> 50.50.11.0/24 50.50.13.1 0 200 0 50 ?
*> 50.50.12.0/24 50.50.13.1 200 0 50 ?
*> 200.20.20.0 50.50.13.1 200 0 50 30 200i
*> 200.20.30.0 50.50.13.1 200 0 50 30 200?
*> 200.20.40.0 50.50.13.1 200 0 50 30 200?
*> 200.20.50.0 50.50.13.1 200 0 50 30 200?
*> 200.20.60.0 50.50.13.1 200 0 50 30 200?

Total number of prefixes 9

R5_AS_192#sho ip bgp neighbors 60.50.10.5 routes
BGP table version is 29, local router ID is 192.168.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
*> 100.100.11.0/24 60.50.10.5 50 0 100 ?
*> 100.100.12.0/24 60.50.10.5 0 50 0 100 ?
* 200.20.20.0 60.50.10.5 50 0 100 200 i
* 200.20.30.0 60.50.10.5 50 0 100 200 ?
* 200.20.40.0 60.50.10.5 50 0 100 200 ?
* 200.20.50.0 60.50.10.5 50 0 100 200 ?
* 200.20.60.0 60.50.10.5 50 0 100 200 ?

Total number of prefixes 7


R5_AS_192#traceroute ip

Target IP address: 200.20.20.1
Source address: 192.168.10.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 200.20.20.1

1 50.50.13.1 80 msec 120 msec 48 msec --> AS 50
2 50.50.10.1 288 msec 432 msec 192 msec
3 12.123.50.5 360 msec 264 msec 432 msec
4 30.30.10.1 528 msec 552 msec 480 msec
5 12.123.50.2 660 msec 672 msec 636 msec
R5_AS_192#

Click here to get the final configs

1 comment:

Custom Search