A-A+
基于包大小的策略路由和动态路由器的实验
组网的拓扑图和采用的路由模拟软件如下:
本文的实验采用的交换机是H3C模拟器,从官网上下载的。
【组网需求】
R1,R2,R3,R4之间跑动态路由。
从R1的S0/6/3进来的数据包:
长度为1-63的走192.168.12.2
长度为64-10000的走192.168.13.2
其他长度的报文按路由表查找。
【配置信息】
- R1:
- interface Serial0/6/0
- link-protocol ppp
- ip address 192.168.12.1 255.255.255.0
- #
- interface Serial0/6/1
- link-protocol ppp
- ip address 192.168.13.1 255.255.255.0
- #
- interface Serial0/6/2
- link-protocol ppp
- #
- interface Serial0/6/3
- link-protocol ppp
- ip address 172.16.15.1 255.255.255.0
- ip policy-based-route lab1
- #
- #
- ospf 1
- area 0.0.0.0
- network 192.168.12.0 0.0.0.255
- network 192.168.13.0 0.0.0.255
- network 172.16.15.0 0.0.0.255
- #
- policy-based-route lab1 permit node 10
- if-match packet-length 1 63
- apply ip-address next-hop 192.168.12.2
- policy-based-route lab1 permit node 20
- if-match packet-length 64 10000
- apply ip-address next-hop 192.168.13.2
- #
- R2:
- interface Serial0/6/0
- link-protocol ppp
- ip address 192.168.12.2 255.255.255.0
- #
- interface Serial0/6/1
- link-protocol ppp
- ip address 192.168.24.1 255.255.255.0
- #
- ospf 1
- area 0.0.0.0
- network 192.168.24.0 0.0.0.255
- network 192.168.12.0 0.0.0.255
- R3:
- interface Serial0/6/0
- link-protocol ppp
- ip address 192.168.34.1 255.255.255.0
- #
- interface Serial0/6/1
- link-protocol ppp
- ip address 192.168.13.2 255.255.255.0
- #
- ospf 1
- area 0.0.0.0
- network 192.168.13.0 0.0.0.255
- network 192.168.34.0 0.0.0.255
- #
- R4:
- #
- interface Serial0/6/0
- link-protocol ppp
- ip address 192.168.34.2 255.255.255.0
- http://www.xiaoxiongboke.com
- #
- interface Serial0/6/1
- link-protocol ppp
- ip address 192.168.24.2 255.255.255.0
- #
- interface NULL0
- #
- interface LoopBack0
- ip address 10.1.1.1 255.255.255.255
- #
- ospf 1
- area 0.0.0.0
- network 192.168.24.0 0.0.0.255
- network 192.168.34.0 0.0.0.255
- network 10.1.1.1 0.0.0.0
- #
- R5:
- #
- interface Serial0/6/3
- link-protocol ppp
- ip address 172.16.15.2 255.255.255.0
- ip route-static 0.0.0.0 0.0.0.0 172.16.15.1
【验证】
在R5上ping 10.1.1.1 在R1上开启debugging 信息
- <R5>ping 10.1.1.1
- PING 10.1.1.1: 56 data bytes, press CTRL_C to
- break
- Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=253
- time=4 ms
- Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=253
- time=4 ms
- Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=253
- time=10 ms
- Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=253
- time=10 ms
- Request time out
- --- 10.1.1.1 ping statistics ---
- 5 packet(s) transmitted
- 4 packet(s) received
- 20.00% packet loss
- round-trip min/avg/max = 4/7/10 ms
- <R1>
- *Feb 28 19:51:51:578 2013 R1 PBR/7/POLICY-ROUTING:IP
- policy based routing success : POLICY_ROUTEMAP :
- lab1, Node : 20, next-hop : 192.168.13.2
- *Feb 28 19:51:51:781 2013 R1 PBR/7/POLICY-ROUTING:IP
- policy based routing success : POLICY_ROUTEMAP :
- lab1, Node : 20, next-hop : 192.168.13.2
- *Feb 28 19:51:51:984 2013 R1 PBR/7/POLICY-ROUTING:IP
- policy based routing success : POLICY_ROUTEMAP :
- lab1, Node : 20, next-hop : 192.168.13.2
- *Feb 28 19:51:52:187 2013 R1 PBR/7/POLICY-ROUTING:IP
- policy based routing success : POLICY_ROUTEMAP :
- lab1, Node : 20, next-hop : 192.168.13.2
- *Feb 28 19:51:52:406 2013 R1 PBR/7/POLICY-ROUTING:IP
- policy based routing success : POLICY_ROUTEMAP :
- lab1, Node : 20, next-hop : 192.168.13.2
- <R5>
如上,如果按照R1的路由表,都应当走 192.168.12.2 ,但是因为有策略路由,下一跳指向了192.168.13.2 实验完成
- <R1>dis ip ro
- Routing Tables: Public
- Destinations : 14 Routes : 15
- Destination/Mask Proto Pre Cost NextHop Interface
- 10.1.1.1/32 OSPF 10 3124 192.168.12.2 S0/6/0
- OSPF 10 3124 192.168.13.2 S0/6/1