Configuring TCP Header Compression

Last Updated: December 5, 2011

Header compression is a mechanism that compresses the IP header in a packet before the packet is transmitted. Header compression reduces network overhead and speeds up the transmission of either Real-Time Transport Protocol (RTP) or TCP packets.

Cisco provides two types of header compression: RTP header compression and TCP header compression. This module describes the concepts and tasks related to configuring TCP header compression.


Note


TCP header compression is configured on a per-interface (or subinterface) basis. If you want to configure TCP header compression on a per-class basis, see the "Configuring Class-Based RTP and TCP Header Compression" module.

Finding Feature Information

Your software release may not support all the features documented in this module. For the latest feature information and caveats, see the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the Feature Information Table at the end of this document.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.

Prerequisites for Configuring TCP Header Compression

  • Before configuring TCP header compression, read the information in the "Header Compression" module.
  • You must configure TCP header compression on both ends of the network.

Information About Configuring TCP Header Compression

TCP Header-Compression Keywords

When you configure TCP header compression, you can specify the circumstances under which the TCP packets are compressed and the format that is used when the packets are compressed. These circumstances and formats are defined by the following keywords:

  • passive
  • iphc-format
  • ietf-format

These keywords (described below) are available with many of the quality of service (QoS) commands used to configure TCP header compression, such as the ip tcp header-compression command. For more information about the ip tcp header-compression command, these keywords, and the other QoS commands, see the Cisco IOS Quality of Service Solutions Command Reference.

The passive Keyword

By default, the ip tcp header-compression command compresses outgoing TCP traffic. If you specify the passive keyword, outgoing TCP traffic is compressed only if incoming TCP traffic on the same interface is compressed. If you do not specify the passive keyword, all outgoing TCP traffic is compressed.

The passive keyword is ignored for PPP interfaces.

The iphc-format Keyword

The iphc-formatkeyword indicates that the IP Header Compression (IPHC) format of header compression will be used. For PPP and HDLC interfaces, when the iphc-format keyword is specified, RTP header compression is also enabled. Since both TCP and RTP header compression are enabled, both TCP and UDP packets are compressed.

The iphc-formatkeyword is not available for interfaces that use Frame Relay encapsulation.


Note


The header compression format (in this case, IPHC) must be the same at both ends of the network. That is, if you specify the iphc-format keyword on the local router, you must also specify the iphc-format keyword on the remote router.

The ietf-format Keyword

The ietf-format keyword indicates that the Internet Engineering Task Force (IETF) format of header compression will be used. For HDLC interfaces, the ietf-format keyword compresses only TCP packets. For PPP interfaces, when the ietf-formatkeyword is specified, RTP header compression is also enabled. Since both TCP header compression and RTP header compression are enabled, both TCP packets and UDP packets are compressed.

The ietf-format keyword is not available for interfaces that use Frame Relay encapsulation.


Note


The header compression format (in this case, IETF) must be the same at both ends of the network. That is, if you specify the ietf-formatkeyword on the local router, you must also specify the ietf-format keyword on the remote router.

Maximum Compressed IP Header Size and TCP Header Compression

With TCP header compression, you can configure the maximum size of the compressed IP header by using the ip header-compression max-header command.

The ip header-compression max-header command allows you to define the maximum size of the IP header of a packet to be compressed. Any packet with an IP header that exceeds the maximum size is sent uncompressed. For more information about the ip header-compression max-header command, see the Cisco IOS Quality of Service Solutions Command Reference.

How to Configure TCP Header Compression

Enabling TCP Header Compression on an Interface


Note


To enable TCP header compression on an interface that uses Frame Relay encapsulation, skip these steps and complete the steps in the Enabling TCP Header Compression on an Interface That Uses Frame Relay Encapsulation instead.

To enable TCP header compression on an interface, perform the following steps.

SUMMARY STEPS

1.    enable

2.    configure terminal

3.    interface type number [name-tag]

