路由映射三

                   路由映射实战二
本篇博文和上一篇是紧密结合的,只是在上个试验的基础上作了改动,达到其他的试验效果。
 
试验二:
R1 上增加一个网段,并发布路由。这里采用三种方法。
如下是第一种,是在试验一的基础上直接增加一个网段,发布路由。
 
A(config)#int lo2
A(config-if)#ip addr 192.168.30.1 255.255.255.0
A(config-if)#exit
A(config)#router eigrp 100
A(config-router)#net 192.168.30.0
分别在 R2 ,R3 上做测试:
正常情况下,
R2 上是能学习到路由, R3 上不能学到路由。
 
B#
B#show ip ro
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
 
D    192.168.30.0/24 [90/2297856] via 202.110.100.1, 00:00:21, Serial1/0    // 新学到的路由。
C    202.110.100.0/24 is directly connected, Serial1/0
C    202.110.101.0/24 is directly connected, Serial1/1
D    192.168.10.0/24 [90/2297856] via 202.110.100.1, 00:16:44, Serial1/0
D    192.168.20.0/24 [90/2297856] via 202.110.100.1, 00:16:44, Serial1/0
 
 
C>en
C#show ip ro
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
 
C    202.110.101.0/24 is directly connected, Serial1/1
R    192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:18, Serial1/1
R    192.168.20.0/24 [120/5] via 202.110.101.1, 00:00:18, Serial1/1
解决方案:在 B 上重新做路由映射,及路由的再发布。
 
B(config)#route-map abc permit 30
B(config-route-map)#match ip addr 3
B(config-route-map)#set metric 10
B(config-route-map)#exit
B(config)#access-list 3 permit 192.168.30.0 0.0.0 .255
B(config)#router rip
B(config-router)#redistribute eigrp 100 route-map abc
C 上做测试 ;
 
C#show ip ro
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
 
R    192.168.30.0/24 [120/10] via 202.110.101.1, 00:00:10, Serial1/1
C    202.110.101.0/24 is directly connected, Serial1/1
R    192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:10, Serial1/1
R    192.168.20.0/24 [120/5] via 202.110.101.1, 00:00:10, Serial1/1
 
第二种方法
在访问控制列表中做文章,一个列表放两个路由,
 
 
  B(config)#route-map abc permit 20
B(config-route-map)#match ip addr 2
B(config-route-map)#set metric 5
B(config-route-map)#exit
B(config)#access-list 2 permit 192.168.30.0   0.0.0 .255
B(config)#
B(config)#router rip
B(config-router)#redistribute eigrp 100 route-map abc
B(config-router)#
C 上再次做测试:
 
 
C#show ip ro
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
 
R    192.168.30.0/24 [120/5] via 202.110.101.1, 00:00:12, Serial1/1
注意:学到的路由种子度量和 20 网段的种子度量相同。
C    202.110.101.0/24 is directly connected, Serial1/1
R    192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:12, Serial1/1
R    192.168.20.0/24 [120/5] via 202.110.101.1, 00:00:12, Serial1/1
 
方法三:
路由再发布时,满足 1 号表的路由,修改度量值为 3 ,不满足 1 号表的路由,修改度量值为 5. (即对有 set match 的应用)
B(config)#route-map abc permit 10
B(config-route-map)#match ip addr 1
B(config-route-map)#set metric 3
 
B(config)#route-map abc permit 20
B(config-route-map)#no match ip addr 2
B(config-route-map)#set metric 5
这里还可以采用不配置20网段的访问控制列表,效果是一样的,并不冲突。
 
C路由器上做测试:
 
 
 
R    192.168.30.0/24 [120/5] via 202.110.101.1, 00:00:12, Serial1/1
R    202.110.100.0/24 [120/5] via 202.110.101.1, 00:00:12, Serial1/1
C    202.110.101.0/24 is directly connected, Serial1/1
R    192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:12, Serial1/1
R    192.168.20.0/24 [120/5] via 202.110.101.1, 00:00:12, Serial1/1
因为利用上一种方法时 30 网段的种子度量是 5 ,此时 30 网段种子度量也是 5 ,显然有点不清楚,下面利用同样的方法将 30 网段的种子度量该为 3 。由于利用再发布是一样的,所以只需要将 10 网段和 20 网段对应的 match set 调整一下即可。
R2 做操作:
 
B(config)#route-map abc permit 20
B(config-route-map)# match ip addr 2     // 启用 20 网段的 match
B(config-route-map)#set metric 5
 
R3 上测试:
 
R    192.168.30.0/24 [120/3] via 202.110.101.1, 00:00:23, Serial1/1   // 试验结果在我们预料之中。
R    202.110.100.0/24 [120/3] via 202.110.101.1, 00:00:23, Serial1/1
C    202.110.101.0/24 is directly connected, Serial1/1
R    192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:23, Serial1/1
R    192.168.20.0/24 [120/3] via 202.110.101.1, 00:00:23, Serial1/1
 
试验三:在发布过程中,满足 1 号表的路由,修改种子度量为 3 ,满足 2 号表的路由,使用默认属性正常发布。
R2 上修改:(理解默认属性:即 match set 均不配置)
 
B(config-route-map)#route-map abc permit 10
B(config-route-map)#no  match ip addr 1   
B(config-route-map)#set metric 3
 
B(config)#route-map abc permit 20
B(config-route-map)#no  match ip addr 2
B(config-route-map)#no set metric 5
由于 10 网段在 route-map abc permit 10  ,它里面包含的 match set 语句,正常情况下, R3 应该只能学到 10 网段的路由,而 20 30 网段属于默认属性,满足表 2 ,应该学习不到路由。
 
Gateway of last resort is not set
 
C    202.110.101.0/24 is directly connected, Serial1/1
R    192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:08, Serial1/1
试验现象和我们的理论分析完全吻合。
 
有set无match的情况我们看到了,那么有match无set会怎样呢???
 
 
R3只能学到匹配10网段的路由。呵呵,学习!其乐无穷啊!!加油吧!

你可能感兴趣的:(职场,休闲,路由映射)