不同于一般流量整形(GTS),DTS不需要加权公平队列(WFQ)启用。相反,DTS使用的字形队列公平队列或分布式先入先出(FIFO)。
实验十四、帧中继的流量整形
R1配置:
R1#conf t
R1(config)#int s1/0
R1(config-if)#clock rate 64000
R1(config-if)#ip add 192.168.12.1255.255.255.0
R1(config-if)#encapsulation frame-relay
R1(config-if)#frame-relay map ip 192.168.12.2102
R1(config-if)#frame-relay interface-dlci 102
R1(config-fr-dlci)#class DLCI102
R1(config-fr-dlci)#exit
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#policy-map SHAPE
R1(config-pmap)#class class-default
R1(config-pmap-c)#shape average 64000
R1(config-pmap-c)#exit
R1(config-pmap)#exit
R1(config)#map-class frame-relay DLCI102
R1(config-map-class)#service-policy outputSHAPE
R1(config-map-class)#exit
R2配置:
R2#conf t
R2(config)#int s1/0
R2(config-if)#clock rate 64000
R2(config-if)#encapsulation frame-relay
R2(config-if)#frame-relay map ip 192.168.12.1201
R2(config-if)#ip add 192.168.12.2255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
检查测试配置
R1# ping 192.168.12.2 rep 20 size 2000
Type escape sequence to abort.
Sending 20, 2000-byte ICMP Echos to 192.168.12.2, timeoutis 2 seconds:
!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (20/20), round-tripmin/avg/max = 188/358/496 ms
R1# ping 192.168.12.2 rep 20 size 6000
Type escape sequence to abort.
Sending 20, 6000-byte ICMP Echos to 192.168.12.2, timeoutis 2 seconds:
!....!..!.!!!!!..!!!
Success rate is 55 percent (11/20), round-tripmin/avg/max = 1304/1771/1996 ms
R1#sh policy-map int s1/0
Serial1/0: DLCI102 -
Service-policyoutput: SHAPE
Class-map:class-default (match-any)
110 packets,123040 bytes
5 minute offered rate 8000 bps, drop rate 0bps
Match: any
TrafficShaping
Target/Average Byte Sustain Excess Interval Increment
Rate Limit bits/int bits/int (ms) (bytes)
64000/64000 2000 8000 8000 125 1000
Adapt Queue Packets Bytes Packets Bytes Shaping
ActiveDepth Delayed Delayed Active
- 0 110 123040 60 61840 no
实验十五、拥塞避免之RSVP(资源保留协议)
R1配置:
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int lo 1
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#int fa0/0
R1(config-if)#ip add 192.168.12.1 255.255.255.0
R1(config-if)#ip rsvp bandwidth 20 8//配置总的保留带宽(total-BW)及per-flow的最大保留带宽(per-flow-BW).单位:kbps
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#net 1.1.1.0
R1(config-router)#net 192.168.12.0
R1(config-router)#exit
R2配置:
R2#conf t
R2(config)#int fa0/0
R2(config-if)#ip add 192.168.12.2 255.255.255.0
R2(config-if)#ip rsvp bandwidth 20 8
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#int fa0/1
R2(config-if)#ip add 192.168.23.2 255.255.255.0
R2(config-if)#ip rsvp bandwidth 20 8
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#net 192.168.12.0
R2(config-router)#net 192.168.23.0
R2(config-router)#exit
R3配置:
R3#conf t
R3(config)#int lo 1
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#exit
R3(config)#int fa0/0
R3(config-if)#ip add 192.168.23.3 255.255.255.0
R3(config-if)#ip rsvp bandwidth 20 8
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#no auto-summary
R3(config-router)#net 192.168.23.0
R3(config-router)#net 3.3.3.0
R3(config-router)#exit
RSVP(资源保留协议) 是 一 个 信 令 协 议, 它 提 供 建 立 连 接 的 资 源 预留, 控 制 综 合 业 务, 往 往 在 IP 网 络 上 提 供 仿 真 电 路。 RSVP 是 所 有 QoS 技 术 中 最 复 杂 的 一 种, 与 尽力 而 为 的 IP 服 务 标 准 差 别 最 大 , 它 能 提 供 最 高 的 QoS 等 级, 使 得 服 务 得 到 保 障、 资 源 分 配 量 化, 服 务 质 量 的 细 微 变 化 能 反馈 给 支 持 QoS 的 应 用 和 用 户。协 议 的 工 作 情 况 如 下:
发 送 端 依 据 高、 低 带 宽 的 范 围、 传 输 迟 延, 以 及 抖 动 来 表 征 发 送 业 务。 RSVP 从 含 有 '业 务 类 别(TSpec)' 信 息 的 发 送 端 发 送 一 个 路 径 信 息 给 目 的 地 址 (单点 广 播 或 多 点 广 播 的 接 收 端)。 每 一 个 支 持RSVP 的 路 由 器 沿 着 下 行 路 由 建 立 一 个 '路 径 状 态 表', 其 中 包 括 路 径 信 息 里 先 前 的 源 地 址 (例 如,朝 着 发 送 端 的 上 行 的 下 一 跳) 为 了 获 得 资 源 预 留, 接 收 端 发 送 一个 上 行 的 RESV (预 留 请 求) 消 息。 除 了 TSpec, RESV 消 息 里 有'请 求 类 别 (RSpec)', 表 明 所 要 求 的 综 合 服 务 类 型, 还 有 一个 '过 滤 器 类 别', 表 征 正 在 为 分 组 预 留资 源 (如 传 输 协 议 和 端 口 号)。 RSpec 和 过 滤 器 类 别 合 起 来 代 表 一 个 '流 的描 述 符', 路 由 器 就 是 靠 它 来 识 别 每 一 个 预 留 资 源 的。 当 每 个 支 持 RSVP 的 路 由 器 沿 着 上 行 路 径 接 收 RESV 的 消息 时, 它 采 用 输 入 控 制 过 程 证 实 请 求, 并 且 配 置 所 需 的 资 源。 如 果 这 个 请 求 得 不 到 满 足 (可 能 由 于 资 源 短 缺 或 未 通 过 认 证), 路 由 器向 接 收 端 返 回 一 个 错 误 消 息。 如 果 这 个 消 息 被 接 受, 路 由 器 就 发 送 上 行RESV 到 下 一 个 路 由 器 。当 最 后 一 个 路 由 器 接 收 RESV, 同 时接 受 请 求 的 时 候, 它 再 发 送 一 个 证 实 消 息 给 接 收 端 。 当 发 送 端 或 接 收 端 结 束 了 一 个 RSVP 会 话 时, 有 一 个 明 显 的 断 开 连 接 的 过 程。 RSVP支 持 的 综 合 业 务 有 以 下 两 种 基 本 类 型:
有 保 证 业 务: 这 种 业 务 是, 尽 可 能 地 仿 真 成 一 条 专 用 虚 电 路。 除 了 要 根 据 TSpec 参 数 的 要 求 确 保 带 宽 的 有 效 性 外, 它 还 可 以 用 把 一 条 路 径 里 的 不同 网 络 部 件 的 参 数 合 并 起 来 的 方 法 来 提 供 一 个 端 到 端 的 固 定 的 队 列 延 迟
受 控 负 载: 这 相 当 于 '无 负 载 条 件 下 尽 力 而 为 服 务'。 因 此, 它 比 '尽 力 而 为'服 务 更 好, 但 是 不 能 提 供 '有 保 证 业 务'所 承 诺 的, 具 有 严 格 固 定 队 列 延 迟 的 服 务。
对 于‘有 保 证 业 务’和 受 控 负 载,处 理 不 同 的 (与 类 别 无 关) 数 据 业 务 就象 处 理 没 有 QoS 的 尽 力 而 为 数 据 业 务 那 样。综 合 业 务 采 用 令 牌 筐 模式 来 表 征 输 入/输 出 排 序 算 法。 设 计 令 牌 筐 是 为 了 平 滑 输 出 的 业 务 流, 但 不 象 泄 露 筐 模 式 (也 可 以 平 滑 输 出 的 业 务 流), 令 牌 筐 模 式 允许 数 据 突 发、 在 短 时 间 内 维 持 更 高 的 发 送 速 率。 RSVP 协 议 机 制 要 点: 每个 路 由 器 的 预 留 资 源 是 '软' 的, 即 这 些资 源 需 要 由 接 收 端 定 期 地 刷 新,RSVP 不 是 传 输 协 议, 而 是 网 络 (控 制) 协 议。 作 为 这 样 的 协 议, 它 不 传 送 数 据,但 是 和 TCP 或 者 UDP 的 数 据 '流' 是 并 行 工 作 的 ,应 用 要 求 API 详 细 说 明 数 据 流 的 需 求, 初 始 化 预 留 资 源 请 求, 并 且 在 发 出 初 始 化 请求 后, 接 收 预 留 成 功 或 失 败 的 通 知 并 贯 穿 于 整 个 会 话 过 程。 为 了 更 好 地 利 用 API, API 也 要 包 含 那 些 描 述 在 整 个 预 留 时间 内 的 预 留 建 立 期 间 或 之 后, 当 条 件 发 生 变 化 时 出 现 问 题 的 RSVP 错误 信 息 根 据 接 收 端 的 情 况 来 预 留 资 源, 是 为 了 有 效 的 接 纳 相 当 复 杂 的 (组播) 接 收 端 组 在 上 行 方 向 的 业 务 复 制 点 处 组 播 预 留 资 源 混 合 在 一 起 (仍 然 有 不 易 理 解 的 复 杂 算 法 在 里 面) ,尽 管 RSVP 业 务 可 以 通 过 不 支 持 RSVP 的 路 由 器,但 是 这 会 在 QoS '链' 上 产 生 一 条
实验十六、拥塞避免之链路分片和交叉离开(LFI)For Multilink PPP
R1配置:
R1#conf t
R1(config)#int s1/0
R1(config-if)#clock rate 64000
R1(config-if)#encapsulation ppp
R1(config-if)#ppp multilink group 1
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int s1/1
R1(config-if)#clock rate 64000
R1(config-if)#encapsulation ppp
R1(config-if)#ppp multilink group 1
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int s1/2
R1(config-if)#clock rate 64000
R1(config-if)#encapsulation ppp
R1(config-if)#ppp multilink group 1
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int multilink 1
R1(config-if)#fair-queue //必须开启WFQ队列机制
R1(config-if)#ppp multilink fragment delay 5
R1(config-if)#ppp multilink interleave
R1(config-if)#ip add 192.168.12.1255.255.255.0
R1(config-if)#exit
R2配置:
R2#conf t
R2(config)#int s1/0
R2(config-if)#clock rate 64000
R2(config-if)#encapsulation ppp
R2(config-if)#ppp multilink group 1
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#int s1/1
R2(config-if)#clock rate 64000
R2(config-if)#encapsulation ppp
R2(config-if)#ppp multilink group 1
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#int s1/2
R2(config-if)#clock rate 64000
R2(config-if)#encapsulation ppp
R2(config-if)#ppp multilink group 1
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#int multilink 1
R2(config-if)#fair-queue
R2(config-if)#ppp multilink fragment delay 5
R2(config-if)#ppp multilink interleave
R2(config-if)#ip add 192.168.12.2255.255.255.0
R2(config-if)#exit
检查测试:
R1(config-if)#do sh ppp multi
Multilink1
Bundle name: R2
Remote Endpoint Discriminator: [1] R2
LocalEndpoint Discriminator: [1] R1
Bundle up for 00:04:51, total bandwidth 4632, load 1/255
Receive buffer limit 36000 bytes, frag timeout 1000 ms
Interleaving enabled
0/0fragments/bytes in reassembly list
0lost fragments, 82 reordered
0/0discarded fragments/bytes, 0 lost received
0xDE received sequence, 0xDD sent sequence
Member links: 3 active, 0 inactive (max not set, min not set)
Se1/0, since 00:04:51, 386 weight, 378 frag size
Se1/1, since 00:04:51, 386 weight, 378 frag size
Se1/2, since 00:04:50, 386 weight, 378 frag size
No inactive multilink interfaces
R2(config)#do sh ppp multi
Multilink1
Bundle name: R1
Remote Endpoint Discriminator: [1] R1
LocalEndpoint Discriminator: [1] R2
Bundle up for 00:03:17, total bandwidth 4632, load 1/255
Receive buffer limit 36000 bytes, frag timeout 1000 ms
Interleaving enabled
0/0fragments/bytes in reassembly list
0lost fragments, 77 reordered
0/0discarded fragments/bytes, 0 lost received
0xDC received sequence, 0xDD sent sequence
Member links: 3 active, 0 inactive (max not set, min not set)
Se1/0, since 00:03:17, 965 weight, 957 frag size
Se1/1, since 00:03:17, 965 weight, 957 frag size
Se1/2, since 00:03:17, 965 weight, 957 frag size
No inactive multilink interfaces
链路分片和交叉离开(LFI-Link Fragmentation and Interleaving):串行化时延是在物理链路上发送一个帧的时间。假设一个链路的物理clock rate为X bps,那么将花费1/X的时间来发送一个bit。如果合格帧有Y个bit,那将花费Y/X秒来串行化该帧。这意味着较快的链路会有较低的串行化时延。以56kbps的链路举例,发送一个bit的时间是1/56000秒,一个1500字节的帧(12.000bit)讲用12000/56000秒去串行化,即214毫秒 ,当路由器从接口发出去一个帧的时候是发送的一个完整的帧。如果一个小的包、同时对时延敏感的包需要发送出去的时候,恰巧这是路由器已经在开始发送一个比较大的帧,较小的帧不得不等较大的帧传递完毕才能传递,一个1500字节的包在56kbps的链路上串行化时延为214毫秒,这对语音包来说是一个太长的时间了。LFI工具使得大包不会过多的影响小包的串行化时延,它通过把大包分片然后让小包在大包的分片中交叉离开,这样对时延敏感的包就离开了该路由器。
实验十七、拥塞避免之链路分片和交叉离开(LFI)For 帧中继
R1#conf t
R1(config)#int s1/0
R1(config-if)#clock rate 64000
R1(config-if)#encapsulation frame-relay
R1(config-if)#frame-relay map ip 192.168.12.2 102
R1(config-if)#frame-relay interface-dlci 102 pppvirtual-Template 1
R1(config-if)#no sh
R1(config-fr-dlci)#exit
R1(config-if)#exit
R1(config)#int virtual-template 1
R1(config-if)#ip add 192.168.12.1 255.255.255.0
R1(config-if)#ppp multilink
R1(config-if)#ppp multilink fragment delay 4
R1(config-if)#ppp multilink interleave
R1(config-if)#exit
R1(config)#class-map telnet
R1(config-cmap)#match protocol telnet
R1(config-cmap)#exit
R1(config)#class-map http
R1(config-cmap)#match protocol http
R1(config-cmap)#exit
R1(config)#class-map bt
R1(config-cmap)#match protocol bittorrent
R1(config-cmap)#exit
R1(config)#policy-map PPPCB
R1(config-pmap)#class telnet
R1(config-pmap-c)#priority 64
R1(config-pmap-c)#exit
R1(config-pmap)#class http
R1(config-pmap-c)#bandwidth percent 20
R1(config-pmap-c)#exit
R1(config-pmap)#class bt
R1(config-pmap-c)#drop
R1(config-pmap-c)#exit
R1(config-pmap)#exit
R1(config)#int virtual-template 1
R1(config-if)#service-policy output PPPCB
R1(config-if)#exit
R2配置:
R2#conf t
R2(config)#int s1/0
R2(config-if)#encapsulation frame-relay
R2(config-if)#frame-relay map ip 192.168.12.1 201
R2(config-if)#frame-relay interface-dlci 201 pppvirtual-Template 1
R2(config-fr-dlci)#clock rate 64000
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#int virtual-template 1
R2(config-if)#ip add 192.168.12.2 255.255.255.0
R2(config-if)#ppp multilink
R2(config-if)#ppp multilink fragment delay 4
R2(config-if)#ppp multilink interleave
检查测试:
R1#sh frame-relay pvc 102
PVC Statistics for interface Serial1/0 (Frame Relay DTE)
DLCI = 102, DLCI USAGE = LOCAL, PVC STATUS = ACTIVE,INTERFACE = Serial1/0
input pkts289 output pkts 355 in bytes 6623
out bytes8248 dropped pkts 0 in pkts dropped 0
out pkts dropped0 out bytes dropped 0
in FECN pkts0 in BECN pkts 0 out FECN pkts 0
out BECN pkts0 in DE pkts 0 out DE pkts 0
out bcast pkts0 out bcast bytes 0
5 minute inputrate 0 bits/sec, 0 packets/sec
5 minute outputrate 0 bits/sec, 0 packets/sec
pvc create time00:39:40, last time pvc status changed 00:27:19
Bound to Virtual-Access1(up, cloned from Virtual-Template1)
R1#sh int virtual-template 1
Virtual-Template1 is down, line protocol is down
Hardware isVirtual Template interface
Internet addressis 192.168.12.1/24
MTU 1500 bytes,BW 100000 Kbit, DLY 100000 usec,
reliability255/255, txload 1/255, rxload 1/255
EncapsulationPPP, LCP Closed, multilink Closed, loopback not set
Keepalive set (10sec)
DTR is pulsed for5 seconds on reset
Last input never,output never, output hang never
Last clearing of"show interface" counters 00:35:03
Input queue:0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueingstrategy: fifo
Output queue:0/40 (size/max)
5 minute inputrate 0 bits/sec, 0 packets/sec
5 minute outputrate 0 bits/sec, 0 packets/sec
0 packetsinput, 0 bytes, 0 no buffer
Received 0broadcasts, 0 runts, 0 giants, 0 throttles
0 inputerrors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packetsoutput, 0 bytes, 0 underruns
0 output errors,0 collisions, 0 interface resets
0 outputbuffer failures, 0 output buffers swapped out
0 carriertransitions
实验十八、TCP or RTP报文压缩
R1配置:
R1#conf t
R1(config)#int s1/0
R1(config-if)#clock rate 64000
R1(config-if)#ip add 192.168.12.1 255.255.255.0
R1(config-if)#ip tcp header-compression //TCP头部压缩
R1(config-if)#ip tcp compression-connections20//只对20个链接进行TCP压缩
R1(config-if)#ip rtp header-compression//RTP头部压缩
R1(config-if)#ip rtp compression-connections20//只对20个链接进行RTP压缩
R1(config-if)#no sh
R1(config-if)#exit
R2配置:
R2(config)#int s1/0
R2(config-if)#clock rate 64000
R2(config-if)#ip add 192.168.12.2255.255.255.0
R2(config-if)#ip tcp header-compressionpassive//设置只对收到的压缩包,才进行压缩和解压缩
R2(config-if)#ip tcp compression-connections20 //只对20个链接进行压缩或解压缩
R2(config-if)#ip rtp header-compressionpassive
R2(config-if)#ip rtp compression-connections20
R2(config-if)#no sh
R2(config-if)#exit
实验十九、帧中继和PPP中的Payload压缩
R1配置:
R1#conf t
R1(config)#int s1/0
R1(config-if)#clock rate 64000
R1(config-if)#ip add 192.168.12.1 255.255.255.0
R1(config-if)#encapsulation frame-relay
R1(config-if)#frame-relay map ip 192.168.12.2 102broadcast payload-compression packet-by-packet
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int s1/1
R1(config-if)#clock rate 64000
R1(config-if)#ip add 192.168.23.1 255.255.255.0
R1(config-if)#encapsulation ppp
R1(config-if)#compress lzs
R1(config-if)#no sh
R1(config-if)#exit
R2配置:
R2#conf t
R2(config)#int s1/0
R2(config-if)#ip add 192.168.12.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#encapsulation frame-relay
R2(config-if)#frame-relay map ip 192.168.12.1 201broadcast payload-compression packet-by-packet
R2(config-if)#no sh
R2(config-if)#exit
R3配置:
R3#conf t
R3(config)#int s1/0
R3(config-if)#clock rate 64000
R3(config-if)#ip add 192.168.23.3 255.255.255.0
R3(config-if)#encapsulation ppp
R3(config-if)#compress lzs
R3(config-if)#no sh
R3(config-if)#exit
检查测试:
R1#ping 192.168.12.2 re 10
Type escape sequence to abort.
Sending 10, 100-byte ICMP Echos to 192.168.12.2, timeoutis 2 seconds:
!!!!!!!!!!
Success rate is 100 percent (10/10), round-tripmin/avg/max = 16/64/212 ms
R1#ping 192.168.23.3 re 10
Type escape sequence to abort.
Sending 10, 100-byte ICMP Echos to 192.168.23.3, timeoutis 2 seconds:
!!!!!!!!!!
Success rate is 100 percent (10/10), round-tripmin/avg/max = 4/59/188 ms
R1#sh compress
Serial1/0
Softwarecompression enabled
uncompressed bytes xmt/rcv 2000/2000
compressedbytes xmt/rcv 840/830
Compressedbytes sent: 840 bytes 0 Kbits/sec ratio: 2.380
Compressedbytes recv: 830 bytes 0 Kbits/sec ratio: 2.409
1 min avg ratio xmt/rcv 1.831/1.831
5 min avg ratio xmt/rcv 0.976/1.000
10 min avgratio xmt/rcv 0.976/1.000
no bufsxmt 0 no bufs rcv 0
resyncs 0
AdditionalStac Stats:
Transmitbytes: Uncompressed = 0 Compressed = 840
Received bytes: Compressed = 830 Uncompressed = 0
Serial1/1
Softwarecompression enabled
uncompressed bytes xmt/rcv 1349/1340
compressedbytes xmt/rcv 575/543
Compressedbytes sent: 575 bytes 0 Kbits/sec ratio: 2.346
Compressedbytes recv: 543 bytes 0 Kbits/sec ratio: 2.467
1 min avg ratio xmt/rcv 0.842/0.920
5 min avg ratio xmt/rcv 0.251/0.295
10 min avgratio xmt/rcv 0.205/0.289
no bufsxmt 0 no bufs rcv 0
resyncs 0