4.    encapsulation encapsulation-type

5.    ip address ip-address mask [secondary]

6.    ip tcp header-compression [passive | iphc-format | ietf-format]

7.    end


DETAILED STEPS
  Command or Action Purpose
Step 1
enable


Example:

Router> enable

 

Enables privileged EXEC mode.

  • Enter your password if prompted.
 
Step 2
configure terminal


Example:

Router# configure terminal

 

Enters global configuration mode.

 
Step 3
interface type number [name-tag]


Example:

Router(config)# interface serial0

 

Configures an interface type and enters interface configuration mode.

  • Enter the interface type and the interface number.
 
Step 4
encapsulation encapsulation-type


Example:

Router(config-if)# encapsulation ppp

 

Sets the encapsulation method used by the interface.

  • Enter the encapsulation method.
 
Step 5
ip address ip-address mask [secondary]


Example:

Router(config-if)# ip address 209.165.200.225 255.255.255.224

 

Sets a primary or secondary IP address for an interface.

  • Enter the IP address and mask for the associated IP subnet.
 
Step 6
ip tcp header-compression [passive | iphc-format | ietf-format]


Example:

Router(config-if)# ip tcp header-compression ietf-format

 

Enables TCP header compression.

 
Step 7
end


Example:

Router(config-if)# end

 

(Optional) Exits interface configuration mode.

 

Enabling TCP Header Compression on an Interface That Uses Frame Relay Encapsulation

To enable TCP header compression on an interface that uses Frame Relay encapsulation, perform the following steps.


Note


The encapsulation type is specified by using either the cisco or ietf keyword of the frame-relayinterface-dlci command. The cisco keyword specifies Cisco proprietary encapsulations, and the ietf keyword specifies IETF encapsulations. However, note the following points about these keywords:

  • Frame Relay interfaces do not support IETF encapsulations when TCP header compression is enabled. Therefore, the ietfkeyword is not available for Frame Relay interfaces and is not listed in the command syntax shown below.
  • The cisco keyword is available for use on point-to-point subinterfaces only .
>
SUMMARY STEPS

1.    enable

2.    configure terminal

3.    interface type number [name-tag]

4.    encapsulation frame-relay

5.    ip address ip-address mask [secondary]

6.    frame-relay interface-dlci dlci [cisco]

7.    frame-relay ip tcp header-compression [passive]

8.   

9.    frame-relay map ip ip-address dlci [broadcast] tcpheader-compression [active | passive] [connectionsnumber]

10.    end


DETAILED STEPS
  Command or Action Purpose
Step 1
enable


Example:

Router> enable

 

Enables privileged EXEC mode.

  • Enter your password if prompted.
 
Step 2
configure terminal


Example:

Router# configure terminal

 

Enters global configuration mode.

 
Step 3
interface type number [name-tag]


Example:

Router(config)# interface serial0

 

Configures an interface type and enters interface configuration mode.

  • Enter the interface type and the interface number.
 
Step 4
encapsulation frame-relay


Example:

Router(config-if)# encapsulation frame-relay

 

Enables Frame Relay encapsulation.

 
Step 5
ip address ip-address mask [secondary]


Example:

Router(config-if)# ip address 209.165.200.225 255.255.255.224

 

Sets a primary or secondary IP address for an interface.

  • Enter the IP address and mask for the associated IP subnet.
 
Step 6
frame-relay interface-dlci dlci [cisco]


Example:

Router(config-if)# frame-relay interface-dlci 20

 

Assigns a data-link connection identifier (DLCI) to a specified Frame Relay interface on the router or access server.

  • Enter the DLCI number.
 
Step 7
frame-relay ip tcp header-compression [passive]


Example:

Router(config-if)# frame-relay ip tcp header-compression

 

Enables TCP header compression for all Frame Relay maps on a physical interface.

 
Step 8

 

 
Step 9
frame-relay map ip ip-address dlci [broadcast] tcpheader-compression [active | passive] [connectionsnumber]


