Elements
Our
network above consists of 3 Autonomous systems; R1 R2 and R3 are in AS #123, R4
in AS #4 and R5 in AS #5
We
will advertise the same two networks toward AS #123 and we will trace the
routes as they enter AS #123
Configuration
R1#sh
run int f0/0
interface
FastEthernet0/0
ip address 10.1.12.1 255.255.255.0
speed 100
full-duplex
R1#sh
run int f0/1
interface
FastEthernet0/1
ip address 10.1.13.1 255.255.255.0
speed 100
full-duplex
R1#sh
run int lo0
interface
Loopback0
ip address 1.1.1.1 255.255.255.255
R1#sh
run | sec router ospf
router
ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 0
network 10.1.12.1 0.0.0.0 area 0
network 10.1.13.1 0.0.0.0 area 0
R1#sh
run | sec router bgp
router
bgp 123
no synchronization
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 123
neighbor 2.2.2.2 update-source Loopback0
neighbor 3.3.3.3 remote-as 123
neighbor 3.3.3.3 update-source Loopback0
no auto-summary
R2#sh
run int f0/0
interface
FastEthernet0/0
ip address 10.1.12.2 255.255.255.0
speed 100
full-duplex
R2#sh
run int s0/0
interface
Serial0/0
ip address 192.168.24.2 255.255.255.0
clock rate 64000
R2#sh
run int lo0
interface
Loopback0
ip address 2.2.2.2 255.255.255.255
R2#sh
run | sec router ospf
router
ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 10.1.12.2 0.0.0.0 area 0
R2#sh
run | sec router bgp
router
bgp 123
no synchronization
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 123
neighbor 1.1.1.1 update-source Loopback0
neighbor 192.168.24.4 remote-as 4
no auto-summary
R3#sh
run int f0/0
interface
FastEthernet0/0
ip address 10.1.13.3 255.255.255.0
speed 100
full-duplex
R3#sh
run int s0/0
interface
Serial0/0
ip address 192.168.35.3 255.255.255.0
clock rate 64000
R3#sh
run int lo0
interface
Loopback0
ip address 3.3.3.3 255.255.255.255
R3#sh
run | sec router ospf
router
ospf 1
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 10.1.13.3 0.0.0.0 area 0
R3#sh
run | sec router bgp
router
bgp 123
no synchronization
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 123
neighbor 1.1.1.1 update-source Loopback0
neighbor 192.168.35.5 remote-as 5
no auto-summary
R4#sh
run int s0/0
interface
Serial0/0
ip address 192.168.24.4 255.255.255.0
clock rate 64000
R4#sh
run int lo1
interface
Loopback1
ip address 197.10.1.4 255.255.255.0
R4#sh
run int lo2
interface
Loopback2
ip address 197.10.2.4 255.255.255.0
R4#sh
run | sec router bgp
router
bgp 4
no synchronization
bgp log-neighbor-changes
network 197.10.1.0
network 197.10.2.0
neighbor 192.168.24.2 remote-as 123
no auto-summary
R5#sh
run int s0/0
interface
Serial0/0
ip address 192.168.35.5 255.255.255.0
clock rate 64000
R5#sh
run int lo1
interface
Loopback1
ip address 197.10.1.5 255.255.255.0
R5#sh
run int lo2
interface
Loopback2
ip address 197.10.2.5 255.255.255.0
R5#sh
run | sec router bgp
router
bgp 5
no synchronization
bgp log-neighbor-changes
network 197.10.1.0
network 197.10.2.0
neighbor 192.168.35.3 remote-as 123
no auto-summary
Verification
Let
us check the status of the BGP peering (it will show on the console via Syslog
messages)
R1#sh
ip bgp summary
BGP
router identifier 1.1.1.1, local AS number 123
BGP
table version is 1, main routing table version 1
2
network entries using 234 bytes of memory
4
path entries using 208 bytes of memory
3/0
BGP path/bestpath attribute entries using 372 bytes of memory
2
BGP AS-PATH entries using 48 bytes of memory
0
BGP route-map cache entries using 0 bytes of memory
0
BGP filter-list cache entries using 0 bytes of memory
BGP
using 862 total bytes of memory
BGP
activity 2/0 prefixes, 4/0 paths, scan interval 60 secs
Neighbor V
AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2.2.2.2 4
123 32 30
1 0 0 00:27:43 2
3.3.3.3 4
123 31 29
1 0 0 00:25:31 2
R2#sh
ip bgp summary
BGP
router identifier 2.2.2.2, local AS number 123
BGP
table version is 3, main routing table version 3
2
network entries using 234 bytes of memory
2
path entries using 104 bytes of memory
2/1
BGP path/bestpath attribute entries using 248 bytes of memory
1
BGP AS-PATH entries using 24 bytes of memory
0
BGP route-map cache entries using 0 bytes of memory
0
BGP filter-list cache entries using 0 bytes of memory
BGP
using 610 total bytes of memory
BGP
activity 2/0 prefixes, 2/0 paths, scan interval 60 secs
Neighbor V
AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
1.1.1.1 4
123 30 32
3 0 0 00:27:36 0
192.168.24.4 4
4 29 27
3 0 0 00:23:39 2
R3#sh
ip bgp summary
BGP
router identifier 3.3.3.3, local AS number 123
BGP
table version is 3, main routing table version 3
2
network entries using 234 bytes of memory
2
path entries using 104 bytes of memory
2/1
BGP path/bestpath attribute entries using 248 bytes of memory
1
BGP AS-PATH entries using 24 bytes of memory
0
BGP route-map cache entries using 0 bytes of memory
0
BGP filter-list cache entries using 0 bytes of memory
BGP
using 610 total bytes of memory
BGP
activity 2/0 prefixes, 2/0 paths, scan interval 60 secs
Neighbor V
AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
1.1.1.1 4
123 30 32
3 0 0 00:26:14 0
192.168.35.5 4
5 28 26
3 0 0 00:22:43 2
R4#sh
ip bgp summary
BGP
router identifier 192.168.24.2, local AS number 4
BGP
table version is 3, main routing table version 3
2
network entries using 234 bytes of memory
2
path entries using 104 bytes of memory
2/1
BGP path/bestpath attribute entries using 248 bytes of memory
0
BGP route-map cache entries using 0 bytes of memory
0
BGP filter-list cache entries using 0 bytes of memory
BGP
using 586 total bytes of memory
BGP
activity 2/0 prefixes, 2/0 paths, scan interval 60 secs
Neighbor V
AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.24.2 4
123 28 30
3 0 0 00:24:37 0
R5#sh
ip bgp summary
BGP
router identifier 192.168.35.5, local AS number 5
BGP
table version is 3, main routing table version 3
2
network entries using 234 bytes of memory
2
path entries using 104 bytes of memory
2/1
BGP path/bestpath attribute entries using 248 bytes of memory
0
BGP route-map cache entries using 0 bytes of memory
0
BGP filter-list cache entries using 0 bytes of memory
BGP
using 586 total bytes of memory
BGP
activity 2/0 prefixes, 2/0 paths, scan interval 60 secs
Neighbor V
AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.35.3 4
123 26 28
3 0 0 00:22:59 0
Now
, let us check the routes on R2 and R3 (BGP table)
R2#sh
ip bgp
BGP
table version is 3, local router ID is 2.2.2.2
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
*> 197.10.1.0 192.168.24.4 0 0 4 i
*>
197.10.2.0 192.168.24.4 0 0 4 i
R4
receives two routes from R4 (next-hop 192.168.24.4 refers to R4) , * means
valid route and > means best route which means it will be installed in the
routing table
R2#sh
ip route bgp
B 197.10.1.0/24 [20/0] via 192.168.24.4,
00:24:08
B 197.10.2.0/24 [20/0] via 192.168.24.4,
00:23:38
And
the same on R3
R3#sh
ip bgp
BGP
table version is 3, 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
*>
197.10.1.0 192.168.35.5 0 0 5 i
*>
197.10.2.0 192.168.35.5 0 0 5 i
R3#sh
ip route bgp
B 197.10.1.0/24 [20/0] via 192.168.35.5,
00:23:56
B 197.10.2.0/24 [20/0] via 192.168.35.5,
00:23:25
We
can check also from the advertising router, check on R4
R4#sh
ip bgp neighbors 192.168.24.2 advertised-routes
BGP
table version is 3, local router ID is 192.168.24.2
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
*>
197.10.1.0 0.0.0.0 0 32768 i
*>
197.10.2.0 0.0.0.0 0
32768 i
Total
number of prefixes 2
Next
Hop of 0.0.0.0 means these routes are locally advertised
Let
us now check with R1
R1#sh
ip bgp
BGP
table version is 1, local router ID is 1.1.1.1
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
*
i197.10.1.0 192.168.35.5 0 100
0 5 i
*
i 192.168.24.4 0 100
0 4 i
*
i197.10.2.0 192.168.35.5 0 100
0 5 i
*
i 192.168.24.4 0 100
0 4 i
We
can see that no one of the routes regardless of the source R2 or R3 will be
installed in routing table (not best) , why ?
If
we checked the next-hop of the routes, they are 192.168.35.5 and 192.168.24.4,
R1 does not anything about those subnets! So it will not install a route from
unknown source!
So
we have to do something about that, we have to use the next-hop-self command on
R2 toward R1 (on R3 as well) in order for it to use R2 as a next-hop to reach
BGP routes
R2(config)#router
bgp 123
R2(config-router)#neighbor
1.1.1.1 next-hop-self
This
command as R2 is telling R1 to use him as a next hop
R3(config)#router
bgp 123
R3(config-router)#neighbor
1.1.1.1 next-hop-self
R1#sh
ip bgp
BGP
table version is 9, local router ID is 1.1.1.1
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
*
i197.10.1.0 2.2.2.2 0 100
0 4 i
*>i 3.3.3.3 0
100 0 5 i
*
i197.10.2.0 2.2.2.2 0 100
0 4 i
*>i 3.3.3.3 0 100
0 5 i
Now
we can see that the next hop changed and there are best routes (sure one route
will be best, i.e. installed in the routing table)
Now
the question arises why the routes from R3 are preferred?
We
have to go through the path selection criteria, we will stop at Lowest IGP
metric — this
criterion prefers the path with the lowest IGP metric to the BGP next hop
That
means we have to check on R1 for the metrics for the next hops: 2.2.2.2 and
3.3.3.3
R1#sh
ip route 3.3.3.3
Routing
entry for 3.3.3.3/32
Known via "ospf 1", distance 110, metric
2, type intra area
Last update from 10.1.13.3 on
FastEthernet0/1, 00:42:47 ago
Routing Descriptor Blocks:
* 10.1.13.3, from 3.3.3.3, 00:42:47 ago, via
FastEthernet0/1
Route metric is 2, traffic share count is
1
R1#sh
ip route 2.2.2.2
Routing
entry for 2.2.2.2/32
Known via "ospf 1", distance 110, metric
11, type intra area
Last update from 10.1.12.2 on
FastEthernet0/0, 00:42:51 ago
Routing Descriptor Blocks:
* 10.1.12.2, from 2.2.2.2, 00:42:51 ago, via
FastEthernet0/0
Route metric is 11, traffic share count
is 1
Lowest
metric will win, i.e. 3.3.3.3 and that what happened
Now,
let us check from R1 if it advertises any routes to his neighbors : R2 and R3
R1#sh
ip bgp neighbors 2.2.2.2 advertised-routes
Total
number of prefixes 0
R1#sh
ip bgp neighbors 3.3.3.3 advertised-routes
Total
number of prefixes 0
Nothing,
why? Split-horizon rule in BGP states that a route received from IBGP peer will
not be advertised to another IBGP peer
The
solution for this issue is either we use full mesh IBGP topology which is not
scalable or we implement the route reflector concept, i.e. R1 will act as a
route reflector for R2 and R3 (Its IBGP peers) which will disable split horizon
R1(config)#router
bgp 123
R1(config-router)#neighbor
2.2.2.2 route-reflector-client
*Mar 1 00:56:34.667: %BGP-5-ADJCHANGE: neighbor
2.2.2.2 Down RR client config change
*Mar 1 00:56:36.683: %BGP-5-ADJCHANGE: neighbor
2.2.2.2 Up
R1(config-router)#neighbor
3.3.3.3 route-reflector-client
*Mar 1 00:56:39.795: %BGP-5-ADJCHANGE: neighbor
3.3.3.3 Down RR client config change
*Mar 1 00:56:41.911: %BGP-5-ADJCHANGE: neighbor
3.3.3.3 Up
As
we can see there is no need to clear
R2#sh
ip bgp
BGP
table version is 3, local router ID is 2.2.2.2
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
*
i197.10.1.0 3.3.3.3 0 100
0 5 i
*> 192.168.24.4 0 0 4 i
*
i197.10.2.0 3.3.3.3 0 100
0 5 i
*> 192.168.24.4 0 0 4 i
Now
R2 see the routes from two next hops, the original one via 192.168.24.4 and the
new one from R3, of course the routes from 192.168.24.4 will be preferred
because they are coming from EBGP neighbor and the routes from 3.3.3.3 are IBGP
neighbors
R1#sh
ip bgp neighbors 2.2.2.2 advertised-routes
BGP
table version is 13, local router ID is 1.1.1.1
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
*>i197.10.1.0 3.3.3.3 0 100
0 5 i
*>i197.10.2.0 3.3.3.3 0 100
0 5 i
Total
number of prefixes 2
As
we can see from outputs that local preference value from IBGP peer is 100,
weight value for locally advertised routes is 32768
Suppose
we want to prefer R2 routes received on R1 using weight attribute, we want the
weight value for the 197.10.1.0/24 prefix to 100 and for 197.10.2.0/24 to be
200
R1(config)#access-list
1 permit 197.10.1.0
R1(config)#access-list
2 permit 197.10.2.0
R1(config)#route-map
W permit 10
R1(config-route-map)#match
ip address 1
R1(config-route-map)#set
weight 100
R1(config-route-map)#route-map
W permit 20
R1(config-route-map)#match
ip address 2
R1(config-route-map)#set
weight 200
router
bgp 123
R1(config-router)#neighbor
2.2.2.2 route-map W in
R1#sh
ip bgp
BGP
table version is 5, local router ID is 1.1.1.1
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
*>i197.10.1.0 2.2.2.2 0 100
100 4 i
*
i 3.3.3.3 0 100
0 5 i
*>i197.10.2.0 2.2.2.2 0 100
200 4 i
*
i 3.3.3.3 0 100
0 5 i
No comments:
Post a Comment