Chinaunix首页 | 论坛 | 博客
  • 博客访问: 852587
  • 博文数量: 275
  • 博客积分: 3904
  • 博客等级: 中校
  • 技术积分: 4605
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-17 21:10
文章分类

全部博文(275)

文章存档

2014年(9)

2013年(124)

2012年(142)

分类: 系统运维

2013-07-01 10:13:31

试验背景

仍然在上一个实验的基础进行该实验,这个实验在B1新增加一个环回口地址,仿真.0/24的网络,由于这个网络发起的HTTP会话,在B4执行,使web数据通过serial 0接口发送。

基本配置

B1(config)#interface loopback 1

B1(config-if)#ip address .1 255.255.255.0

B4(config)#route-map to-B9 permit 30

B4(config-route-map)#match ip address 103

B4(config-route-map)#set ip next-ho.3

B4(config)#access-list 103 permit tc.0 0.0.0.255 any eq www

在B上验证,用telnet命令发送一个HTTP报文:

B1(config)#ip telnet source-interface loopback 1    //定义是telnet源地址为loopback 1接口地址

B1#telnet .3 www

Trying .3, 80 ...

% Connection refused by remote host

以上加上www参数之后,即TCP目标端口为80,查看B4的debug输出:

*Mar 1 02:37:16.267: IP: s=.1 (Serial1), d=3.3.3.3, len 44, policy match

*Mar 1 02:37:16.271: IP: route map to-B9, item 30, permit

*Mar 1 02:37:16.271: IP: s=.1 (Serial1), d=3.3.3.3 (Serial0), len 44, poli

cy routed

*Mar 1 02:37:16.275: IP: Serial1 to Serial0 .3

报文与route-map中的序号30的项目匹配,并已向.3转发,TCP会话为双向的,在实际应用中,目标端口为810,为上行数据,而web应用实际流量大部分为下行数据,因此在B9控制返回下行流量更有意义,以下覆盖B9原来的route-map配置。

B9(config)#route-map to-B1 permit 10

B9(config-route-map)#match ip address 103

B9(config-route-map)#set ip next-ho.2

B9(config)#access-list 103 permit tcp any eq www .0 0.0.0.255

注意访问列表的写法,返回的数据报文,源端口为80;baB9的HTTP功能打开,可以做如下测试。

B9(config)#ip http server

B9#debug ip policy

在B1发起会话连接:

B1#telnet .3 www

Trying .3, 80 ... Open

在B9查看debug的输出如下,返回的数据报文已经执行了策略路由:

03:05:41: IP: s=.3 (local), d=1.1.5.1, len 44, policy match

03:05:41: IP: route map to-B1, item 10, permit

03:05:41: IP: s=.3 (local), d=1.1.5.1 (Serial0), len 44, policy routed

03:05:41: IP: local to Serial0 .2

阅读(967) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~