Example:

Router(config-if)# frame-relay map ip 10.108.175.200 190 tcp header-compression active

 

Assigns to an IP map header-compression characteristics that differ from the compression characteristics of the interface with which the IP map is associated.

  • Enter the IP address, DLCI number, and any optional keywords and arguments.
 
Step 10
end


Example:

Router(config-if)# end

 

(Optional) Exits interface configuration mode.

 

Enabling Special-VJ Format TCP Header Compression

To enable the special Van Jacobson (VJ) format of TCP header compression so that context IDs are included in compressed packets, perform the following steps.

Before You Begin

Enable TCP header compression using the ip tcp header-compression command before configuring the special-VJ format.


Note


This task is unnecessary if IPHC was configured on an interface using the iphc-profilecommand.

>

SUMMARY STEPS

1.    enable

2.    configure terminal

3.    interface type number [name-tag]

4.    encapsulation ppp

5.    ip address ip-address mask [secondary]

6.    ip tcp header-compression

7.    ip header-compression special-vj

8.    ip tcp compression-connections number

9.    exit

10.    iphc-profile profile-name van-jacobson

11.    special-vj

12.    end


DETAILED STEPS
  Command or Action Purpose
Step 1
enable


Example:

Router> enable

 

Enables privileged EXEC mode.

  • Enter your password if prompted.
 
Step 2
configure terminal


Example:

Router# configure terminal

 

Enters global configuration mode.

 
Step 3
interface type number [name-tag]


Example:

Router(config)# interface serial 0

 

Configures an interface type and enters interface configuration mode.

  • Enter the interface type and the interface number.
 
Step 4
encapsulation ppp


Example:

Router(config-if)# encapsulation ppp

 

(Optional) Sets the encapsulation method used by the interface.

 
Step 5
ip address ip-address mask [secondary]


Example:

Router(config-if)# ip address 209.165.200.225 255.255.255.224

 

Sets a primary or secondary IP address for an interface.

  • Enter the IP address and mask for the associated IP subnet.
 
Step 6
ip tcp header-compression

Example:

Router(config-if)# ip header-compression

 
Enables TCP header compression.
 
Step 7
ip header-compression special-vj

Example:

Router(config-if)# ip header-compression special-vj

 
            
              Enables the special VJ format of TCP header compression.
          
 
Step 8
ip tcp compression-connections number


Example:

Router(config-if)# ip tcp compression-connections 16

 
Specifies the total number of TCP header compression connections that can exist on an interface.
 
Step 9
exit


Example:

Router(config-if)# exit

 

Exits the current configuration mode.

 
Step 10
iphc-profile profile-name van-jacobson


Example:

Router(config)# iphc-profile profile1 van-jacobson

 

Creates an IP Header Compression (IPHC) profile and enters IPHC profile configuration mode.

 
Step 11
special-vj


Example:

Router(config-iphcp)# special-vj

 
            
              Enables the special VJ format of TCP header compression so that context IDS are included in compressed packets. 
          
 
Step 12
end


Example:

Router(config-if)# end

 

(Optional) Exits the current configuration mode.

 

Changing the Maximum Size of the Compressed IP Header

By default, the maximum size of the compressed IP header is 168 bytes. When you configure TCP header compression, you can change this size to suit the needs of your network.

To change the maximum size of the compressed IP header, perform the following steps.

SUMMARY STEPS

1.    enable

2.    configure terminal

3.    interface type number [name-tag]

4.    ip header-compression max-header max-header-size

5.    end


DETAILED STEPS
  Command or Action Purpose
Step 1
enable


Example:

Router> enable

 

Enables privileged EXEC mode.

  • Enter your password if prompted.
 
Step 2
configure terminal


Example:

Router# configure terminal

 

Enters global configuration mode.

 
Step 3
interface type number [name-tag]


Example:

Router(config)# interface serial0

 

