路由映射实战
 
 
试验环境:
R1上配置三个环回口,模拟路由器R1的其他网段,R2为边缘路由器
 
A上做:(A的环境是eigrp环境)
 
Router(config)#
Router(config)#host A
A(config)#int lo0
A(config-if)#ip addr 192.168.10.1 255.255.255.0
A(config-if)#int lo1
A(config-if)#ip addr 192.168.20.1 255.255.255.0
A(config-if)#int s1/0
A(config-if)#ip addr 202.110.100.1 255.255.255.0
A(config-if)#encap hdlc
A(config-if)#clock rate 56000
A(config-if)#no shut
A(config-if)#exit
A(config)#
*Apr 18 15:24:24.683: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
 
*Apr 18 15:24:25.687: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
A(config)#router eigrp 100
A(config-router)#net 192.168.10.0
A(config-router)#net 192.168.20.0
A(config-router)#net 202.110.100.0
B上的操作:
b(config)#host B
B(config)#int s1/0
B(config-if)#ip addr 202.110.100.2 255.255.255.0
B(config-if)#encap hdlc
B(config-if)#no shut
B(config-if)#
*Apr 18 15:26:24.051: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
*Apr 18 15:26:25.055: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
B(config-if)#int s1/1
B(config-if)#ip addr 202.110.101.1 255.255.255.0
B(config-if)#encap hdlc
B(config-if)#clock rate 56000
B(config-if)#no shut
B(config-if)#
*Apr 18 15:27:16.091: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up
*Apr 18 15:27:17.095: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
边缘路由器的左端口为eigrp环境,右端口为rip环境。
B(config)#router eigrp 100
B(config-router)#net 202.110.100.0
 
B(config-router)#router rip
B(config-router)#net 202.110.101.0
 
C上的操作:
C(config)#int  s1/1
C(config-if)#ip addr 202.110.101.2 255.255.255.0
C(config-if)#encap hdlc
C(config-if)#no shut
C(config-if)#
*Apr 18 15:29:52.479: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up
C(config-if)#
*Apr 18 15:29:53.483: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
C(config-if)#router rip
C(config-router)#net 202.110.101.0
C(config-router)#exit
C(config)#exit
 
 
 
 
C上测试:正常情况下,C是学习不到A192网段路由。
 
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
 
C    202.110.101.0/24 is directly connected, Serial1/1
 
需要在边缘路由器B上做路由发布,首先建立route-map表,结合访问控制列表,做路由映射。其中路由映射表名是abc,行号10,匹配访问控制列表1,种子度量3.
 
 
B(config-router)#exit
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)#exit
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)#acce
B(config)#access-list 1 permit 192.168.10.0 0.0.0.255
B(config)#access-list 2 permit 192.168.20.0 0.0.0.255
B(config)#
B(config)#router rip
B(config-router)#redistribute eigrp 100 route-map abc
再次到R3上做测试:
 
 
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:14, Serial1/1
R    192.168.20.0/24 [120/5] via 202.110.101.1, 00:00:14, Serial1/1