注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 IB客座主编(四)美国西蒙公..
 帮助

路由重分布与过滤


2008-07-25 17:16:39
 标签:路由 过滤 重分布   [推送到技术圈]

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://davidsergent.blog.51cto.com/195892/89632


第一步:分别配制RIPEIGRPOSPF协议(略)

第二步:在R1上通过路由表查看配制的正确性
R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     2.0.0.0/24 is subnetted, 4 subnets
R       2.3.1.0 [120/1] via 12.0.0.2, 00:00:05, Serial2/1
R       2.2.1.0 [120/1] via 12.0.0.2, 00:00:05, Serial2/1
R       2.1.1.0 [120/1] via 12.0.0.2, 00:00:05, Serial2/1
R       2.4.1.0 [120/1] via 12.0.0.2, 00:00:05, Serial2/1
     3.0.0.0/24 is subnetted, 6 subnets
D       3.2.1.0 [90/156160] via 13.0.0.3, 00:00:25, FastEthernet0/0
D       3.3.1.0 [90/156160] via 13.0.0.3, 00:00:25, FastEthernet0/0
D       3.1.1.0 [90/156160] via 13.0.0.3, 00:00:25, FastEthernet0/0
D       3.6.1.0 [90/156160] via 13.0.0.3, 00:00:25, FastEthernet0/0
D       3.4.1.0 [90/156160] via 13.0.0.3, 00:00:25, FastEthernet0/0
D       3.5.1.0 [90/156160] via 13.0.0.3, 00:00:25, FastEthernet0/0
     5.0.0.0/32 is subnetted, 4 subnets
O       5.4.1.1 [110/65] via 15.0.0.5, 00:00:11, Serial2/2
O       5.1.1.1 [110/65] via 15.0.0.5, 00:00:11, Serial2/2
O       5.3.1.1 [110/65] via 15.0.0.5, 00:00:11, Serial2/2
O       5.2.1.1 [110/65] via 15.0.0.5, 00:00:11, Serial2/2
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, Serial2/1
     13.0.0.0/24 is subnetted, 1 subnets
C       13.0.0.0 is directly connected, FastEthernet0/0
     15.0.0.0/24 is subnetted, 1 subnets
C       15.0.0.0 is directly connected, Serial2/2
R1#
第三步:在R1上进行路由的重分布
R1(config)#router ospf 1
R1(config-router)#redistribute eigrp 100 subnets
R1(config-router)#redistribute rip subnets
R1(config-router)#
R1(config-router)#
R1(config-router)#router rip
R1(config-router)#redistribute ospf 1 metric 2
R1(config-router)#redistribute eigrp 100 metric 3
R1(config-router)#
R1(config-router)#
R1(config-router)#router eigrp 100
R1(config-router)#redistribute rip metric 100 1 1 255 1500
R1(config-router)#redistribute ospf 1 metric 100 1 1 255 1500
R1(config-router)#
第四步:在每个路由器上查看路由重分布情况
R2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     2.0.0.0/24 is subnetted, 4 subnets
C       2.3.1.0 is directly connected, Loopback2
C       2.2.1.0 is directly connected, Loopback1
C       2.1.1.0 is directly connected, Loopback0
C       2.4.1.0 is directly connected, Loopback3
     3.0.0.0/24 is subnetted, 6 subnets
R       3.2.1.0 [120/3] via 12.0.0.1, 00:00:17, Serial2/1
R       3.3.1.0 [120/3] via 12.0.0.1, 00:00:17, Serial2/1
R       3.1.1.0 [120/3] via 12.0.0.1, 00:00:17, Serial2/1
R       3.6.1.0 [120/3] via 12.0.0.1, 00:00:17, Serial2/1
R       3.4.1.0 [120/3] via 12.0.0.1, 00:00:17, Serial2/1
R       3.5.1.0 [120/3] via 12.0.0.1, 00:00:17, Serial2/1
     5.0.0.0/32 is subnetted, 4 subnets
R       5.4.1.1 [120/2] via 12.0.0.1, 00:00:18, Serial2/1
R       5.1.1.1 [120/2] via 12.0.0.1, 00:00:18, Serial2/1
R       5.3.1.1 [120/2] via 12.0.0.1, 00:00:18, Serial2/1
R       5.2.1.1 [120/2] via 12.0.0.1, 00:00:18, Serial2/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, Serial2/1
     13.0.0.0/24 is subnetted, 1 subnets
