Table Of Contents
Configuring IPSec VPN Fragmentation and MTU
Understanding IPSec VPN Fragmentation and MTU
Overview of Fragmentation and MTU
IPSec Prefragmentation
Fragmentation in Different Modes
Fragmentation in Crypto-Connect Mode
Fragmentation of IPSec (Using Crypto Maps) Packets in VRF Mode
Fragmentation of GRE Packets with Tunnel Protection in VRF Mode
Fragmentation in VTIs
Configuring IPSec Prefragmentation
IPSec Prefragmentation Configuration Guidelines
Configuring IPSec Prefragmentation Globally
Configuring IPSec Prefragmentation at the Interface
Verifying the IPSec Prefragmentation Configuration
Configuring MTU Settings
MTU Settings Configuration Guidelines and Restrictions
Changing the Physical Egress Interface MTU
Changing the Tunnel Interface MTU
Changing the Interface VLAN MTU
Verifying the MTU Size
Configuring IPSec VPN Fragmentation and MTU
This chapter provides information about configuring IPSec VPN fragmentation and the maximum transmission unit (MTU). It includes the following sections:
•
Understanding IPSec VPN Fragmentation and MTU
•
Configuring IPSec Prefragmentation
•
Configuring MTU Settings
For more information about the commands used in this chapter, see the Cisco 7600 Series Cisco IOS Command Reference, 12.2 SR publication. Also refer to the related Cisco IOS Release 12.2 software command reference and master index publications. For more information about accessing these publications, see the "Related Documentation" section.
Understanding IPSec VPN Fragmentation and MTU
This section includes the following topics:
•
Overview of Fragmentation and MTU
•
IPSec Prefragmentation
•
Fragmentation in Different Modes
Overview of Fragmentation and MTU
When a packet is nearly the size of the maximum transmission unit (MTU) of the physical egress port of the encrypting router, and it is encapsulated with IPSec headers, it probably will exceed the MTU of the egress port. This condition causes the packet to be fragmented after encryption (post-fragmentation), which requires the IPSec peer to perform reassembly before decryption, degrading its performance. To minimize post-fragmentation, you can set the MTU in the upstream data path to ensure that most fragmentation occurs before encryption (prefragmentation). Prefragmentation for IPSec VPNs avoids performance degradation by shifting the reassembly task from the receiving IPSec peer to the receiving end hosts.
Note
In this document, prefragmentation refers to fragmentation prior to any type of encapsulation, such as IPSec or GRE. IPSec prefragmentation refers to fragmentation prior to IPSec encryption.
To ensure prefragmentation in most cases, we recommend the following MTU settings:
•
The crypto interface VLAN MTU associated with the IPSec VPN SPA should be set to be equal or less than the egress interface MTU.
•
For GRE over IPSec, the IP MTU of the GRE tunnel interface should be set below the egress interface MTU by at least the overhead of IPSec encryption and the 24-byte GRE+IP header (20-byte IP header plus 4-byte GRE header). Because options such as tunnel key (RFC 2890) are not supported, the GRE+IP IP header will always be 24 bytes.
Note
The crypto interface VLAN MTU, the egress interface MTU, and the IP MTU of the GRE tunnel interface are all Layer 3 parameters.
The following are additional guidelines for IPSec prefragmentation and MTU in crypto-connect mode:
•
If a packet's DF (Don't Fragment) bit is set and the packet exceeds the MTU at any point in the data path, the packet will be dropped. To prevent a packet drop, clear the DF bit by using either policy-based routing (PBR) or the crypto df-bit clear command.
•
In Cisco IOS Release and 12(33)SRA, SRB, and SRC, and earlier releases, the IPSec VPN SPA does not support path MTU discovery (PMTUD) on GRE tunnels using the tunnel path-mtu-discovery command. In Cisco IOS Release SXI and later releases, PMTUD is supported on GRE tunnels.
•
If GRE encapsulation is not taken over by the IPSec VPN SPA, and if the packets exceed the IP MTU of the GRE tunnel interface, the route processor will fragment and encapsulate the packets.
Note
If the supervisor engine performs GRE encapsulation, the encapsulated packets will have the DF bit set.
The IPSec and GRE prefragmentation feature differs based on the Cisco IOS release, as described in Table 27-1.
Table 27-1 IPSec and GRE Prefragmentation based on Cisco IOS Release
Cisco IOS Release
|
Prefragmentation Feature
|
12.2(18)SXE
|
A single prefragmentation process occurs for both IPSec and GRE, based on the smaller of the IP MTU and the egress interface MTU. To prevent fragmentation or packet loss, configure the VLAN MTU as the largest predicted GRE packet size (IP length plus GRE overhead), and the egress interface MTU as the largest predicted GRE/IPSec packet size (IP length plus GRE overhead plus IPSec overhead).
|
12.2(18)SXF
|
GRE fragmentation and IPSec fragmentation are separate processes. If GRE encapsulation is performed by the IPSec VPN SPA, prefragmentation of outbound packets will be based on the IP MTU of the tunnel interface. After GRE encapsulation is performed by the IPSec VPN SPA, depending on the IPSec prefragmentation settings, further fragmentation may occur. The IPSec fragmentation behavior is unchanged from Cisco IOS Release 12.2(18)SXE, and is based on the IPSec MTU configuration of the egress interface.
|
12.2SRA
|
Path MTU discovery (PMTUD) is supported in crypto-connect mode.
|
For general information on fragmentation and MTU issues, see "Resolve IP Fragmentation, MTU, MSS, and PMTUD Issues with GRE and IPSec" at this URL:
http://www.cisco.com/en/US/tech/tk827/tk369/technologies_white_paper09186a00800d6979.shtml
IPSec Prefragmentation
In the IPSec prefragmentation process (also called Look-Ahead Fragmentation, or LAF), the encrypting router can predetermine the encapsulated packet size from information available in transform sets, which are configured as part of the IPSec security association (SA). IPSec prefragmentation avoids reassembly by the receiving router before decryption and helps improve overall IPSec traffic throughput by shifting the reassembly task to the end hosts.
A packet will be fragmented before encryption if it is predetermined that the encrypted packet will exceed the MTU of the output interface.
Fragmentation in Different Modes
The fragmentation process differs depending on the IPSec VPN mode and whether GRE or VTI are used, as described in the following sections:
•
Fragmentation in Crypto-Connect Mode
•
Fragmentation of IPSec (Using Crypto Maps) Packets in VRF Mode
•
Fragmentation of GRE Packets with Tunnel Protection in VRF Mode
•
Fragmentation in VTIs
In the following fragmentation descriptions, we assume that the DF (Don't Fragment) bit is not set for packets entering the flowchart. If a packet requires fragmentation and the DF bit is set, the packet will be dropped.
Fragmentation in Crypto-Connect Mode
The following are the relevant MTU settings for fragmentation of packets in crypto-connect mode:
•
The MTU of the interface VLAN.
Prefragmentation of non-GRE traffic by the RP will be based on this MTU.
•
The IP MTU of the GRE tunnel.
Prefragmentation of GRE traffic will be based on this MTU.
•
The MTU of the physical egress interface.
Pre- and post-fragmentation by the IPSec VPN SPA will be based on this MTU.
Fragmentation will be performed as follows:
•
If any packets to be sent to the IPSec VPN SPA exceed the MTU of the interface VLAN, the RP will perform prefragmentation before sending the packets to the IPSec VPN SPA.
•
If packets to be GRE encapsulated exceed the IP MTU of the GRE tunnel:
–
The RP will perform prefragmentation when the tunnel is not taken over by the IPSec VPN SPA.
–
The IPSec VPN SPA will perform prefragmentation when the tunnel is taken over by the IPSec VPN SPA.
•
If packets to be encrypted will exceed the MTU of the physical egress interface:
–
If IPSec prefragmentation is enabled, the IPSec VPN SPA will perform prefragmentation of the packets. The IPSec VPN SPA will not perform post-fragmentation.
–
If IPSec prefragmentation is disabled, the IPSec VPN SPA will perform post-fragmentation of the encrypted packets. The IPSec VPN SPA will not perform prefragmentation.
•
If unencrypted egress packets will exceed the MTU of the physical egress interface, the IPSec VPN SPA will perform fragmentation of the packets.
Figure 27-1 shows the fragmentation process for packets in crypto-connect mode.
Figure 27-1 Fragmentation of Packets in Crypto-Connect Mode
Fragmentation of IPSec (Using Crypto Maps) Packets in VRF Mode
The following are the relevant MTU settings for fragmentation of IPSec traffic in VRF mode:
•
The MTU of the interface VLAN.
Prefragmentation by the RP will be based on this MTU.
•
The MTU of the physical egress interface.
Pre- and post-fragmentation by the IPSec VPN SPA will be based on this MTU.
Fragmentation will be performed as follows:
•
If packets exceed the MTU of the interface VLAN, the RP will perform prefragmentation.
•
If encrypted egress packets will exceed the lowest MTU of any physical egress interface on the FVRF:
–
If IPSec prefragmentation is enabled, the IPSec VPN SPA will perform prefragmentation of the packets. The IPSec VPN SPA will not perform post-fragmentation.
–
If IPSec prefragmentation is disabled, the IPSec VPN SPA will perform post-fragmentation of the encrypted packets. The IPSec VPN SPA will not perform prefragmentation.
The fragmentation process for IPSec packets in VRF mode is shown in Figure 27-2.
Figure 27-2 Fragmentation of IPSec Packets in VRF Mode
Fragmentation of GRE Packets with Tunnel Protection in VRF Mode
The following are the relevant MTU settings for fragmentation of GRE traffic with tunnel protection in VRF mode:
•
The IP MTU of the GRE tunnel.
Prefragmentation will be based on this MTU.
•
The lowest MTU of any physical egress interface on the FVRF.
Pre- and post-fragmentation by the IPSec VPN SPA will be based on this MTU.
Fragmentation will be performed as follows:
•
If packets to be encapsulated exceed the IP MTU of the GRE tunnel:
–
The RP will perform prefragmentation when the tunnel is not taken over by the IPSec VPN SPA.
–
The IPSec VPN SPA will perform prefragmentation when the tunnel is taken over by the IPSec VPN SPA.
•
If encrypted GRE-encapsulated packets will exceed the lowest MTU of any physical egress interface on the FVRF:
–
If IPSec prefragmentation is enabled, the IPSec VPN SPA will perform prefragmentation of the GRE-encapsulated packets. The IPSec VPN SPA will not perform post-fragmentation.
–
If IPSec prefragmentation is disabled, the IPSec VPN SPA will perform post-fragmentation of the encrypted GRE-encapsulated packets. The IPSec VPN SPA will not perform prefragmentation.
The fragmentation process for GRE packets with tunnel protection in VRF mode is shown in Figure 27-3.
Figure 27-3 Fragmentation of GRE Packets with Tunnel Protection in VRF Mode
Fragmentation in VTIs
The following are the relevant MTU settings for fragmentation of VTI packets:
•
The IP MTU of the VTI tunnel interface.
Prefragmentation will be based on this MTU.
Note
We recommend that the IP MTU of the VTI tunnel interface be left at its default value. If you change it, be sure that it does not exceed the MTU of the physical egress interface minus the IPSec overhead.
•
The MTU of the physical egress interface.
Post-fragmentation by the IPSec VPN SPA will be based on this MTU.
Fragmentation will be performed as follows:
•
If IPSec prefragmentation is enabled, the IPSec VPN SPA will perform prefragmentation of packets that exceed the IP MTU of the VTI tunnel interface. The IPSec VPN SPA will not perform post-fragmentation.
Note
The RP will perform post-fragmentation of packets that exceed the MTU of the egress interface. This is considered a misconfiguration.
•
If IPSec prefragmentation is disabled, the IPSec VPN SPA will perform post-fragmentation of packets that exceed the MTU of the egress interface. The IPSec VPN SPA will not perform prefragmentation.
The fragmentation process for VTI packets is shown in Figure 27-4.
Figure 27-4 Fragmentation of VTI Packets
Configuring IPSec Prefragmentation
IPSec prefragmentation can be configured globally or at the interface level. By default, IPSec prefragmentation is enabled globally. Enabling or disabling IPSec prefragmentation at the interface will override the global configuration.
IPSec Prefragmentation Configuration Guidelines
When configuring IPSec prefragmentation, follow these guidelines:
•
To configure IPSec prefragmentation at the interface level, apply it on the interface to which the crypto map is applied.
•
If an IPSec peer is experiencing high CPU utilization with large packet flows, verify that IPSec prefragmentation is enabled (the peer may be reassembling large packets).
•
IPSec prefragmentation for IPSec VPNs operates in IPSec tunnel mode. It does not apply in IPSec transport mode.
•
IPSec prefragmentation for IPSec VPNs functionality depends on the crypto ipsec df-bit configuration of the interface to which the crypto map is applied, and on the incoming packet "do not fragment" (DF) bit state. For general information about prefragmentation, see the following URL:
http://www.cisco.com/en/US/docs/ios/12_2t/12_2t13/feature/guide/ftprefrg.html
•
The GRE fragmentation behavior differs according to the software release as follows:
–
In Cisco IOS Release 12.2(18)SXE, the GRE fragmentation behavior of the IPSec VPN SPA is determined by the lower of the IP MTU of the GRE interface and the Layer 2 MTU of the egress interface. In order to prevent fragmentation or packet loss, the VLAN MTU should be configured as the largest predicted GRE packet size (IP length plus GRE overhead), and the egress interface MTU should be configured as the largest predicted GRE/IPSec packet size (IP length plus GRE overhead plus IPSec overhead).
–
In Cisco IOS Releases 12.2(18)SXF and 12(33)SRA and later releases, GRE fragmentation and IPSec fragmentation are separate processes. If GRE encapsulation is performed by the IPSec VPN SPA, prefragmentation of outbound packets will be based on the IP MTU of the tunnel interface. After GRE encapsulation is performed by the IPSec VPN SPA, depending on the IPSec LAF (look ahead fragmentation) settings, further fragmentation may occur. The IPSec fragmentation behavior is unchanged from Cisco IOS Release 12.2(18)SXE, and is based on the IPSec MTU configuration of the egress interface. GRE+IP encapsulation adds 24 bytes to the packet size. When configuring for prefragmentation based on anticipated GRE overhead, use this value.
•
GRE+IP encapsulation adds 24 bytes to the packet size. When configuring for prefragmentation based on anticipated GRE overhead, use this value.
•
IPSec encryption adds a number of bytes to the packet size depending on the configured IPSec transform set. When configuring for prefragmentation based on anticipated IPSec overhead, use the following table of worst-case IPSec overhead bytes for various IPSec transform sets:
IPSec Transform Set
|
IPSec Overhead, Maximum Bytes
|
esp-aes-(256 or 192 or 128) esp-sha-hmac or md5
|
73
|
esp-aes (256 or 192 or 128)
|
61
|
esp-3des, esp-des
|
45
|
esp-(des or 3des) esp-sha-hmac or md5
|
57
|
esp-null esp-sha-hmac or md5
|
45
|
ah-sha-hmac or md5
|
44
|
Configuring IPSec Prefragmentation Globally
IPSec prefragmentation is globally enabled by default. To enable or disable prefragmentation for IPSec VPNs at the global level, perform this task beginning in global configuration mode:
| |
Command
|
Purpose
|
Step 1
|
Router(config)# crypto ipsec fragmentation
before-encryption
|
Enables prefragmentation for IPSec VPNs globally.
|
Step 2
|
Router(config)# crypto ipsec fragmentation
after-encryption
|
Disables prefragmentation for IPSec VPNs globally.
|
Configuring IPSec Prefragmentation at the Interface
IPSec prefragmentation is globally enabled by default. To enable or disable prefragmentation for IPSec VPNs at the interface level, perform this task beginning in interface configuration mode for the interface to which the crypto map is attached:
| |
Command
|
Purpose
|
Step 1
|
Router(config-if)# crypto ipsec fragmentation
before-encryption
|
Enables prefragmentation for IPSec VPNs on the interface.
|
Step 2
|
Router(config-if)# crypto ipsec fragmentation
after-encryption
|
Disables prefragmentation for IPSec VPNs on the interface.
|
Note
Enabling or disabling IPSec prefragmentation at the interface will override the global configuration.
Verifying the IPSec Prefragmentation Configuration
To verify that IPSec prefragmentation is enabled, consult the interface statistics on the encrypting router and the decrypting router. If fragmentation occurs on the encrypting router, and no reassembly occurs on the decrypting router, fragmentation is occurring before encryption, which means that the packets are not being reassembled before decryption and the feature is enabled.
To verify that the IPSec prefragmentation feature is enabled, enter the show running-configuration command on the encrypting router. If the feature is enabled, no fragmentation feature will appear in the command output:
Router# show running-configuration
crypto isakmp key abcd123 address 25.0.0.7
crypto ipsec transform-set fooprime esp-3des esp-sha-hmac
!!! the postfragmentation feature appears here if IPSec prefragmentation is disabled
crypto map bar 10 ipsec-isakmp
set transform-set fooprime
If IPSec prefragmentation has been disabled, the postfragmentation feature will appear in the command output:
Router# show running-configuration
crypto isakmp key abcd123 address 25.0.0.7
crypto ipsec transform-set fooprime esp-3des esp-sha-hmac
crypto ipsec fragmentation after-encryption
crypto map bar 10 ipsec-isakmp
set transform-set fooprime
To display the configuration of the encrypting router interface VLAN, enter the show running-configuration interface command. If the IPSec prefragmentation feature is enabled, a prefragmentation statement will appear in the command output:
Router# show running-configuration interface vlan2
ip address 15.0.0.2 255.255.255.0
crypto ipsec fragmentation before-encryption
If the IPSec prefragmentation feature has been disabled at the interface VLAN, a postfragmentation statement will appear in the command output:
Router# show running-configuration interface vlan2
ip address 15.0.0.2 255.255.255.0
crypto ipsec fragmentation after-encryption end
Configuring MTU Settings
The Cisco IOS software allows the configuration of the Layer 3 maximum transmission unit (MTU) of interfaces and VLANs. You should ensure that all MTU values are consistent to avoid unnecessary fragmentation of packets.
Note
When configuring MTU, note that the ip mtu command applies only to IP protocol traffic. Other Layer 3 protocol traffic will observe the MTU configured by the mtu command.
MTU Settings Configuration Guidelines and Restrictions
When configuring MTU settings for an IPSec VPN SPA, follow these guidelines and note these restrictions:
•
The MTU value used by the IPSec VPN SPA for fragmentation decisions is based on the MTU value of the secure port as follows:
–
Routed ports—Use the MTU value of their associated secure port.
–
Access ports—Use the MTU value of the secure port associated with their interface VLAN.
–
Trunk ports—Use the MTU value of the secure port associated with their interface VLAN.
•
If you have GRE tunneling configured, see the "IPSec Prefragmentation" section for information on the recommended MTU settings.
Note
For additional information on fragmentation of packets, see the "Configuring IPSec Prefragmentation" section.
Changing the Physical Egress Interface MTU
You can configure either the Layer 3 MTU or the IP MTU of the physical egress interface. To change the MTU value on a physical egress interface, perform this task beginning in global configuration mode:
| |
Command
|
Purpose
|
Step 1
|
Router(config)# interface type1 slot/port
|
Enters interface configuration mode for the interface.
|
Step 2
|
Router(config-if)# mtu bytes
|
Configures the maximum transmission unit (MTU) size for the interface.
• bytes—The range is 1500 to 9216; the default is 1500.
|
Changing the Tunnel Interface MTU
You can configure the IP MTU of the tunnel interface, but you cannot configure the Layer 3 MTU. To change the IP MTU value on a tunnel, perform this task beginning in global configuration mode:
| |
Command
|
Purpose
|
Step 1
|
Router(config)# interface tunnel_name
|
Enters interface configuration mode for the tunnel.
|
Step 2
|
Router(config-if)# ip mtu bytes
|
Configures the IP MTU size for the tunnel.
• bytes—The minimum is 68; the maximum and the default depend on the interface medium.
|
Changing the Interface VLAN MTU
You can configure the Layer 3 MTU of the interface VLAN. To change the MTU value on an interface VLAN, perform this task beginning in global configuration mode:
| |
Command
|
Purpose
|
Step 1
|
Router(config)# interface vlan_ID
|
Enters interface configuration mode for the VLAN.
|
Step 2
|
Router(config-if)# mtu bytes
|
Configures the MTU size for the interface VLAN.
• bytes—The range is 64 to 9216; the default is 1500.
|
Verifying the MTU Size
To verify the MTU size for an interface, enter the show interface command or the show ip interface command, as shown in the following examples:
To display the MTU value for a secure port, enter the show interface command:
Router# show interface g1/1
GigabitEthernet1/1 is up, line protocol is up (connected)
Hardware is C6k 1000Mb 802.3, address is 000a.8ad8.1c4a (bia 000a.8ad8.1c4a)
MTU 9216 bytes, BW 1000000 Kbit, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
To display the MTU size for an interface VLAN, enter the show interface command.
Router# show interface vlan2
Vlan2 is up, line protocol is up
Hardware is EtherSVI, address is 000e.39ad.e700 (bia 000e.39ad.e700)
Internet address is 192.168.1.1/16
MTU 1000 bytes, BW 1000000 Kbit, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
To display the IP MTU value for a GRE tunnel, enter the show ip interface command:
Router# show ip interface tunnel 2
Tunnel2 is up, line protocol is up
Internet address is 11.1.0.2/16
Broadcast address is 255.255.255.255
Address determined by non-volatile memory