NAT Working Group                                          Bernard Aboba
INTERNET-DRAFT                                                 Microsoft
Category: Informational
<draft-aboba-nat-ipsec-01.txt>
26 May 2000

                             NAT and IPSEC


1.  Status of this Memo

This document is an Internet-Draft and is in full conformance with all
provisions of Section 10 of RFC2026.

Internet-Drafts are working documents of the Internet Engineering Task
Force (IETF), its areas, and its working groups.  Note that other groups
may also distribute working documents as Internet-Drafts.

Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time.  It is inappropriate to use Internet-Drafts as reference material
or to cite them other than as "work in progress."

The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt

The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html.

2.  Copyright Notice

Copyright (C) The Internet Society (2000).  All Rights Reserved.

3.  Abstract

Perhaps the most common use of IPSEC is in providing virtual private
networking capabilities. One very popular use of VPNs is to provide
tele-commuter access to the corporate Intranet.  With NATs being
increasingly deployed in home gateways, NAT-IPSEC incompatibilities have
become a major barrier to deployment of IPSEC in one of its principal
uses. This draft discusses the incompatibilities between NAT and IPSEC
and suggests how IPSEC might be made more NAT friendly.

4.  Requirements language

In this document, the key words "MAY", "MUST,  "MUST  NOT",  "optional",
"recommended",  "SHOULD",  and  "SHOULD  NOT",  are to be interpreted as
described in [2].



Aboba                         Informational                     [Page 1]

INTERNET-DRAFT               NAT and IPSEC                   26 May 2000


5.  Introduction

Perhaps the most common use of IPSEC [6] is in providing virtual private
networking capabilities. One very popular use of VPNs is to provide
tele-commuter access to the corporate Intranet.  With NATs being
increasingly deployed in home gateways, NAT-IPSEC incompatibilities have
become a major barrier to deployment of IPSEC in one of its principal
uses. This draft discusses the incompatibilities between NAT and IPSEC
and suggests how IPSEC might be made more NAT friendly.

6.  NAT/IPSEC incompatibilities

The known incompatibilities between NAT and IPSEC are as follows:

a) IPSEC AH [3] will not go through the NAT, because the AH header
   incorporates the IP source and destination fields in the
   authentication hash.

b) IPSEC ESP [4] does not incorporate the IP source and destination
   fields in its authentication hash. However, there is an
   implicit dependency on source and destination addresses within
   TCP/UDP/SCTP checksums which cover the "pseudo-header."
   Therefore IPSEC ESP will only go through the NAT if
   TCP/UDP/SCTP protocols are not involved (as in IPSEC tunnel
   mode or IPSEC/GRE), UDP checksums are turned off (TCP
   checksums are required), or if TCP/UDP/SCTP checksums are
   ignored by the receiving party.

c) Where IP addresses are used as identifiers in IKE MM [7]
   or QM, IKE will only go through the NAT if the parties do not
   check or use IP addresses in IKE MM identifiers (several
   current implementations don't do this) AND if in addition
   they don't check or use IP addresses in IKE QM identifiers
   (most implementations DO use addresses and check them).

d) Because of IKE re-keying behavior, it is necessary for
   implementations to float their IKE source port in order
   to enable NATs to de-multiplex incoming re-keys which may
   not use the same cookies as the earlier traffic. Otherwise
   it is possible for the re-key to be sent to the wrong SA
   by the NAT.

e) In order to enable an IPSEC implementation to send traffic
   down the correct IPSEC SA, it is necessary for those SAs
   to be differentiated in some way. In practice this implies
   negotiation of non-overlapping SPD entries. For example, if
   two clients behind a NAT were to negotiate the same SPD
   entries, then there would be no way to decide which SA



Aboba                         Informational                     [Page 2]

INTERNET-DRAFT               NAT and IPSEC                   26 May 2000


   to use to protect a given packet.

