Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1330369
  • 博文数量: 464
  • 博客积分: 9399
  • 博客等级: 中将
  • 技术积分: 6364
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-19 09:15
文章分类

全部博文(464)

文章存档

2014年(12)

2013年(123)

2012年(173)

2011年(156)

我的朋友

分类: 系统运维

2013-07-01 10:12:54

在B4查看debug输出:

*Mar 1 04:08:31.270: IP: Serial1 to Serial0 .3

*Mar 1 04:08:31.334: IP: s=.1 (Serial1), d=3.3.3.3, len 100, policy match

*Mar 1 04:08:31.338: IP: route map to-B9, item 10, permit

*Mar 1 04:08:31.342: IP: s=.1 (Serial1), d=3.3.3.3 (Serial0), len 100, pol

icy routed

*Mar 1 04:08:31.346: IP: Serial1 to Serial0 .3

*Mar 1 04:08:31.410: IP: s=.1 (Serial1), d=3.3.3.3, len 100, policy match

*Mar 1 04:08:31.414: IP: route map to-B9, item 10, permit

*Mar 1 04:08:31.418: IP: s=.1 (Serial1), d=3.3.3.3 (Serial0), len 100, pol

icy routed

*Mar 1 04:08:31.422: IP: Serial1 to Serial0 .3

*Mar 1 04:08:31.486: IP: s=.1 (Serial1), d=3.3.3.3, len 100, policy match

*Mar 1 04:08:31.490: IP: route map to-B9, item 10, permit

*Mar 1 04:08:31.494: IP: s=.1 (Serial1), d=3.3.3.3 (Serial0), len 100, pol

icy routed

*Mar 1 04:08:31.498: IP: Serial1 to Serial0 .3

很明显,由于路由里没有到.0/24的路由,故应用策略路由。

如果B4有.0/24的路由则不会按照策略转发:

icy rejected -- normal forwarding

*Mar 1 03:54:19.899: IP: s=.1 (Serial1), d=3.3.3.3, len 100, policy match

*Mar 1 03:54:19.899: IP: route map to-B9, item 10, permit

*Mar 1 03:54:19.903: IP: s=.1 (Serial1), d=3.3.3.3 (Serial0), len 100, pol

icy rejected -- normal forwarding

*Mar 1 03:54:19.971: IP: s=.1 (Serial1), d=3.3.3.3, len 100, policy match

*Mar 1 03:54:19.975: IP: route map to-B9, item 10, permit

*Mar 1 03:54:19.975: IP: s=.1 (Serial1), d=3.3.3.3 (Serial0), len 100, pol

icy rejected -- normal forwarding

*Mar 1 03:54:20.043: IP: s=.1 (Serial1), d=3.3.3.3, len 100, policy match

*Mar 1 03:54:20.047: IP: route map to-B9, item 10, permit

*Mar 1 03:54:20.051: IP: s=.1 (Serial1), d=3.3.3.3 (Serial0), len 100, pol

icy rejected -- normal forwarding

*Mar 1 03:54:20.119: IP: s=.1 (Serial1), d=3.3.3.3, len 100, policy match

*Mar 1 03:54:20.119: IP: route map to-B9, item 10, permit

*Mar 1 03:54:20.123: IP: s=.1 (Serial1), d=3.3.3.3 (Serial0), len 100, pol

icy rejected -- normal forwarding

接 下来,在封装HDLC/PPP链路上面,在目的地址已知的情况下,直接封装链路层协议转发,而在Ethernet链路上,转发已知目的地址时,需获得下一 跳的链路地址MAC,我们设置default inerface为eth0接口时,并没有告知吓一跳的IP地址。如果有下一跳的IP地址,可以ARP解析出对应的MAC,完成封装----转 发过程,下面测试一下从B1的.0/24网络访问B3的情况。

B1#ping

Protocol [ip]:

Target IP address: .3

Repeat count [5]:

Datagram size [100]:

Timeout in seconds [2]:

Extended commands [n]: y

Source address or interface: .1

Type of service [0]:

Set DF bit in IP header? [no]:

Validate reply data? [no]:

Data pattern [0xABCD]:

Loose, Strict, Record, Timestamp, Verbose[none]:

Sweep range of sizes [n]:

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to .3, timeout is 2 seconds:

.....

Success rate is 0 percent (0/5)