R       13.0.0.0 [120/3] via 12.0.0.1, 00:00:18, Serial2/1
     15.0.0.0/24 is subnetted, 1 subnets
R  
R3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     2.0.0.0/24 is subnetted, 4 subnets
D EX    2.3.1.0 [170/25602816] via 13.0.0.1, 00:00:32, FastEthernet0/0
D EX    2.2.1.0 [170/25602816] via 13.0.0.1, 00:00:32, FastEthernet0/0
D EX    2.1.1.0 [170/25602816] via 13.0.0.1, 00:00:32, FastEthernet0/0
D EX    2.4.1.0 [170/25602816] via 13.0.0.1, 00:00:32, FastEthernet0/0
     3.0.0.0/24 is subnetted, 6 subnets
C       3.2.1.0 is directly connected, Loopback1
C       3.3.1.0 is directly connected, Loopback2
C       3.1.1.0 is directly connected, Loopback0
C       3.6.1.0 is directly connected, Loopback5
C       3.4.1.0 is directly connected, Loopback3
C       3.5.1.0 is directly connected, Loopback4
     5.0.0.0/32 is subnetted, 4 subnets
D EX    5.4.1.1 [170/25602816] via 13.0.0.1, 00:00:31, FastEthernet0/0
D EX    5.1.1.1 [170/25602816] via 13.0.0.1, 00:00:31, FastEthernet0/0
D EX    5.3.1.1 [170/25602816] via 13.0.0.1, 00:00:31, FastEthernet0/0
D EX    5.2.1.1 [170/25602816] via 13.0.0.1, 00:00:31, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
D EX    12.0.0.0 [170/25602816] via 13.0.0.1, 00:00:32, FastEthernet0/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.0.0.0 is directly connected, FastEthernet0/0
     15.0.0.0/24 is subnetted, 1 subnets
D EX    15.0.0.0 [170/25602816] via 13.0.0.1, 00:00:31, FastEthernet0/0
R3#
 
R5#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     2.0.0.0/24 is subnetted, 4 subnets
O E2    2.3.1.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
O E2    2.2.1.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
O E2    2.1.1.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
O E2    2.4.1.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
     3.0.0.0/24 is subnetted, 6 subnets
O E2    3.2.1.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
O E2    3.3.1.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
O E2    3.1.1.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
O E2    3.6.1.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
O E2    3.4.1.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
O E2    3.5.1.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
     5.0.0.0/24 is subnetted, 4 subnets
C       5.4.1.0 is directly connected, Loopback3
C       5.1.1.0 is directly connected, Loopback0
C       5.2.1.0 is directly connected, Loopback1
C       5.3.1.0 is directly connected, Loopback2
     12.0.0.0/24 is subnetted, 1 subnets
O E2    12.0.0.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
     13.0.0.0/24 is subnetted, 1 subnets
O E2    13.0.0.0 [110/20] via 15.0.0.1, 00:00:34, Serial2/1
     15.0.0.0/24 is subnetted, 1 subnets
C       15.0.0.0 is directly connected, Serial2/1
R5#
第五步:在R1上通过access-listroute-map进行路由过滤和重分布
R1(config)#access-list 1 permit 2.1.1.0
R1(config)#access-list 1 permit 2.2.1.0
R1(config)#access-list 1 permit 12.0.0.0
R1(config)#access-list 2 permit 2.3.1.0
R1(config)#access-list 2 permit 2.4.1.0
R1(config)#access-list 2 permit 12.0.0.0
R1(config)#access-list 3 permit 3.1.1.0
R1(config)#access-list 3 permit 3.2.1.0
R1(config)#access-list 3 permit 13.0.0.0
R1(config)#access-list 4 permit 3.3.1.0
R1(config)#access-list 4 permit 3.4.1.0
R1(config)#access-list 4 permit 13.0.0.0
R1(config)#
R1(config)#route-map 1 permit 10
R1(config-route-map)#match ip add 1
R1(config-route-map)#
R1(config-route-map)#route-map 2 permit 10
R1(config-route-map)#match ip add 2
R1(config-route-map)#
R1(config-route-map)#route-map 3 permit 10
R1(config-route-map)#match ip add 3
R1(config-route-map)#
R1(config-route-map)#route-map 4 permit 10
R1(config-route-map)#match ip add 4
R1(config-route-map)#
R1(config-route-map)#
R1(config-route-map)#
R1(config-route-map)#router ospf 1
R1(config-router)#redistribute eigrp 100 subnets route-map 4
R1(config-router)#redistribute rip subnets route-map 1
R1(config-router)#
R1(config-router)#
R1(config-router)#router rip
R1(config-router)#redistribute ospf 1 metric 2
R1(config-router)#redistribute eigrp 100 route-map 3 metric 3
R1(config-router)#
R1(config-router)#
R1(config-router)#router eigrp 100
R1(config-router)#redistribute rip route-map 2 metric 100 1 1 255 1500
R1(config-router)#redistribute ospf 1 metric 100 1 1 255 1500
 