Configures an interface type and enters interface configuration mode.

  • Enter the interface type and the interface number.
 
Step 4
ip header-compression max-header max-header-size


Example:

Router(config-if)# ip header-compression max-header 100

 

Specifies the maximum size of the compressed IP header.

  • Enter the maximum size of the compressed IP header, in bytes.
 
Step 5
end


Example:

Router(config-if)# end

 

(Optional) Exits interface configuration mode.

 

Changing the Number of Header-Compression Connections

For PPP and HDLC interfaces, the default is 16 compression connections. For interfaces that use Frame Relay encapsulation, the default is 256 compression connections.

To change the default number of header-compression connections, perform the following steps.

Implications of Changing the Number of Header-Compression Connections

Each header-compression connection sets up a compression cache entry, so you are in effect specifying the maximum number of cache entries and the size of the cache. Too few cache entries for the specified interface can lead to degraded performance, and too many cache entries can lead to wasted memory. Choose the number of compression connections according to the network requirements.


Note


Header-Compression Connections on HDLC and Frame Relay Interfaces

For HDLC interfaces and Frame Relay interfaces (that is, interfaces that use Frame Relay encapsulation), the number of header-compression connections on both sides of the network must match. That is, the number configured for use on the local router must match the number configured for use on the remote router.

Header-Compression Connections on PPP Interfaces

For PPP interfaces, if the header-compression connection numbers on both sides of the network do not match, the number used is "autonegotiated." That is, any mismatch in the number of header-compression connections between the local router and the remote router will be automatically negotiated to the lower of the two numbers. For example, if the local router is configured to use 128 header-compression connections, and the remote router is configured to use 64 header-compression connections, the negotiated number will be 64.


Note


This autonegotiation function applies to PPP interfaces only . For HDLC interfaces and interfaces that use Frame Relay encapsulation, no autonegotiation occurs.
>
SUMMARY STEPS

1.    enable

2.    configure terminal

3.    interface type number [name-tag]

4.    ip tcp compression-connections number

5.   

6.    frame-relay ip tcp compression-connections number

7.    end


DETAILED STEPS
  Command or Action Purpose
Step 1
enable


Example:

Router> enable

 

Enables privileged EXEC mode.

  • Enter your password if prompted.
 
Step 2
configure terminal


Example:

Router# configure terminal

 

Enters global configuration mode.

 
Step 3
interface type number [name-tag]


Example:

Router(config)# interface serial0

 

Configures an interface type and enters interface configuration mode.

  • Enter the interface type and the interface number.
 
Step 4
ip tcp compression-connections number


Example:

Router(config-if)# ip tcp compression-connections 150

 

Specifies the total number of TCP header compression connections that can exist on an interface.

  • Enter the number of compression connections.
Note    This command can be used for PPP interfaces, HDLC interfaces, or interfaces that use Frame Relay encapsulation.
 
Step 5

 

 
Step 6
frame-relay ip tcp compression-connections number


Example:

Router(config-if)# frame-relay ip tcp compression-connections 150

 

Specifies the maximum number of TCP header compression connections that can exist on an interface that use Frame Relay encapsulation.

  • Enter the number of compression connections.
Note    This command can be used for interfaces that use Frame Relay encapsulation only .
 
Step 7
end


Example:

Router(config-if)# end

 

(Optional) Exits interface configuration mode.

 

Displaying Header-Compression Statistics

You can display header-compression statistics, such as the number of packets sent, received, and compressed, by using either the show ip tcp header-compression command or the show frame-relay ip tcp header-compression command.

To display header-compression statistics, perform the following steps.

SUMMARY STEPS

1.    enable

2.    show ip tcp header-compression [interface-type interface-number] [detail]

3.   

4.    show frame-relay ip tcp header-compression [interface type number]

5.    end


DETAILED STEPS
  Command or Action Purpose
Step 1
enable


Example:

Router> enable

 

Enables privileged EXEC mode.

  • Enter your password if prompted.
 
