分类: 系统运维
2009-06-29 21:05:30
实验目的:
1、掌握基于Route-map的路由过滤配置方法。
2、掌握route-map的命令语法。
实验拓扑图:
实验步骤及要求:
1、配置各台路由器的IP地址,并且使用Ping命令确认各路由器的直连口的互通性。
2、按照拓扑配置OSPF和RIP v2的路由协议。并关闭RIP v2的自动汇总。
3、在R2上配置路由重发布。
4、查看R1和R3的路由表:
R1#show ip route Gateway of last resort is not set 172.16.0.0/30 is subnetted, 5 subnets C 172.16.255.0 is directly connected, Serial1/1 C 172.16.0.0 is directly connected, Loopback0 C 172.16.1.0 is directly connected, Loopback0 C 172.16.2.0 is directly connected, Loopback0 C 172.16.3.0 is directly connected, Loopback0 O E2 192.168.255.0/24 [110/200] via 172.16.255.2, 00:00:15, Serial1/1 O E2 192.168.0.0/24 [110/200] via 172.16.255.2, 00:00:15, Serial1/1 O E2 192.168.1.0/24 [110/200] via 172.16.255.2, 00:00:15, Serial1/1 O E2 192.168.2.0/24 [110/200] via 172.16.255.2, 00:00:15, Serial1/1 O E2 192.168.3.0/24 [110/200] via 172.16.255.2, 00:00:15, Serial1/1 |
R3#show ip route Gateway of last resort is not set 172.16.0.0/30 is subnetted, 5 subnets R 172.16.255.0 [120/10] via 192.168.255.2, 00:00:01, Serial1/0 R 172.16.0.0 [120/10] via 192.168.255.2, 00:00:01, Serial1/0 R 172.16.1.0 [120/10] via 192.168.255.2, 00:00:01, Serial1/0 R 172.16.2.0 [120/10] via 192.168.255.2, 00:00:01, Serial1/0 R 172.16.3.0 [120/10] via 192.168.255.2, 00:00:01, Serial1/0 C 192.168.255.0/24 is directly connected, Serial1/0 C 192.168.0.0/24 is directly connected, Loopback0 C 192.168.1.0/24 is directly connected, Loopback0 C 192.168.2.0/24 is directly connected, Loopback0 C 192.168.3.0/24 is directly connected, Loopback0 |
5、根据拓扑的需要,在R2上配置路由过滤,以过滤OSPF的路由。配置如下:
R2(config)#access-list 1 deny 172.16.0.0 0.0.0.255 R2(config)#access-list 1 deny 172.16.1.0 0.0.0.255 R2(config)#access-list 1 permit any R2(config)# R2(config)#route-map ospf_to_rip permit 10 R2(config-route-map)#match ip address 1 R2(config-route-map)#exit R2(config)#router rip R2(config-router)#redistribute ospf 1 metric 10 route-map ospf_to_rip R2(config-router)#exit R2(config)#exit |
6、查看R3的路由,确认路由的学习:
R3#show ip route Gateway of last resort is not set 172.16.0.0/30 is subnetted, 3 subnets R 172.16.255.0 [120/10] via 192.168.255.2, 00:00:05, Serial1/0 R 172.16.2.0 [120/10] via 192.168.255.2, 00:00:05, Serial1/0 R 172.16.3.0 [120/10] via 192.168.255.2, 00:00:05, Serial1/0 C 192.168.255.0/24 is directly connected, Serial1/0 C 192.168.0.0/24 is directly connected, Loopback0 C 192.168.1.0/24 is directly connected, Loopback0 C 192.168.2.0/24 is directly connected, Loopback0 C 192.168.3.0/24 is directly connected, Loopback0 R3# |
7、配置R2过滤RIP的路由:
R2(config)#access-list 2 permit 192.168.2.0 0.0.0.255 R2(config)#access-list 2 permit 192.168.3.0 0.0.0.255 R2(config)# R2(config)#route-map rip_to_ospf deny 10 R2(config-route-map)#match ip address 2 R2(config-route-map)#exit R2(config)#route-map rip_to_ospf permit 20 R2(config-route-map)#exit R2(config)# R2(config)#router ospf 1 R2(config-router)#redistribute rip metric 200 subnets route-map rip_to_ospf R2(config-router)#exit R2(config)#exit R2# |
8、查看R1的路由表:
R1#show ip route Gateway of last resort is not set 172.16.0.0/30 is subnetted, 5 subnets C 172.16.255.0 is directly connected, Serial1/1 C 172.16.0.0 is directly connected, Loopback0 C 172.16.1.0 is directly connected, Loopback0 C 172.16.2.0 is directly connected, Loopback0 C 172.16.3.0 is directly connected, Loopback0 O E2 192.168.255.0/24 [110/200] via 172.16.255.2, 00:19:20, Serial1/1 O E2 192.168.0.0/24 [110/200] via 172.16.255.2, 00:19:20, Serial1/1 O E2 192.168.1.0/24 [110/200] via 172.16.255.2, 00:19:20, Serial1/1 R1# |
9、实验完成。