f) Since ESP traffic is encrypted and thus opaque to the NAT,
   the NAT must use elements of the IP and IPSEC header to
   demultiplex incoming IPSEC traffic. The combination of the
   source IP address, security protocol (AH/ESP) and IPSEC SPI
   is typically used for this purpose. As noted in [6]:

   "The receiver-orientation of the Security Association implies that,
   in the case of unicast traffic, the destination system will normally
   select the SPI value.  By having the destination select the SPI
   value, there is no potential for manually configured Security
   Associations to conflict with automatically configured (e.g., via a
   key management protocol) Security Associations or for Security
   Associations from multiple sources to conflict with each other."

   This implies that if the source is located behind a NAT, but the
   destination is not, then the combination of the destination address,
   security protocol and SPI will be unique. However, if the
   destination is located behind a NAT, then it is possible
   (though unlikely) that the same SPI value may be chosen by
   two or more destinations behind the NAT. In this case the
   NAT could send the IPSEC packets to the wrong destination.

g) Since the payload is integrity protected, any IP addresses
   enclosed within the payload will not be translatable by the
   NAT. There are many protocols that utilize embedded IP
   addresses, including FTP, IRC, SNMP, LDAP, H.323
   SIP, and many games.


7.  Recommendations

It is recommended that the following actions be taken to improve the
NAT-friendliness of IPSEC:

a) Since IPSEC ESP null provides much the same security
   services as IPSEC AH, but without explicitly covering
   the IP header in its authentication hash, it is
   recommended that IPSEC ESP null be used instead of AH.

b) Since transport mode IPSEC traffic is integrity protected
   and authenticated using strong cryptography, there is little
   to gained by having the receiver check TCP/UDP/SCTP checksums
   on traffic protected by IPSEC transport mode SAs. It is
   therefore recommended that checksum verification be made
   optional in this case.




Aboba                         Informational                     [Page 3]

INTERNET-DRAFT               NAT and IPSEC                   26 May 2000


c) Since proper de-multiplexing of IKE re-keys is dependent on
   initiators floating their IKE source ports, it is recommended
   that IKE implementations float their source ports.

d) It is recommended that IP addresses not be used as identifiers
   in IKE MM or QM, where this can be avoided. Where user authentication
   is desired, an ID type of ID_USER_FQDN can be used, as described in
   [5]. Where machine authentication is desired, an ID type of ID_FQDN
   can be used. In practice, use of IP addresses as identifiers in IKE
   provides little security value, since assuming that the integrity
   of the IKE packets is verified, it can be assumed that the
   correspondent has possession of the negotiated keys. Note that
   restricting identifiers to ID_USER_FQDN or ID_FQDN would prevent
   use of subnet or address range identifiers, which may be required
   for gateway to gateway communications. Thus this approach is not
   universally applicable.

e) In tele-commuter scenarios, it is expected that both IPSEC
   transport mode (for L2TP/IPSEC as well as other UDP and TCP)
   and IPSEC tunnel mode will be commonly used. In these
   cases, the SPD entries typically only need to protect traffic
   between the two endpoints. In such circumstances, ID_USER_FQDN
   or ID_FQDN identifiers should be used within the SPD negotiation
   in IKE QM. Since restricting identifiers to ID_USER_FQDN or ID_FQDN
   would prevent use of subnet or address range identifiers, this
   approach may not be applicable in gateway to gateway communications.

f) If the above techniques are not feasible, alternative approaches
   should be considered. One currently popular technique is to
   encapsulate IP/IPSEC within a TCP or UDP payload, and then remove
   the outermost IP and transport header at the receiver, thus
   reconstructing the original packet without modification. While this
   method does introduce extra overhead, it does not require any
   modifications to IPSEC/IKE or checksum verification procedures.

8.  Security considerations

It is not believed that the changes described above will impact IPSEC
security adversely. There is no security value to TCP/UDP/SCTP
checksums, so not checking them does not decrease security. Similarly,
use of IPSEC ESP null instead of AH does not introduce any security
vulnerabilities.