Step 2
show ip tcp header-compression [interface-type interface-number] [detail]


Example:

Router# show ip tcp header-compression



Example:

 

Displays TCP/IP header compression statistics.

 
Step 3

 

 
Step 4
show frame-relay ip tcp header-compression [interface type number]


Example:

Router# show frame-relay ip tcp header-compression



Example:

 

Displays Frame Relay TCP/IP header compression statistics for one or all interfaces.

 
Step 5
end


Example:

Router# end

 

(Optional) Exits privileged EXEC mode.

 

Configuration Examples for TCP Header Compression

Example Enabling TCP Header Compression on an Interface

In the following example, TCP header compression is enabled on serial interface 0.

Router> enable
Router# configure terminal
Router(config)# interface serial0 
Router(config-if)# encapsulation ppp 
Router(config-if)# ip address 209.165.200.225 255.255.255.224
Router(config-if)# ip tcp header-compression ietf-format
Router(config-if)# end
 
      

Example Enabling TCP Header Compression on an Interface That Uses Frame Relay Encapsulation

In the following example, TCP header compression is enabled on serial interface 0. Frame Relay encapsulation has been enabled on this interface by using the encapsulationframe-relay command.

Router> enable
Router# configure terminal
Router(config)# interface serial0
Router(config-if)# encapsulation frame-relay
Router(config-if)# ip address 209.165.200.225 255.255.255.224
Router(config-if)# frame-relay interface-dlci 20
Router(config-if)# frame-relay ip tcp header-compression
Router(config-if)# end

Example Enabling Special-VJ Format TCP Header Compression

In the following example, TCP header compression is enabled on serial interface 0. The special VJ format has been enabled on this interface by using the ip header-compression special-vj, ip tcp compression-connections, and the special-vjcommands:

Router> enable
Router# configure terminal
Router(config)# interface serial0
Router(config-if)# ip address 209.165.200.225 255.255.255.224
Router(config-if)# ip tcp header-compression 
Router(config-if)# ip header-compression special-vj
Router(config-if)# ip tcp compression-connections 16
Router(config-if))# exit
Router(config)# iphc-profile  profile-name  van-jacobson
Router(config-iphcp)# special-vj Router(config-if)# end

Example Changing the Maximum Size of the Compressed IP Header

In the following example, the maximum size of the compressed IP header (100 bytes) has been specified by using the ip header-compression max-header command:

Router> enable
Router# configure terminal
Router(config)# interface serial0 
Router(config-if)# ip header-compression max-header 100
Router(config-if)# end

Example Changing the Number of Header-Compression Connections

In the following example, the number of header-compression connections has been changed to 150 by using the ip tcp compression-connectionscommand:

Router> enable
Router# configure terminal
Router(config)# interface serial0 
Router(config-if)# ip tcp compression-connections 150
Router(config-if)# end

Example Displaying Header-Compression Statistics

You can use the show ip tcp header-compressioncommand to display header-compression statistics such as the number of packets received, sent, and compressed. The following is sample output from the show ip tcp header-compression command:

Router# show ip tcp header-compression serial0
TCP/IP header compression statistics:
  Interface Serial0 (compression on, IETF)
    Rcvd:    53797 total, 53796 compressed, 0 errors, 0 status msgs
             0 dropped, 0 buffer copies, 0 buffer failures
    Sent:    53797 total, 53796 compressed, 0 status msgs, 0 not predicted
             1721848 bytes saved, 430032 bytes sent
             5.00 efficiency improvement factor
    Connect: 16 rx slots, 16 tx slots,
             1 misses, 0 collisions, 0 negative cache hits, 15 free contexts
             99% hit ratio, five minute miss rate 0 misses/sec, 0 max

Additional References

The following sections provide references related to configuring TCP header compression.

Related Documents

Related Topic

Document Title

Cisco IOS commands

Cisco IOS Master Commands List, All Releases

QoS commands: complete command syntax, command modes, command history, defaults, usage guidelines, and examples

