Header and Payload Compression

Header Compression (RTP,TCP)

Header compression works by creating a context on both sides of a connection for each TCP/RTP data stream. The context contains header information for the stream so that data doesn’t need to be sent with every packet. For RTP, you can also send full headers periodically to refresh information. Header compression is only available for TCP and RTP.

Interface level Header Compression

PPP, HDLC

To enable header compression,use:
1
R(config-if)# ip {rtp|tcp} header compression [passive|ietf-format|iphc-format] [periodic-refresh]
2
! periodic-refresh - RTP only
Copied!
When using the passive keyword, compression will be used only for destinations that send compressed headers. Otherwise, all outgoing traffic will be compressed. Periodic refreshes means sending full headers from time to time, but this is available only for RTP The total number of context can be configured with:
1
R(config)# ip {rtp|tcp} compression-connections CONTEXTS
Copied!
Take into account that one context is used for each directions, so a bidirectional communication will use twice as much contexts if configured on both sides. Additional settings can be made with:
1
R(config-if)# ip header-compression ?
2
disable-feedback Switch off context status mechanism
3
max-header Maximim compressible header
4
max-period Number of Packets between refresh
5
max-time Time between refresh
6
recoverable-loss Maximum recoverable loss
Copied!
To see the status of header compression, use:
1
R# show ip {rtp|tcp} header-compression
Copied!

Frame Relay

On Frame Relay interfaces, TCP Header compression is only available on interfaces where the encapsulation used is cisco, not ietf. Header compression can be configured per interface or subinterface, using commands that start with frame-relay ip {rtp|tcp} header-compression.
1
R(config-if)# frame-relay ip {rtp|tcp} header-compression [passive][periodic-refresh]
2
R(config-fi)# frame-relay ip {rtp|tcp} compression-connections CONTEXTS
Copied!
When you configure on a multilink (sub)interface, header compression applies to all DLCIs. You can specifically disable compression on some DLCIs, using:
1
R(config-if)# frame-relay map PROTOCOL ADDRESS DLCI nocompress
Copied!
If you only want to enable on some DLCIs, use:
1
R(config-if)# frame-relay map PROTOCOL ADDRESS DLCI compress {active|passive} [connections CONTEXTS] [periodic-refresh]
Copied!

Class Based Header Compression

You can also configure header compression inside an outgoing policy for traffic matched by a class defintion. You should use the following command to enable header compression:
1
R(config-pmap-c)# compression [header [ip [rtp|tcp]]]
2
! If you do not specify rtp or tcp, both are compressed
3
! The policy-map can pe applied only outgoing
Copied!

IPHC Profile

Another option is to use IPHC Profiles. First define the profile:
1
R(config)#iphc-profile PROFILE-NAME {ietf|van-jacobsen}
Copied!
Then set compression options:
1
R(config-iphc)# ?
2
IPHC Profile configuration commands:
3
exit Exit from IPHC Profile configuration mode
4
feedback enable feedback
5
maximum set the limit for IPHC options
6
no Negate or set default values of a command
7
non-tcp enable non-tcp header-compression
8
recoverable-loss ECRTP Recoverable loss
9
refresh context refresh options
10
rtp enable rtp header-compression
11
tcp enable tcp header-compression
Copied!
In the end apply the profile per interface:
1
R(config-if)# iphc-profile PROFILE-NAME
Copied!
To verifu, use:
1
R# sh iphc-profile [PROFILE-NAME]
Copied!
Payload compression is available on serial interfaces and it depends on the type of encapsulation. Most payload compression techniques are based on the Stacker or the Predictor algorithm: Stacker algorithm tries to replace big chunks of data with index in a dictionary. It requires less memory and more CPU, it is more efficient, but less faster. Predictor algorithm tries to predict the next character. It requires more memory and less CPU, it is less efficient but is faster. When determining QoS byte counts, legacy QoS uses the data before compression, while the more modern MQC uses the data after compression. To monitor compression, use:
1
R# show compress [details]
Copied!
Payload compression options differ based on the encapsulation used:

HDLC

1
! HDLC:
2
R(config-if)# encapsulation hdlc
3
R(config-if)# compress ?
4
stac stac compression algorithm
Copied!

PPP

1
R(config-if)# encapsulation ppp
2
R(config-if)# compress ?
3
lzs lzs compression type
4
mppc MPPC compression type
5
predictor predictor compression type
6
stac stac compression algorithm
Copied!

Frame Relay

Per interface or subinterface:
1
R(config-if)# frame-relay payload-compression ?
2
FRF9 FRF9 encapsulation - standard based
3
data-stream cisco proprietary encapsulation
4
packet-by-packet cisco proprietary encapsulation (similar to Predictor)
Copied!
Per VC:
1
R(config-if)# frame-relay map PROTOCOL ADDRESS DLCI payload-compression ?
2
FRF9 FRF9 encapsulation - standard based
3
data-stream cisco proprietary encapsulation
4
packet-by-packet cisco proprietary encapsulation (similar to Predictor)
Copied!