第六步:在每个路由器上查看路由过滤和重分布情况
R2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     2.0.0.0/24 is subnetted, 4 subnets
C       2.3.1.0 is directly connected, Loopback2
C       2.2.1.0 is directly connected, Loopback1
C       2.1.1.0 is directly connected, Loopback0
C       2.4.1.0 is directly connected, Loopback3
     3.0.0.0/24 is subnetted, 2 subnets
R       3.2.1.0 [120/3] via 12.0.0.1, 00:00:02, Serial2/1
R       3.1.1.0 [120/3] via 12.0.0.1, 00:00:02, Serial2/1
     5.0.0.0/32 is subnetted, 4 subnets
R       5.4.1.1 [120/2] via 12.0.0.1, 00:00:02, Serial2/1
R       5.1.1.1 [120/2] via 12.0.0.1, 00:00:02, Serial2/1
R       5.3.1.1 [120/2] via 12.0.0.1, 00:00:02, Serial2/1
R       5.2.1.1 [120/2] via 12.0.0.1, 00:00:02, Serial2/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, Serial2/1
     13.0.0.0/24 is subnetted, 1 subnets
R       13.0.0.0 [120/3] via 12.0.0.1, 00:00:02, Serial2/1
     15.0.0.0/24 is subnetted, 1 subnets
R       15.0.0.0 [120/2] via 12.0.0.1, 00:00:02, Serial2/1
R2#
 
R3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     2.0.0.0/24 is subnetted, 2 subnets
D EX    2.3.1.0 [170/25602816] via 13.0.0.1, 00:00:08, FastEthernet0/0
D EX    2.4.1.0 [170/25602816] via 13.0.0.1, 00:00:08, FastEthernet0/0
     3.0.0.0/24 is subnetted, 6 subnets
C       3.2.1.0 is directly connected, Loopback1
C       3.3.1.0 is directly connected, Loopback2
C       3.1.1.0 is directly connected, Loopback0
C       3.6.1.0 is directly connected, Loopback5
C       3.4.1.0 is directly connected, Loopback3
C       3.5.1.0 is directly connected, Loopback4
     5.0.0.0/32 is subnetted, 4 subnets
D EX    5.4.1.1 [170/25602816] via 13.0.0.1, 00:00:08, FastEthernet0/0
D EX    5.1.1.1 [170/25602816] via 13.0.0.1, 00:00:08, FastEthernet0/0
D EX    5.3.1.1 [170/25602816] via 13.0.0.1, 00:00:09, FastEthernet0/0
D EX    5.2.1.1 [170/25602816] via 13.0.0.1, 00:00:09, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
D EX    12.0.0.0 [170/25602816] via 13.0.0.1, 00:00:09, FastEthernet0/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.0.0.0 is directly connected, FastEthernet0/0
     15.0.0.0/24 is subnetted, 1 subnets
D EX    15.0.0.0 [170/25602816] via 13.0.0.1, 00:00:09, FastEthernet0/0
 
R5#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     2.0.0.0/24 is subnetted, 2 subnets
O E2    2.2.1.0 [110/20] via 15.0.0.1, 00:00:15, Serial2/1
O E2    2.1.1.0 [110/20] via 15.0.0.1, 00:00:15, Serial2/1
     3.0.0.0/24 is subnetted, 2 subnets
