【拓扑及所用软件】
本文实验采用的交换机是H3C模拟器,下载地址如下:http://forum.h3c.com/forum.php? mod=viewthread&tid=109740&highlight=H3C%E6%A8%A1%E6%8B%9F%E5%99%A8 有兴趣的朋 友可以在论坛上去下载
【需求】
R1分别与R2,R3如上图直连,R2与R3路由不可达,通过策略路由控制从R1发出的报文,所有TCP报文均通过串口S0/6/0发送,其他报文仍然按照查找路由表的方式进行转发
【配置】
R1:
#
acl number 3101
rule 0 permit tcp
#
interface Serial0/6/0
link-protocol ppp
ip address 10.1.1.1 255.255.255.0
#
interface Serial0/6/1
link-protocol ppp
ip address 10.1.2.1 255.255.255.0
#
policy-based-route 123 permit node 5
if-match acl 3101
apply output-interface Serial0/6/0
R2:
telnet server enable
interface Serial0/6/0
link-protocol ppp
ip address 10.1.1.2 255.255.255.0
#
user-interface con 0
user-interface vty 0 4
authentication-mode none
R3:
#
telnet server enable
#
interface Serial0/6/1
link-protocol ppp
ip address 10.1.2.2 255.255.255.0
#
user-interface con 0
user-interface vty 0 4
authentication-mode none
【结果验证】
1、先从R1本地发出ICMP报文:
<R1>ping 10.1.1.2
PING 10.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.2: bytes=56 Sequence=1 ttl=255 time=10 ms
Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=255 time=14 ms
Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=255 time=25 ms
Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=255 time=26 ms
Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=255 time=10 ms
--- 10.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/17/26 ms
<R1>ping 10.1.2.2
PING 10.1.2.2: 56 data bytes, press CTRL_C to break
Request time out
Reply from 10.1.2.2: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 10.1.2.2: bytes=56 Sequence=3 ttl=255 time=1 ms
Reply from 10.1.2.2: bytes=56 Sequence=4 ttl=255 time=10 ms
Reply from 10.1.2.2: bytes=56 Sequence=5 ttl=255 time=10 ms
--- 10.1.2.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 1/12/30 ms
以上信息显示ICMP报文正常转发,路由可达
2、再从R1本地发出TCP报文
<R1>tel
<R1>telnet 10.1.1.2
Trying 10.1.1.2 ...
Press CTRL+K to abort
Connected to 10.1.1.2 ...
******************************************************************************
* Copyright (c) 2004-2007 Hangzhou H3C Tech. Co., Ltd. All rights reserved. *
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
<R2>
<R2>
<R2>
<R2>
<R2>
<R2>
<R2>qu
The connection was closed by the remote host!
<R1>telnet 10.1.2.2
Trying 10.1.2.2 ...
Press CTRL+K to abort
Can't connect to the remote host! 不可达!!
<R1>
<R1>
<R1>
如上信息,从R1发出TCP报文(telnet)可以到R2,但是不能达R3 因为所有TCP报文都从S0/6/0发出,所以只能到达与S0/6/0直连的R2,不通到达R3。
转载于:https://blog.51cto.com/hciewd/1142658