R1#show ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.1/32 is directly connected, Loopback0
C 1.0.0.0/24 is directly connected, Loopback1
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/11] via 172.16.12.2, 00:00:48, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 172.16.13.3, 00:00:48, FastEthernet0/1
4.0.0.0/32 is subnetted, 1 subnets
O E2 4.4.4.4 [110/1] via 172.16.12.2, 00:00:48, FastEthernet0/0
5.0.0.0/32 is subnetted, 1 subnets
O E2 5.5.5.5 [110/1] via 172.16.13.3, 00:00:48, FastEthernet0/1
6.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O E2 6.6.6.6/32 [110/1] via 172.16.13.3, 00:00:48, FastEthernet0/1
O E2 6.0.0.0/24 [110/1] via 172.16.13.3, 00:00:49, FastEthernet0/1
172.16.0.0/24 is subnetted, 3 subnets
O 172.16.23.0 [110/20] via 172.16.13.3, 00:00:49, FastEthernet0/1
[110/20] via 172.16.12.2, 00:00:49, FastEthernet0/0
C 172.16.12.0 is directly connected, FastEthernet0/0
C 172.16.13.0 is directly connected, FastEthernet0/1
R5#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 2.2.2.2/32 35.0.0.3 0 123 i
* 45.0.0.4 0 4 123 i
* 3.3.3.3/32 45.0.0.4 0 4 123 i
*> 35.0.0.3 0 0 123 i
*> 4.4.4.4/32 45.0.0.4 0 0 4 i
*> 5.5.5.5/32 0.0.0.0 0 32768 i
*> 6.0.0.0/24 56.0.0.6 0 0 6 i
*> 6.6.6.6/32 56.0.0.6 0 0 6 i
* 172.16.1.0/24 45.0.0.4 0 4 123 i
*> 35.0.0.3 11 0 123 i
* 172.16.2.0/24 45.0.0.4 0 4 123 i
*> 35.0.0.3 0 123 i
* 172.16.3.0/24 45.0.0.4 0 4 123 i
*> 35.0.0.3 0 0 123 i
R5#show ip route
35.0.0.0/24 is subnetted, 1 subnets
C 35.0.0.0 is directly connected, Serial0/0
2.0.0.0/32 is subnetted, 1 subnets
B 2.2.2.2 [20/0] via 35.0.0.3, 00:43:42
3.0.0.0/32 is subnetted, 1 subnets
B 3.3.3.3 [20/0] via 35.0.0.3, 00:43:42
4.0.0.0/32 is subnetted, 1 subnets
B 4.4.4.4 [20/0] via 45.0.0.4, 00:43:42
5.0.0.0/32 is subnetted, 1 subnets
C 5.5.5.5 is directly connected, Loopback0
6.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
B 6.6.6.6/32 [20/0] via 56.0.0.6, 00:43:42
B 6.0.0.0/24 [20/0] via 56.0.0.6, 00:43:42
172.16.0.0/24 is subnetted, 3 subnets
B 172.16.1.0 [20/11] via 35.0.0.3, 00:06:35
B 172.16.2.0 [20/0] via 35.0.0.3, 00:11:07
B 172.16.3.0 [20/0] via 35.0.0.3, 00:08:30
56.0.0.0/24 is subnetted, 1 subnets
C 56.0.0.0 is directly connected, Serial0/2
45.0.0.0/24 is subnetted, 1 subnets
C 45.0.0.0 is directly connected, FastEthernet0/0
可以看到,R1中使用R3作为AS 6中6.0.0.0/24的下一跳;同样,R5使用R3作为R1、R2网络的下一跳。这都是我们之前制定策略不允许的。
为满足需要,做了以下修改:
R2(config)#
router bgp 123
aggregate-address 172.16.0.0 255.255.252.0 summary-only
R3(config)#
router ospf 100
redistribute bgp 123 metric 20 subnets
router bgp 123
aggregate-address 172.16.0.0 255.255.252.0 suppress-map ADVERTISE_ROUTE
neighbor 35.0.0.5 route-map SET_LOCAL_PREF_RM in
neighbor 35.0.0.5 route-map SET_AS_PATH_RM out
!
ip as-path access-list 20 permit 5$
!
ip prefix-list SET_AS_PATH_PL description PERMIT LOCAL PREFIX-LIST
ip prefix-list SET_AS_PATH_PL seq 5 permit 172.16.3.0/24
ip prefix-list SET_AS_PATH_PL seq 10 permit 3.3.3.3/32
!
route-map SET_AS_PATH_RM permit 10
match ip address prefix-list SET_AS_PATH_PL
!
route-map SET_AS_PATH_RM permit 20
set origin incomplete
set as-path prepend 123
!
route-map ADVERTISE_ROUTE deny 10
match ip address prefix-list SET_AS_PATH_PL
!
route-map ADVERTISE_ROUTE permit 20
!
route-map SET_LOCAL_PREF_RM permit 10
match as-path 20
set local-preference 200
!
route-map SET_LOCAL_PREF_RM permit 20
set local-preference 50
首先,绿色字体代表了入流量的负载均衡。由于R2仅仅通告了汇总路由;而R3中做了两项工作:一、通告次优的汇总路由(通过route-map增加了as-path长度和修改了origin值);二、通告了唯一一条本地具体路由(红色字体部分)。注意suppress-map的作用是抑制策略中所有前缀在aggregate-address后的通告,这里仅允许R3本地前缀172.16.3.0/24向外通告。对于AS 5的路由器R5而言,R3本地的路由在路由表中是唯一的详细条目,因此到达R3本地网络采用R3的链路,其余的由于R2策略更优,因此采用R2的链路:
R5#show ip bgp
Network Next Hop Metric LocPrf Weight Path
* 2.2.2.2/32 35.0.0.3 0 123 123 ?
*> 45.0.0.4 0 4 123 i
* 3.3.3.3/32 45.0.0.4 0 4 123 i
*> 35.0.0.3 0 0 123 i
*> 4.4.4.4/32 45.0.0.4 0 0 4 i
*> 5.5.5.5/32 0.0.0.0 0 32768 i
*> 6.0.0.0/24 56.0.0.6 0 0 6 i
*> 6.6.6.6/32 56.0.0.6 0 0 6 i
*> 172.16.0.0/22 45.0.0.4 0 4 123 i
* 35.0.0.3 0 0 123 123 ?
*> 172.16.3.0/24 35.0.0.3 0 0 123 i
R5#show ip route
35.0.0.0/24 is subnetted, 1 subnets
C 35.0.0.0 is directly connected, Serial0/0
2.0.0.0/32 is subnetted, 1 subnets
B 2.2.2.2 [20/0] via 45.0.0.4, 01:21:42
3.0.0.0/32 is subnetted, 1 subnets
B 3.3.3.3 [20/0] via 35.0.0.3, 01:18:57
4.0.0.0/32 is subnetted, 1 subnets
B 4.4.4.4 [20/0] via 45.0.0.4, 01:21:42
5.0.0.0/32 is subnetted, 1 subnets
C 5.5.5.5 is directly connected, Loopback0
6.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
B 6.6.6.6/32 [20/0] via 56.0.0.6, 01:21:42
B 6.0.0.0/24 [20/0] via 56.0.0.6, 01:21:42
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
B 172.16.0.0/22 [20/0] via 45.0.0.4, 01:21:42
B 172.16.3.0/24 [20/0] via 35.0.0.3, 01:21:42
56.0.0.0/24 is subnetted, 1 subnets
C 56.0.0.0 is directly connected, Serial0/2
45.0.0.0/24 is subnetted, 1 subnets
C 45.0.0.0 is directly connected, FastEthernet0/0
其次,为解决R1路由表的问题,采用了Local-Pref + weight的方式。其中R3把最终AS为5的路由weight置为200,使其大于默认weight值0;然后把所有的路由Local-Pref置为50,小于默认值100。这样本AS内所有的iBGP peer都认为R3不是合适的网关。这点可以从R2的BGP表中看出:
R2#show ip bgp
*> 2.2.2.2/32 0.0.0.0 0 32768 i
r>i3.3.3.3/32 3.3.3.3 0 100 0 i
*> 4.4.4.4/32 24.0.0.4 0 0 4 i
* i5.5.5.5/32 3.3.3.3 0 50 0 5 i
*> 24.0.0.4 0 4 5 i
*> 6.0.0.0/24 24.0.0.4 0 4 5 6 i
*> 6.6.6.6/32 24.0.0.4 0 4 5 6 i
r> 172.16.0.0/22 0.0.0.0 32768 i
r i 3.3.3.3 0 100 0 i
s> 172.16.1.0/24 172.16.12.1 11 32768 i
s> 172.16.2.0/24 0.0.0.0 0 32768 i
r>i172.16.3.0/24 3.3.3.3 0 100 0 i
现在R1的路由表应该满足我们的要求了:
R1#show ip route
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/11] via 172.16.12.2, 02:10:47, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 172.16.13.3, 02:10:47, FastEthernet0/1
4.0.0.0/32 is subnetted, 1 subnets
O E2 4.4.4.4 [110/1] via 172.16.12.2, 00:13:15, FastEthernet0/0
5.0.0.0/32 is subnetted, 1 subnets
O E2 5.5.5.5 [110/1] via 172.16.12.2, 00:00:02, FastEthernet0/0
6.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O E2 6.6.6.6/32 [110/1] via 172.16.12.2, 00:13:15, FastEthernet0/0
O E2 6.0.0.0/24 [110/1] via 172.16.12.2, 00:13:15, FastEthernet0/0
172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks
O 172.16.23.0/24 [110/20] via 172.16.13.3, 02:10:48, FastEthernet0/1
[110/20] via 172.16.12.2, 02:10:48, FastEthernet0/0
C 172.16.12.0/24 is directly connected, FastEthernet0/0
C 172.16.13.0/24 is directly connected, FastEthernet0/1
O E2 172.16.0.0/22 [110/20] via 172.16.13.3, 00:00:02, FastEthernet0/1
C 172.16.1.0/24 is directly connected, Loopback1
O 172.16.2.0/24 [110/11] via 172.16.12.2, 02:10:48, FastEthernet0/0
O 172.16.3.0/24 [110/11] via 172.16.13.3, 02:10:48, FastEthernet0/1
黄色条目可以通过重分配的route-map去掉。当然不去掉也没什么关系,因为实验的汇总并不十分正确,正常情况下应该是汇总里所有具体条目都确确实实存在的。不过无论如何,本实验通过aggregate-address的策略及细化,实现了对外AS入流量的负载均衡。其中失误的地方敬请指教。
|
0人
|
了这篇文章 |
类别: 路由┆阅读(
0)┆评论(
0) ┆ 返回博主首页┆ 返回博客首页
上一篇 Internet路由结构学习心得一:通告汇聚和具体.. 下一篇 一名漂泊在外的蚁族写给农民工父亲的忏悔信
每日博报 精彩不止一点