在B1上测试并没有ping通,B4的调试信息输出显示数据报文已经策略转发,交给了eth0接口:

*Mar 1 04:16:32.022: IP: Serial1 to Ethernet0 .3

*Mar 1 04:16:34.014: IP: s=.1 (Serial1), d=3.3.3.3, len 100, policy match

*Mar 1 04:16:34.018: IP: route map to-B9, item 20, permit

*Mar 1 04:16:34.018: IP: s=.1 (Serial1), d=3.3.3.3 (Ethernet0), len 100, p

olicy routed

*Mar 1 04:16:34.022: IP: Serial1 to Ethernet0 .3

*Mar 1 04:16:36.014: IP: s=.1 (Serial1), d=3.3.3.3, len 100, policy match

*Mar 1 04:16:36.018: IP: route map to-B9, item 20, permit

*Mar 1 04:16:36.018: IP: s=.1 (Serial1), d=3.3.3.3 (Ethernet0), len 100, p

olicy routed

*Mar 1 04:16:36.022: IP: Serial1 to Ethernet0 .3

*Mar 1 04:16:38.014: IP: s=.1 (Serial1), d=3.3.3.3, len 100, policy match

*Mar 1 04:16:38.014: IP: route map to-B9, item 20, permit

*Mar 1 04:16:38.018: IP: s=.1 (Serial1), d=3.3.3.3 (Ethernet0), len 100, p

olicy routed

可以执行一次相同的调试,在B4打开debug ip packet可以看到封装失败:

*Mar 1 04:22:22.558: IP: s=.0 (Ethernet0), d=255.255.255.255, len 604, rcv

d 2

*Mar 1 04:22:24.622: IP: s=.0 (Ethernet0), d=255.255.255.255, len 604, rcv

d 2

*Mar 1 04:22:26.674: IP: s=.0 (Ethernet0), d=255.255.255.255, len 604, rcv

d 2

*Mar 1 04:22:26.686: IP: s=.2 (local), d=224.0.0.5 (Serial0), len 76, sen

ding broad/multicast

*Mar 1 04:22:26.690: IP: s=.2 (local), d=224.0.0.5 (Serial1), len 80, sen

ding broad/multicast

*Mar 1 04:22:27.074: IP: s=213.1.1.2 (local), d=224.0.0.5 (Ethernet0), len 76,

sending broad/multicast

从这里可以看出,策略路由,如设置default interface 为以太网接口时,可能会产生以上问题,在通过策略路由转发数据报文时,下一跳接口为以太网接口时,如果如果ARP表里面没有对应的项,则转发失败。

这和静态路由的配置是区别的,。静态路由如下一跳并非具体的IP地址,而是配置以太网接口的情况下,会执行ARP请求,接下来,我们配置这个实验;

B4(config)#ip route .0 0.0.0.0 ethernet 0

B4#ping .3

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to .3, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = ms

B4#ping .3

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to .3, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = ms

B4#show arp

Protocol Address          Age (min) Hardware Addr   Type   Interface

Internet .3                 0   0030.94e5.ef ARPA   Ethernet0

Internet 213.1.1.3             203   0030.94e5.ef ARPA   Ethernet0

Internet 213.1.1.2               -   0010.7b86 ARPA   Ethernet0

上 面这个.3的arp表项,是有B9的eth0接口应答的,因此0030.94e5.ef也就是B9的eth0的接口地址,可见B4的静态路由起作用了,在 以太网接口发起arp请求,而B9的以太网接口为何会应答一个非以太网接口地址的arp请求,这是因为默认情况下ios在所有接口下开启了proxy arp功能(可在接口模式下用no proxy-arp关闭)。

借助这条静态路由,B4的策略路由也将得以正常转发。在B1上面测试:

B1#ping

Protocol [ip]:

Target IP address: .3

Repeat count [5]:

Datagram size [100]:

Timeout in seconds [2]:

Extended commands [n]: y

Source address or interface: .1

Type of service [0]:

Set DF bit in IP header? [no]:

Validate reply data? [no]:

Data pattern [0xABCD]:

Loose, Strict, Record, Timestamp, Verbose[none]:

Sweep range of sizes [n]:

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to .3, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 60/60/64 ms

从以上实验可以看出策略路由是一种不同于传统的基于母的地址的报文路由方法,策略路由还有更为广泛的应用。

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