O E2    3.3.1.0 [110/20] via 15.0.0.1, 00:00:15, Serial2/1
O E2    3.4.1.0 [110/20] via 15.0.0.1, 00:00:15, Serial2/1
     5.0.0.0/24 is subnetted, 4 subnets
C       5.4.1.0 is directly connected, Loopback3
C       5.1.1.0 is directly connected, Loopback0
C       5.2.1.0 is directly connected, Loopback1
C       5.3.1.0 is directly connected, Loopback2
     12.0.0.0/24 is subnetted, 1 subnets
O E2    12.0.0.0 [110/20] via 15.0.0.1, 00:00:15, Serial2/1
     13.0.0.0/24 is subnetted, 1 subnets
O E2    13.0.0.0 [110/20] via 15.0.0.1, 00:00:15, Serial2/1
     15.0.0.0/24 is subnetted, 1 subnets
C       15.0.0.0 is directly connected, Serial2/1
 
从红色字体可以看出,路由过滤的目的已经达到
 
 
附加:对EIGRP进行路由汇总
R3(config)#int f 0/0
R3(config-if)#ip summary-address eigrp 100 3.1.0.0 255.0.0.0
 
R3#sh ip route
(略)
     2.0.0.0/24 is subnetted, 2 subnets
D EX    2.3.1.0 [170/25602816] via 13.0.0.1, 00:00:26, FastEthernet0/0
D EX    2.4.1.0 [170/25602816] via 13.0.0.1, 00:00:26, FastEthernet0/0
     3.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
C       3.2.1.0/24 is directly connected, Loopback1
C       3.3.1.0/24 is directly connected, Loopback2
C       3.1.1.0/24 is directly connected, Loopback0
D       3.0.0.0/8 is a summary, 00:00:31, Null0
C       3.6.1.0/24 is directly connected, Loopback5
C       3.4.1.0/24 is directly connected, Loopback3
C       3.5.1.0/24 is directly connected, Loopback4
     5.0.0.0/32 is subnetted, 4 subnets
D EX    5.4.1.1 [170/25602816] via 13.0.0.1, 00:00:26, FastEthernet0/0
D EX    5.1.1.1 [170/25602816] via 13.0.0.1, 00:00:26, FastEthernet0/0
D EX    5.3.1.1 [170/25602816] via 13.0.0.1, 00:00:26, FastEthernet0/0
D EX    5.2.1.1 [170/25602816] via 13.0.0.1, 00:00:26, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
D EX    12.0.0.0 [170/25602816] via 13.0.0.1, 00:00:26, FastEthernet0/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.0.0.0 is directly connected, FastEthernet0/0
     15.0.0.0/24 is subnetted, 1 subnets
D EX    15.0.0.0 [170/25602816] via 13.0.0.1, 00:00:26, FastEthernet0/0
R3#
 
R1#sh ip route
(略)
     2.0.0.0/24 is subnetted, 4 subnets
R       2.3.1.0 [120/1] via 12.0.0.2, 00:00:09, Serial2/1
R       2.2.1.0 [120/1] via 12.0.0.2, 00:00:09, Serial2/1
R       2.1.1.0 [120/1] via 12.0.0.2, 00:00:09, Serial2/1
R       2.4.1.0 [120/1] via 12.0.0.2, 00:00:09, Serial2/1
D    3.0.0.0/8 [90/156160] via 13.0.0.3, 00:00:01, FastEthernet0/0
     5.0.0.0/32 is subnetted, 4 subnets
O       5.4.1.1 [110/65] via 15.0.0.5, 00:04:37, Serial2/2
O       5.1.1.1 [110/65] via 15.0.0.5, 00:04:37, Serial2/2
O       5.3.1.1 [110/65] via 15.0.0.5, 00:04:37, Serial2/2
O       5.2.1.1 [110/65] via 15.0.0.5, 00:04:37, Serial2/2
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, Serial2/1
     13.0.0.0/24 is subnetted, 1 subnets
C       13.0.0.0 is directly connected, FastEthernet0/0
     15.0.0.0/24 is subnetted, 1 subnets
C       15.0.0.0 is directly connected, Serial2/2

本文出自 “davidsergent” 博客,请务必保留此出处http://davidsergent.blog.51cto.com/195892/89632



上一篇 建立BGP互连  下一篇 pbr应用



    文章评论
 
 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: