分类: 系统运维
2009-06-29 21:04:13
实验目的:
1、掌握基于distribute命令的路由过滤配置方法。
实验拓扑图:
实验步骤及要求:
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 R1# |
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 R3# |
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)#router rip R2(config-router)#distribute-list 1 out ospf 1 R2(config-router)#exit R2(config)# |
6、查看R3的路由,进行确认:
R3#show ip route Gateway of last resort is not set R 172.16.255.0 [120/10] via 192.168.255.2, 00:00:02, Serial1/0 R 172.16.2.0 [120/10] via 192.168.255.2, 00:00:02, Serial1/0 R 172.16.3.0 [120/10] via 192.168.255.2, 00:00:02, 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 deny 192.168.2.0 0.0.0.255 R2(config)#access-list 2 deny 192.168.3.0 0.0.0.255 R2(config)#access-list 2 permit any R2(config)#router ospf 1 R2(config-router)#distribute-list 2 out rip R2(config-router)#exit |
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、实验完成。