Use of ID_FQDN or ID_USER_FQDN identifiers in IKE QM does raise the
issue as to what traffic will be accepted in the IPSEC SA. Since packets
will be integrity protected, it is possible to verify that the source is
in posession of the negotiated keys. Thus for transport mode SAs, it
does not appear strictly necessary to filter by address, only to verify



Aboba                         Informational                     [Page 4]

INTERNET-DRAFT               NAT and IPSEC                   26 May 2000


packet integrity.

However, for tunnel mode SAs, if subnet or IP address range identifiers
are not used, it is reasonable to assume that only traffic from a single
IP address is permitted inside the tunnel. A reasonable assumption would
be that this IP address corresponds to the source address used when
setting up the IKE QM SA.

9.  Acknowledgments

Thanks to Steve Bellovin of AT&T Research, William Dixon of Microsoft,
and Daniel Senie for useful discussions of this problem space.

10.  References

[1]  Townsley, W., Valencia, A., Rubens, A., Pall, G., Zorn, G., and
     Palter, B., "Layer Two Tunneling Protocol L2TP", RFC 2661, August
     1999.

[2]  Bradner, S., "Key words for use in RFCs to Indicate Requirement
     Levels", BCP 14, RFC 2119, March 1997.

[3]  Kent,S., Atkinson, R., "IP Authentication Header", RFC 2402,
     November 1998.

[4]  Kent,S., Atkinson, R., "IP Encapsulating Security Payload (ESP)",
     RFC 2406, November 1998.

[5]  Piper, D., "The Internet IP Security Domain of Interpretation of
     ISAKMP", RFC 2407, November 1998.

[6]  Atkinson, R., Kent, S., "Security Architecture for the Internet
     Protocol", RFC 2401, November 1998.

[7]  Harkins, D., Carrel, D., "The Internet Key Exchange (IKE)", RFC
     2409, November 1998.

11.  Authors' Addresses

Bernard Aboba
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052

Phone: 425-936-6605
EMail: bernarda@microsoft.com





Aboba                         Informational                     [Page 5]

INTERNET-DRAFT               NAT and IPSEC                   26 May 2000


12.  Intellectual Property Statement

The IETF takes no position regarding the validity or scope of any
intellectual property or other rights that might be claimed to pertain
to the implementation or use of the technology described in this
document or the extent to which any license under such rights might or
might not be available; neither does it represent that it has made any
effort to identify any such rights.  Information on the IETF's
procedures with respect to rights in standards-track and standards-
related documentation can be found in BCP-11.  Copies of claims of
rights made available for publication and any assurances of licenses to
be made available, or the result of an attempt made to obtain a general
license or permission for the use of such proprietary rights by
implementors or users of this specification can be obtained from the
IETF Secretariat.

The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary rights
which may cover technology that may be required to practice this
standard.  Please address the information to the IETF Executive
Director.


13.  Full Copyright Statement

Copyright (C) The Internet Society (2000).  All Rights Reserved.

This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it or
assist in its implementation may be prepared, copied, published and
distributed, in whole or in part, without restriction of any kind,
provided that the above copyright notice and this paragraph are included
on all such copies and derivative works.  However, this document itself
may not be modified in any way, such as by removing the copyright notice
or references to the Internet Society or other Internet organizations,
except as needed for the purpose of developing Internet standards in
which case the procedures for copyrights defined in the Internet
Standards process must be followed, or as required to translate it into
languages other than English.  The limited permissions granted above are
perpetual and will not be revoked by the Internet Society or its
successors or assigns.  This document and the information contained
herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE
INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE."





Aboba                         Informational                     [Page 6]

INTERNET-DRAFT               NAT and IPSEC                   26 May 2000


14.  Expiration Date

This memo is filed as <draft-aboba-ipsec-nat-00.txt>, and expires
January 1, 2001.















































Aboba                         Informational                     [Page 7]