Cisco IOS Quality of Service Solutions Command Reference

Frame Relay

"Frame Relay Queueing and Fragmentation at the Interface" module

Header compression overview

"Header Compression" module

RTP header compression

"Configuring RTP Header Compression" module

Class-based RTP and TCP header compression

"Configuring Class-Based RTP and TCP Header Compression" module

IPHC profiles and header compression

"Configuring Header Compression Using IPHC Profiles" module

Standards

Standard

Title

No new or modified standards are supported, and support for existing standards has not been modified.

--

MIBs

MIB

MIBs Link

No new or modified MIBs are supported, and support for existing MIBs has not been modified.

To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found at the following URL:

http://www.cisco.com/go/mibs

RFCs

RFC

Title

RFC 1144

Compressing TCP/IP Headers for Low-Speed Serial Links

RFC 2507

IP Header Compression

RFC 3544

IP Header Compression over PPP

Technical Assistance

Description

Link

The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password.

http://www.cisco.com/cisco/web/support/index.html

Glossary

compression --The running of a data set through an algorithm that reduces the space required to store the data set or the bandwidth required to transmit the data set.

DLCI --data-link connection identifier. A value that specifies a permanent virtual circuit (PVC) or switched virtual circuit (SVC) in a Frame Relay network. In the basic Frame Relay specification, DLCIs are locally significant (connected devices might use different values to specify the same connection). In the Local Management Interface (LMI) extended specification, DLCIs are globally significant (DLCIs uniquely specify individual end devices).

encapsulation --A method of wrapping data in a particular protocol header. For example, Ethernet data is wrapped in a specific Ethernet header before network transit. Also, when dissimilar networks are bridged, the entire frame from one network is simply placed in the header used by the data link layer protocol of the other network.

full header (header refresh) --An uncompressed header that updates or refreshes the context for a packet stream. It carries a context identifier (CID) that will be used to identify the context. Full headers for non-TCP packet streams also carry the generation of the context that they update or refresh.

HDLC --High-Level Data Link Control. A bit-oriented synchronous data link layer protocol developed by the International Organization for Standardization (ISO). Derived from Synchronous Data Link Control (SDLC), HDLC specifies a data encapsulation method on synchronous serial links using frame characters and checksums.

header --A chain of subheaders.

IETF --Internet Engineering Task Force. A task force that consists of over 80 working groups responsible for developing Internet standards.

IPHC --IP Header Compression. A protocol capable of compressing both TCP and UDP headers.

PPP --Point-to-Point Protocol. A protocol that provides router-to-router and host-to-network connections over synchronous and asynchronous circuits.

regular header --A normal, uncompressed header. A regular header does not carry a context identifier (CID) or generation association.

subheader --An IPv6 base header, an IPv6 extension header, an IPv4 header, a UDP header, an RTP header, or a TCP header.

TCP --Transmission Control Protocol. A connection-oriented transport layer protocol that provides reliable full-duplex data transmission. TCP is part of the TCP/IP protocol stack.

UDP --User Datagram Protocol. A connectionless transport layer protocol in the TCP/IP protocol stack. UDP is a simple protocol that exchanges datagrams without acknowledgments or guaranteed delivery, requiring that error processing and retransmission be handled by other protocols. UDP is defined in RFC 768.

Feature Information for Configuring TCP Header Compression

The following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.

Table 1 Feature Information for Configuring TCP Header Compression

Feature Name

Releases

Feature Information

This table is intentionally left blank because no features were introduced or modified in Cisco IOS Release 12.2(1) or a later release. This table will be updated when feature information is added to this module.

--

--

Cisco and the Cisco logo are trademarks or registered trademarks of Cisco and/or its affiliates in the U.S. and other countries. To view a list of Cisco trademarks, go to this URL: www.cisco.com/go/trademarks. Third-party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1110R)

Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.

© 2011 Cisco Systems, Inc. All rights reserved.