配置好IP地址等基本信息,配置好基本的动态路由协议,顺手把自动汇总关掉。
各路由器动态路由协议配置情况:
R1(config)#router eigrp 10
R1(config-router)#network 0.0.0.0
R1(config-router)#no au
R1(config-router)#exit
R2(config)#router eigrp 10
R2(config-router)#network 10.0.0.0
R2(config-router)#no au
R2(config-router)#exit
R2(config)#router ospf 1
R2(config-router)#network 10.1.1.4 0.0.0.3 area 0
R2(config-router)#no au
R2(config-router)#exit
R3(config)#router ospf 1
R3(config-router)#network 10.1.1.4 0.0.0.3 area 0
R3(config-router)#no au
R3(config-router)#exit
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 172.16.0.0
R3(config-router)#no au
R3(config-router)#exit
R4(config)#router rip
R4(config-router)#version 2
R4(config-router)#network 172.16.0.0
R4(config-router)#no au
R4(config-router)#exit
在R2、R3上配置路由双向重分发:
R2(config)#router eigrp 10
R2(config-router)#re ospf 1 metric 100000 10 255 1 1500
R2(config-router)#exit
R2(config)#router ospf 1
R2(config-router)#re eigrp 10 me 200 sub
R2(config-router)#exit
R3(config)#router rip
R3(config-router)#re ospf 1 me 10
R3(config-router)#exit
R3(config)#router ospf 1
R3(config-router)#re rip me 200 sub
R3(config-router)#exit
查看R4路由表,测试连接:
R4#show ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, Serial0/0
10.0.0.0/30 is subnetted, 2 subnets
R 10.1.1.0 [120/10] via 172.16.1.1, 00:00:21, Serial0/0
R 10.1.1.4 [120/10] via 172.16.1.1, 00:00:21, Serial0/0
R 192.168.0.0/24 [120/10] via 172.16.1.1, 00:00:21, Serial0/0
R 192.168.1.0/24 [120/10] via 172.16.1.1, 00:00:21, Serial0/0
R 192.168.2.0/24 [120/10] via 172.16.1.1, 00:00:21, Serial0/0
R 192.168.3.0/24 [120/10] via 172.16.1.1, 00:00:21, Serial0/0
通过重分发学习到的非RIP区域路由条目。
根据拓扑要求,192.168.0.0/24和192.168.2.0/24的网络不能被R4学习,要过滤路由,除了使用distribute-list(分发列表)和router-map(路由映射表)外,也可以使用路由标记的过滤,来实现此功能。
使用路由标记的过滤,分两步:先在服务器端路由器配置标记,再到客户端路由器根据标记进行过滤。
在R2上配置路由标记:
R2(config)#access-list 1 deny 192.168.0.0 0.0.0.255
R2(config)#access-list 1 deny 192.168.2.0 0.0.0.255
R2(config)#access-list 1 permit any
-------->这三条书上说只起匹配作用,但实际上在这里和正常的ACL是一样地起作用
R2(config)#route-map set-teg per 10
R2(config-route-map)#match ip add 1 ----->这个1指ACL
R2(config-route-map)#set tag 1
R2(config-route-map)#exit
R2(config)#router ospf 1
R2(config-router)#redistribute eigrp 10 subnet route-map set-teg
R2(config-router)#exit
在R3上,配置route-map通过标记来过滤路由:
R3(config)#route-map match-tag permit 10
R3(config-route-map)#match tag 1
R3(config-route-map)#exit
R3(config)#route-map match-tag permit 20 ----->匹配所有,目的是放行10.1.1.4/30这条
R3(config-route-map)#exit
R3(config)#router rip
R3(config-router)#re ospf 1 me 10 route-map match-tag
R3(config-router)#exit
查看R4路由表:
R4#show ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, Serial0/0
10.0.0.0/30 is subnetted, 1 subnets
R 10.1.1.0 [120/10] via 172.16.1.1, 00:00:22, Serial0/0
R 10.1.1.4 [120/10] via 172.16.1.1, 00:00:14, Serial0/0
R 192.168.1.0/24 [120/10] via 172.16.1.1, 00:00:22, Serial0/0
R 192.168.3.0/24 [120/10] via 172.16.1.1, 00:00:22, Serial0/0
路由过滤正常。
到此完成。
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
- * - * - * - * - * - * - * - * - * 这里是分隔线 - * - * - * - * - * - * - * - * - * -
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
这里有点和理论不一样,也不知道是IOS版本原因还是什么情况,理论情况是上面的ACL不起拒绝和允许作用,只起匹配作用
也就是在ACL里的permit和deny是一样的,但是在这里还是得按单词意思来,否则通不过,感觉在这个地方标记还没起什么作用
如果有更好的解释,望赐教 ——20120222上午标记
理论做法:
在 R2 上配置分配路由标记:
R2(config)# access-list 1 permit 192.168.0.0 0.0.0.255
R2(config)# access-list 1 permit 192.168.2.0 0.0.0.255 ------>使用ACL 标识出需要设置标记的路由。
R2(config)# route-map set_tag permit 10
R2(config-route-map)# match ip address 1
R2(config-route-map)# set tag 1 ------>为匹配 ACL 1 的路由条目,分配标记为 1。
R2(config-route-map)# exit
R2(config)# route-map set_tag permit 20
R2(config-route-map)# exit
R2(config)# router ospf 1
R2(config-router)# redistribute eigrp 10 subnets route-map set_tag
---->在路由重发布时调用路由映射,进行标记的嵌入。
R2(config-router)# exit
在 R3 上,配置 route-map 通过标记来进行路由过滤:
R3(config)# route-map match_tag deny 10
R3(config-route-map)# match tag 1 ---->对于标记为1的路由进行过滤处理
R3(config-route-map)# exit
R3(config)#
R3(config)# route-map match_tag permit 20 ---->其它的路由无条件转发
R3(config-route-map)# exit
R3(config)#
R3(config)# router rip
R3(config-router)# redistribute ospf 1 metric 10 route-map match_tag ----->调用
R3(config-router)# exit
不过以上做法在我这里行不能,有空再验证一次。
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
- * - * - * - * - * - * - * - * - * 这里是分隔线 - * - * - * - * - * - * - * - * - * -
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
想通了,验证了,理论也是对的,我也是对的,按以上方法也行,是我上午做的不对。 ——2012022下午标记