payload(ヘッダー以外の部分)圧縮は、メモリまたはCPUリソースを消費してデータを小さくする技術です。今日では珍しいですが、低帯域に大量のデータを流したい時に有効な技術です。
PPP Payload Compression
PPP Payload Compression 概要
PPPで使用可能なPayload Compressionには以下の2つが挙げられます。
| stac | predictor | |
|---|---|---|
| 概要 | 連続した符号を置換 | 次の文字列を予測 |
| サポート対象 | PPP, HDLC, Frame Relayなど | PPPのみ |
| CPU負荷 | 大 | 小 |
| memory負荷 | 小 | 大 |
| 用途 | LAN | WAN |
| 圧縮効率 | ○ | × |
| 処理速度 | × | ○ |
stacker Compression
Stacker CompressionはLempel-Zivアルゴリズムを使用する圧縮形式です。連続した文字列を符号に置き換える事で圧縮を実現します。連続した文字列が発生するかどうかは、データの変化の少なさ(同じようなアプリケーションの通信かどうか)次第です。従って、LANはWANよりも同一のアプリケーションによる通信が発生しやすいので、LANで使用するのが効率的なアルゴリズムと言えます。メモリ負荷は少ないですが、CPUに与える負荷は大きいです。
Predictor Compression
Predictor Compressionは辞書に基づいて文字列の予測を試みます。他のアルゴリズムに比べて圧縮効率は良くないですが、処理速度では優れたアルゴリズムです。CPU負荷は少ないですが、メモリに与える負荷は大きいです。
PPP Payload Compression 必須設定
以下のコマンドで圧縮形式を指定すると、payloadが圧縮されます。
Router(config-if)# compression [ stac | predictor ]
動作確認
以下の環境で動作確認を行います。
s0/0 s0/0
+------+.1 .2+------+
| R1 +----------+ R2 |
+------+ +------+
192.168.12.0/24
[R1] interface Serial0/0 ip address 192.168.12.1 255.255.255.0 encapsulation ppp compress stac [R2] interface Serial0/0 ip address 192.168.12.2 255.255.255.0 encapsulation ppp compress stac
以下のコマンドで圧縮されているかどうかを確認する事ができます。detailオプションを使用すると、圧縮アルゴリズムなどより詳細な情報を表示させる事ができます。
R1#show compress details
Serial0/0
Software compression enabled
uncompressed bytes xmt/rcv 15306/14872
compressed bytes xmt/rcv 3318/3375
Compressed bytes sent: 3318 bytes 0 Kbits/sec ratio: 4.613
Compressed bytes recv: 3375 bytes 0 Kbits/sec ratio: 4.406
1 min avg ratio xmt/rcv 1.701/14.666
5 min avg ratio xmt/rcv 2.455/2.656
10 min avg ratio xmt/rcv 2.455/2.656
no bufs xmt 0 no bufs rcv 0
resyncs 0
Additional Stac Stats:
Transmit bytes: Uncompressed = 0 Compressed = 3318
Received bytes: Compressed = 3507 Uncompressed = 0
Compression Protocol used: LZS-DCP
R-Req/R-Ack 0x10/0x20
Check Mode = 2
Decompression Protocol used: LZS-DCP
R-Req/R-Ack 0x10/0x20
Check Mode = 2
R1#
FRF9 Payload Compression
FRF9 Payload Compression 必須設定
Frame Relay Forum(FRF)はフレームリレーに関する仕様を策定する団体で、FRF.9は圧縮に関する規定が定められています。CiscoルータはFRF.9 Compressionを実装しており、FRF.9を使用するには以下のコマンドを投入します。なお、Frame relayのカプセル化タイプにはCisco, IETFが存在しますが、FRF.9はIETFのみサポートされています。
Router(config-if)# frame-relay map ip <ip_address> <dlci> [ broadcast ] IETF payload-compression FRF9 stac
動作確認
以下の環境で動作確認を行います。
s0/0 s0/0
+------+.1 .2+------+
| R1 +----------+ R2 |
+------+ +------+
192.168.12.0/24
[R1] interface Serial0/0 ip address 192.168.12.1 255.255.255.0 encapsulation frame-relay no keepalive clock rate 9600 frame-relay map ip 192.168.12.2 100 broadcast IETF payload-compression FRF9 stac [R2] interface Serial0/0 ip address 192.168.12.2 255.255.255.0 encapsulation frame-relay no keepalive frame-relay map ip 192.168.12.1 100 broadcast IETF payload-compression FRF9 stac
show compress, show frame-relay mapなどで設定確認が可能です。
R1#show compress
Serial0/0 - DLCI: 100
Software compression enabled
uncompressed bytes xmt/rcv 1040/1040
compressed bytes xmt/rcv 305/308
Compressed bytes sent: 305 bytes 0 Kbits/sec ratio: 3.409
Compressed bytes recv: 308 bytes 0 Kbits/sec ratio: 3.376
1 min avg ratio xmt/rcv 0.000/0.000
5 min avg ratio xmt/rcv 0.000/0.000
10 min avg ratio xmt/rcv 0.000/0.000
no bufs xmt 0 no bufs rcv 0
resyncs 0
Additional Stac Stats:
Transmit bytes: Uncompressed = 0 Compressed = 235
Received bytes: Compressed = 238 Uncompressed = 0
R1#
R1#
R1#show frame-relay map
Serial0/0 (up): ip 192.168.12.2 dlci 100(0x64,0x1840), static,
broadcast,
IETF
Payload Compression FRF9
R1#
General Header Compression
General Header Compression 必須設定
Cisco IOSはtcp header compressionとrtp header compressionをサポートします。以下のコマンドでcompressionを有効にする事ができます。なお、passiveを指定すると入力パケットが圧縮されている場合のみ出力パケットを圧縮するようになります。
Router(config-if)# ip { tcp | rtp } header-compression [ passive ]
header compressionはCPUリソースを消費する機能です。そのため、CPUリソースを枯渇させないよう圧縮を行うコネクション数の上限を定義する事ができます。以下のコマンドで、片方向のコネクション数を定義する事ができます。(例えば、双方向の通信で15コネクションを許容したいならば、<num>に30を指定して下さい。)
Router(config-if)# ip tcp compression-connections <num>
動作確認
以下の環境で動作確認を行います。
s0/0 s0/0
+------+.1 .2+------+
| R1 +----------+ R2 |
+------+ +------+
192.168.12.0/24
[R1] interface Serial0/0 ip address 192.168.12.1 255.255.255.0 ip tcp header-compression ip tcp compression-connections 32 ip rtp header-compression ip rtp compression-connections 10 clock rate 9600 [R2] interface Serial0/0 ip address 192.168.12.2 255.255.255.0 ip tcp header-compression passive ip tcp compression-connections 32 ip rtp header-compression passive ip rtp compression-connections 10
以下のコマンドで設定確認が可能です。
R1#show ip tcp header-compression
TCP/IP header compression statistics:
Interface Serial0/0 (compression on, VJ)
Rcvd: 14 total, 13 compressed, 0 errors, 0 status msgs
0 dropped, 0 buffer copies, 0 buffer failures
Sent: 23 total, 21 compressed, 0 status msgs, 0 not predicted
736 bytes saved, 223 bytes sent
4.30 efficiency improvement factor
Connect: 32 rx slots, 32 tx slots,
1 misses, 0 collisions, 0 negative cache hits, 32 free contexts
95% hit ratio, five minute miss rate 0 misses/sec, 0 max
R1#
Frame Relay Header Compression
Frame Relay Header Compression 必須設定
HDLC同様に、Frame Relayもheader compressionは設定可能です。Frame Relayの場合はPVC毎の柔軟な設定が可能です。
以下のコマンドで特定のPVCのみ圧縮を有効にします。”tcp header-compression”を指定した場合はTCP header compressionのみが有効に、”rtp header-compression”を指定した場合はRTP header compressionのみが有効に、”compress”を指定した場合はTCP, RTPの両方が有効になります。
Router(config-if)# frame-relay map ip <ip_addr> <dlci> [ broadcast ] { tcp header-compression | rtp header-compression | compress } { passive | active } [ connections <num> ]
以下のような設定方法で、全てのPVCに対してデフォルトで圧縮を有効にします。また、特定のPVCのみ圧縮を無効化したい場合は”nocompress”を指定します。
frame-relay ip tcp header-compression passive frame-relay ip tcp compression-connections <num> frame-relay map ip <ip_addr> <dlci> [ broadcast ] nocompress
動作確認
以下の環境で動作確認を行います。R1, R2間のみheader compressionを実装します。
192.168.123.0/24
+------+
┌------+ R2 |
s0/0 2│ .2+------+
+------+.1 1+-----+--+ s0/0.1
| R1 +------+ FRSW |
+------+ +-----+--+ s0/0.1
3│ .3+------+
└------+ R3 |
+------+
1:102 = 2:201
1:103 = 3:301
2:203 = 3:302
[R1] interface Serial0/0 ip address 192.168.123.1 255.255.255.0 encapsulation frame-relay frame-relay map ip 192.168.123.2 102 broadcast compress active connections 10 frame-relay map ip 192.168.123.3 103 broadcast [R2] interface Serial0/0 no ip address encapsulation frame-relay ! interface Serial0/0.1 multipoint ip address 192.168.123.2 255.255.255.0 frame-relay map ip 192.168.123.1 201 frame-relay map ip 192.168.123.3 203 broadcast nocompress frame-relay ip tcp header-compression passive frame-relay ip tcp compression-connections 10 frame-relay ip rtp header-compression passive frame-relay ip rtp compression-connections 10 [R3] interface Serial0/0 no ip address encapsulation frame-relay ! interface Serial0/0.1 multipoint ip address 192.168.123.3 255.255.255.0 frame-relay map ip 192.168.123.1 301 broadcast frame-relay map ip 192.168.123.2 302 broadcast
以下のコマンドで設定確認が可能です。PVC102のみ、圧縮が有効になっている事が読み取れます。
R1#show frame-relay map
Serial0/0 (up): ip 192.168.123.2 dlci 102(0x66,0x1860), static,
broadcast,
CISCO, status deleted
TCP/IP Header Compression (enabled), connections: 10
RTP Header Compression (enabled), connections: 10
Serial0/0 (up): ip 192.168.123.3 dlci 103(0x67,0x1870), static,
broadcast,
CISCO, status deleted
R1#
