<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

<?rfc toc="yes" ?>
<?rfc symrefs="no" ?>
<?rfc iprnotified="no" ?>
<?rfc strict="yes" ?>
<?rfc compact="yes" ?>
<?rfc sortrefs="no" ?>

<!-- 
TODO - update working group
-->

<!-- full2026 full3667 -->
<rfc  category="std" ipr="full3667" docName="draft-audet-natfwp2p-00" >
<front>
  <title abbrev= "NAT/FW P2P Requirements" > 
    NAT/Firewall Requirements for Peer-to-Peer Media</title>

  <author initials="F." surname="AUDET" fullname="Francois AUDET">
    <organization>Nortel Networks</organization>
    <address>
      <postal>
	<street> 4655 Great America Parkway</street>
	<city> Santa Clara</city>
	<region>CA</region>
	<code>95054</code>
	<country>USA</country>
      </postal>
      <phone>+1 408 495 3756</phone>
      <email>audets@nortelnetworks.com</email>
    </address>  
  </author> 
  
  <author initials="C." surname="Jennings" fullname="Cullen Jennings">
    <organization>Cisco Systems</organization>
    <address>
      <postal>
	<street>170 West Tasman Drive</street>
	<street>MS: SJC-21/2</street>
	<city>San Jose</city>
	<region>CA</region>
	<code>95134</code>
	<country>USA</country>
      </postal>
      <phone>+1 408 902-3341</phone>
      <email>fluffy@cisco.com</email>
    </address>  
  </author> 

  <date month="June" day="25" year="2004"/>
  <area>Transport</area>
  <workgroup>   </workgroup>
  <keyword>I-D</keyword>
  <keyword>Internet-Draft</keyword>
  <keyword>NAT</keyword>
  <keyword>SIP</keyword>
  <keyword>P2P</keyword>

  <abstract>
<t>
This document defines basic terminology for describing different types of
behavior for NATs and firewalls. It also defines a set of requirements for
supporting Peer-to-Peer (P2P) media in NATs and firewalls. NATs and firewalls
that meet this set of requirements are described as P2P capable and greatly
increase [CHECK] the likelihood that P2P application will function properly.
</t>
    </abstract>
</front>

<middle>

<section title= "Introduction" >
<t>
 
 Network Address Translators (NAT) and firewalls are well known to cause very
 significant problems with applications that carry IP addresses in the payload
 <xref target="RFC3027"/>. Applications that suffer from this problem include
 Voice Over IP and Multimedia Over IP (e.g., SIP <xref target="RFC3261"/> and
 H.323 <xref target="ITU.H323v3.1999"/>), as well as on-line gaming.</t>
<t>
 Many techniques are used to attempt to make peer-to-peer media applications
 work across NATs and firewalls. Application Level
 Gateways <xref target="RFC2663"/> are one such mechanism. <xref
 target="RFC3489">STUN</xref> describes a UNilateral Self-Address Translation
 (UNSAF) mechanism<xref target="RFC3424"/>. Media Relays have also been used to
 enable peer-to-peer media across NATs and firewalls, but it is generally seen
 as a solution of last resort. <xref target="I-D.ietf-mmusic-ice">ICE</xref>
 describes a methodology for using many of these techniques and avoiding a Media
 Relay unless the type of NAT/firewall is such that it forces the use of such a
 Media Relay.</t>
<t>
 This specification defines requirements for NATs and firewalls aimed at
 ensuring that a NAT or firewall that satisfies these requirements will avoid
 forcing the use of a Media Relay for supporting peer-to-peer media
 applications. "Peer-to-Peer (P2P) communication across middle boxes" <xref
 target="I-D.ford-natp2p"/> made several recommendations regarding NAT and
 firewalls for Peer-to-Peer media: this specification derives a lot of its
 requirements from that draft.</t>
<t>
  As pointed out in <xref target="RFC3424">UNSAF</xref>, "From observations of
  deployed networks, it is clear that different NAT boxes implementation vary
  widely in terms of how they handle different traffic and addressing cases."
  This wide degree of variability is one part of what contributes to the overall
  brittleness introduced by NATs and makes it extremely difficult to predict how
  any given protocol will behave on a network traversing NATs. Discussions with
  many of the major NAT vendors have made it clear that they would prefer to
  deploy NATs that were deterministic and caused the least harm to applications
  while still meeting the requirements that caused their customers to deploy
  NATs in the first place. The problem the NAT vendors face is they are not sure
  how best to do that or how to document how their NATs behave. The situation is
  not as problematic for firewalls but still exists: there is no good common
  terminology even to describe the behavior of firewalls. </t>
<t>
  The goal of this document is to define a set of common terminology for
  describing the behavior of NATs and firewalls, and produce a set of
  requirements on a specific set of behaviors for "P2P Enabled"
  NATs/firewalls. The requirements represent what many vendors are already
  doing, and it is not expected that it should be any more difficult to build a
  NAT that meets these requirements or that these requirements should affect
  performance. </t>
<t>
 The authors strongly believe that if there were a common set of requirements
 that were simple and useful for voice, video, and games, the bulk of the NAT
 vendors would choose to meet those requirements. This document will simplify
 the analysis of protocols for deciding whether or not they work in this
 environment and will allow providers of services that have NAT traversal issues
 to make statements about where their applications will work and where they will
 not, as well as to specify requirements for NATs.</t>
<t> 
This specification only covers Traditional NATs <xref
target="RFC3022"/>. Bi-directional, Twice NAT, and Multihomed NAT <xref
target="RFC2663"/> are outside the scope of this document. Approaches using
directly signaled control off the middle boxes such as midcom, UPNP or in-path
signaling are also out of scope. Media Relays are out of the scope of this
document as well.</t>
<t>
  This document only covers the UDP aspects of NAT/firewall traversal and does
  not cover TCP, ICMP, IPSEC, or other protocols.</t>
</section>
<section title= "Terminology" >
<t>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in this document are to be
interpreted as described in <xref target="RFC2119">RFC 2119</xref>.</t>
<t>
It is assumed that the reader is familiar with the terminology described in
<xref target="RFC2663">RFC 2663</xref> and <xref target="RFC3022">RFC
3022</xref>. This specification attempts to preserve the terminology used in
those RFCs.</t>
<t>
This document uses the term "session" as defined in <xref target="RFC2663">RFC
2663</xref>: "TCP/UDP sessions are uniquely identified by the tuple of (source
IP address, source TCP/UDP ports, target IP address, target TCP/UDP Port)."</t>
<t>
This document uses the term "address binding" as defined in <xref
target="RFC2663">RFC 2663</xref> and <xref target="RFC3022">RFC 3022</xref>:
"Address binding is the phase in which a local IP address is associated with an
external address, or vice versa, for purpose of translation."</t>
<t>
The term NAT is used to refer to both traditional address translation and
address port translation. The authors understand that there was a time when
these were considered different, but terminology has changed over time, and the
term NAT has subsumed port translation as part of it. </t>
<t>
<xref target="RFC3489">RFC 3489</xref> defines a terminology for different NAT
variations. In particular, it uses the terms "Full Cone", "Restricted Cone",
"Port Restricted Cone" and "Symmetric" to refer to different variations of
NATs/firewalls. Unfortunately, this terminology has been the source of much
confusion. This terminology does not distinguish between the NAT and the
firewalling behavior of NAT/firewall devices. It was found that many devices'
behaviors do not exactly fit into the described variations. For example, a
device could be symmetric from a firewall point of view and Cone from a NAT
point of view. Other aspects of NAT/firewall are not covered by this
terminology: for example, many NATs will switch over from basic NAT (preserving
ports) to NAPT (mapping ports) in order to preserve ports when possible.</t>
<t>
This specification will therefore not use the Cone/Symmetric
terminology. Furthermore, many other important behaviors are not fully described
by the Cone/Symmetric terminology.  This specification refers to specific
individual NAT/Firewall behaviors instead of using the Cone/Symmetric
terminology.</t>
<t>
Note: <xref target="RFC3489">RFC 3489</xref> defines a "Symmetric NAT" in
effectively two parts: </t>
<t>
<list style="numbers">
<t>
All requests from the same internal IP address and port to a specific
destination IP address and port are mapped to the same external IP address and
port. If the same host sends a packet with the same source address and port but
to a different destination, a different mapping is used.</t>
<t>
Furthermore, only the external host that receives a packet can send a UDP
packet back to the internal host.</t>
</list></t>
<t>
Condition 1 is the NAT behavior and condition 2 is the firewall
behavior. However, they are not necessarily dependent: we have observed NATs
that will conform to condition (1) but not to (2). Using RFC 3489, this type of
NAT would be detected as a "Cone NAT" since it uses condition (2). Using a
different algorithm such as the one described in <xref
target="NATCHECK">NATCECK</xref> which uses condition (1), it would be detected
as a "Symmetric NAT". If the endpoint receiving the media has a permissive
policy on accepting media, condition (2) is more appropriate, but if it has a
restrictive policy, condition (1) is more appropriate. </t>
</section>
<section title= "NAT Behavior" >
<t>
This section describes the various NAT behaviors applicable to dynamic NAT;
static NAT is outside the scope of this document.</t>
<section title= "Address and port binding" >
<t>
When an internal endpoint opens an outgoing UDP session through a NAT, the NAT
assigns the session an external IP address and port number so that subsequent
response packets from the external endpoint can be received by the NAT,
translated and forwarded to the internal endpoint. This is a binding between an
internal IP address and port (IP:port) and external IP:port tuple. It
establishes the translation that will be performed by the NAT for the duration
of the session. For peer-to-peer applications, it is important to distinguish
the behavior of the NAT when there are multiple simultaneous sessions
established to different external endpoints. </t>
<t>
The key behavior to describe is the criteria for re-use of a binding for new
sessions to external endpoints, after establishing a first binding between an
internal X:x address and port and an external Y1:y1 tuple. Let's assume that
internal IP address and port X:x is mapped to X1':x1' for this first
session. The endpoint then sends from X:x to an external address Y2:y2 and gets
a mapping X2':x2' on the NAT. The relationship between X1':x1' to X2':x2' for
various combinations of the relationship between Y1:y1 to Y2:y2 is critical to
describing the NAT behavior. This arrangement is illustrated in the following
diagram:</t>
<t>
<figure><artwork><![CDATA[
                                       E
    +------+                 +------+  x
    |  Y1  |                 |  Y2  |  t
    +--+---+                 +---+--+  e
       | Y1:y1            Y2:y2  |     r
       +----------+   +----------+     n
                  |   |                a
          X1':x1' |   | X2':x2'        l
               +--+---+-+
    ...........|   NAT  |...............
               +--+---+-+              I
                  |   |                n
              X:x |   | X:x            t
                 ++---++               e
                 |  X  |               r
                 +-----+               n
                                       a
                                       l
]]>
</artwork></figure></t>
<t>
The following address and port binding behavior are defined:</t>
<t><list style="hanging">
<t hangText= "External NAT binding is endpoint independent:">
The NAT re-uses the port binding for subsequent sessions initiated from the same
internal IP address and port (X:x) to any external IP address and
port. Specifically, X1':x1' equals X2':x2' for all values of Y2:y2. (From a RFC
3489 NAT perspective, this is a "Cone NAT" where the sub-type is really based on
the firewall behavior.)</t>
<t></t>
<t hangText= "External NAT binding is endpoint address dependent:" >
The NAT re-uses the port binding for subsequent sessions initiated from the same
internal IP address and port (X:x) only for sessions to the same external IP
address, regardless of the external port. Specifically, X1':x1' equals X2':x2'
if, and only if, Y2 equals Y1. (From an RFC 3489 NAT perspective, but not
necessarily a firewall perspective, this is a "Symmetric NAT".) </t>
<t></t>
<t hangText= "External NAT binding is endpoint address and port dependent:" >
The NAT re-uses the port binding for subsequent sessions initiated from the same
internal IP address and port (X:x) only for sessions to the same external and
port. Specifically, X1':x1' equals X2':x2' if, and only if, Y2:y2 equals
Y1:y1. (From an RFC 3489 NAT perspective, but not necessarily a firewall
perspective, this is a "Symmetric NAT".)</t>
</list></t>
<t>
The three possibilities are abbreviated as NB=I, NB=AD, and NB=APD,
respectively. NB stands for Nat Binding, I for independent, AD for Address
Dependent, and APD for Address Port Dependent.</t>
<t>
It is important to note that these three possible choices make no difference to
the security properties of the NAT. The security properties are fully determined
by which packets the NAT allows in and which it does not. This is determined by
the firewall behavior in the firewall portions of the NAT/FW. </t>
</section>
<section title= "Port assignment" >
<t>
Some NATs attempt to preserve the port number used internally when assigning a
binding to an external IP address and port (e.g., X:x to X':x). A basic NAT, for
example, will preserve the same port and will assign a different IP address from
a pool of external IP addresses in case of port collision (e.g. X1:x to X1':x
and X2:x to X2':x). This is only possible as long as the NAT has enough external
IP addresses. If the port x is already in use on all available external IP
addresses, then the NAT needs to switch from Basic NAT to a Network Address and
Port Translator (NAPT) mode. (i.e., X1:x to X':x and X2:x to X':x'). This is
referred-to as "port preservation". It does not guarantee that the external port
x' will always be the same as the internal port x but only that the NAT will
preserve the port if it is possible. </t>
<t>
A NAT that does not attempt to make the external port numbers match the internal
port numbers in any case (i.e., X1:x to X':x1', X2:x to X':x2') is referred-to
as "no port preservation". </t>
<t>
One of the benefits of port preservation is that tools such as network sniffers
that try to identify and parse traffic based on the port number keep
working. Another benefit is that it may enable P2P applications that are not
capable of using <xref target="RFC3424">UNSAF</xref> techniques.</t>
<t>
Some particularly nasty NATs use Port overloading: i.e., they always use port
preservation even in case of collision (i.e., X1:x to X':x, and X2:x to
X':x). These NATs rely on the source of the response from the external
endpoint (Y:y, Z:z) to forward a packet to the proper internal endpoint (X1 or
X2). Port overloading fails if the two internal endpoints are establishing
sessions to the same external destination. This is referred-to as "Port
overloaded".</t>
<t>
Most applications fail in some cases with "Port overloaded". It is clear that
"Port overloaded" behavior will result in many problems.</t>
<t>
Furthermore, RTP/RTCP <xref target="RFC3550"/> are typically used on UDP to
transport real-time media. The convention is that RTP streams use an even port
number, and the associated RTCP stream is supposed to use the following port
number. Most applications should not have any problems using an odd port for an
RTP stream or an even port for an RTCP stream: however, it is more prudent to
respect the convention. The sequencing convention of RTCP=RTP+1, however, is a
little more problematic. In theory, some protocols do allow indicating that the
normal rule does not apply so that the RTCP port may be explicitly specified. Since some protocols rely on "extensions" to the baseline
protocol to indicate the non-conformance to the convention, it is very likely
that a NAT will result in a failure to establish the RTCP stream.</t>
</section>
<section title= "NAT binding timeout" >
<t>
NAT UDP binding timeouts implementations vary but include the timer's value and
 the way the binding timer is refreshed to keep the binding alive. </t>
<t>
The binding timer is defined as the time a binding will stay active without
packets traversing the NAT. There is great variation in the values used by
different NATs.</t>
<t>
Some NATs keep the binding active (i.e., refresh the timer value) when a packet
goes from the internal side of the NAT to the external side of the NAT, but do
not take into account packets from the external side of the NAT to the internal
side of the NAT. This is referred-to as having a NAT refresh direction behavior
of "Outbound". </t>
<t>
Furthermore, if the binding is refreshed for all sessions on that bind by any
outbound traffic, the NAT is said to have a NAT refresh method behavior of "Per
binding". If the binding is refreshed only on a specific session on that
particular bind by any outbound traffic, the NAT is said to have a "Per
session".</t>
<t>
Other less secure NATs keep the binding active when packets go in any
direction. This is referred-to as a NAT refresh direction behavior of
"Bidirectional". The NAT refresh method behavior can also be "Per session" or
"Per bind".</t>
<t>
Yet other NATs keep the binding active when a packet goes from the external side
of the NAT to the internal side of the NAT, but do not take into account packets
from the internal side of the NAT to the external side of the NAT. This is
referred-to as a NAT refresh direction behavior of "Inbound". The NAT refresh
method behavior can be "Per session" or "Per bind".</t>
<t>
In a single combined NAT/FW device, in theory the NAT binding timeout behavior
could be independent from the firewall binding timeout behavior. In practice, it
is more likely that the NAT binding timeout and the firewall binding timeout
behavior will be one and the same. However, when the NAT and firewall are
deployed in two different devices that are serially chained, the behaviors may
be different.</t>
</section>
</section>
<section title= "Firewall Behavior (Filtering)" >
<t>
This section describes various firewall behaviors.
</t>
<section title= "Filtering of unsolicited packets" >
<t>
When an internal endpoint opens an outgoing UDP session through a firewall, the
firewall assigns a filtering rule for the binding between an internal IP:port
(X:x) and external IP:port (Y:y) tuple. </t>
<t>
The key behavior to describe is what criteria are used by the firewall to filter
packets originating from specific external endpoints. </t>
<t><list style= "hanging" >
<t hangText = "External filtering is open:" >
The firewall does not filter any packets.</t>
<t></t>
<t hangText = "External filtering is endpoint independent:" >
The firewall filters out only packets not destined to the internal address and port
X:x, regardless of the external IP address and port source (Z:z). The firewall
forwards any packets destined to X:x. In other words, sending packets from the
internal side of the firewall to any external IP address is sufficient to allow
any packets back to the internal endpoint.(From a RFC 3489 Firewall perspective,
this is a "Full Cone Firewall").</t>
<t></t>
<t hangText = "External filtering is endpoint address dependent:" >
The firewall filters out packets not destined to the internal address
X:x. Additionally, the firewall will filter out packets from Y:y destined to the
internal endpoint X:x if X:x has not sent packets to Y previously (independently
of the port used by Y). In other words, for receiving packets from a specific
external endpoint, it is necessary for the internal endpoint to send packets
first to that specific external endpoint's IP address.(From a RFC 3489 Firewall
perspective, this is a "Restricted Cone Firewall".) </t>
<t></t>
<t hangText = "External filtering is endpoint address and port dependent:" >
This is similar to the previous behavior, except that the external port is also
relevant.  The firewall filters out packets not destined to the internal address
X:x. Additionally, the firewall will filter out packets from Y:y destined to the
internal endpoint X:x if X:x has not sent packets to Y:y previously. In other
words, for receiving packets from a specific external endpoint, it is necessary
for the internal endpoint to send packets first to that external endpoint's IP
address and port. (From an RFC 3489 Firewall perspective, this is both a "Port
Restricted Cone Firewall" and a "Symmetric Firewall" as they have the same
Firewall behavior). </t>
</list></t>
<t>
These are abbreviated at EF=O, EF=I, EF=AD, EF=APD respectively. 
</t>
</section>
<section title= "Firewall binding timeout" >
<t>
See section on NAT. 
</t>
</section>
</section>
<section title= "Hairpinning Behavior" >
<t>
If two hosts (called X1 and X2) are behind the same NAT and exchanging traffic,
the NAT may allocate an address on the outside of the NAT for X2, called
X2':x2'. If X1 sends traffic to X2':x2', it goes to the NAT, which must relay
the traffic from X1 to X2. This is referred to as hairpinning and is illustrated
below. </t>
<t><figure><artwork>
<![CDATA[
                                   NAT
  +----+ from X1:x1 to X2':x2'   +-----+ X1':x1'
  | X1 |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>--+---
  +----+                         |  v  |
                                 |  v  |
                                 |  v  |
                                 |  v  |
  +----+ from X2':x2' to X1:x1   |  v  | X2':x2'
  | X2 |<<<<<<<<<<<<<<<<<<<<<<<<<<<<<--+---
  +----+                         +-----+
]]>
</artwork></figure></t>
<t>
Hairpinning allows two endpoints on the internal side of the NAT to communicate
even if they only use each other's external IP addresses and ports.</t>
<t>
More formally, A NAT/Firewall that supports hairpinning forwards packets
originating from an internal address, X1:x1, destined to an external address
X2':x2' that has an active binding to an internal address X2:x2, back to that
internal address X2:x2. (Note that typically, X1'=X2').</t>
<t>
Furthermore, the NAT may present the hairpinned packet with either an internal
or an external source IP address and port. The Hairpinning NAT behavior can
therefore be either "External source IP address and port" or "Internal source IP
address and port". "Internal source IP address and port" may cause problems by
confusing an implementation that is expecting an external IP address and
port.</t>

</section>
<section title= "Application Level Gateways" >
<t>
Application Level Gateways have been used to support specific protocols for
Peer-to-peer media through a NAT or Firewall. However, if an ALG is "on" on a
NAT, it could conflict with other techniques such as <xref
target="RFC3489">STUN</xref> or <xref
target="I-D.ietf-mmusic-ice">ICE</xref>.  </t>
</section>
<section title= "Deterministic Properties" >
<t>
The diagnosis is further complicated by the fact that under some conditions the
same NAT exhibits different behaviors. This has been seen on NATs that preserve
ports or have a specific algorithm for selecting a port other than selecting a
free one. If the external port that the NAT wishes to use is already in use by
another session, the NAT must select a different port. This results in different
code paths for this conflict case, which results in different behavior. </t>
<t>
For example if three hosts X1, X2, and X3 all sent from the same port x, through
a port preserving NAT with only one external IP address, called X1', the first
one to send (i.e., X1) will get an external port of x but the next two will get
x2' and x3' (where these are not equal to x). There are NATs where the External
Nat Binding characteristics and the External Filter characteristics change
between the X1:x and the X2:x binding. To make matters worse, there are NATs
where the behavior may be the same on the X1:x and X2:x binds but changes on the
third X3:x binding. </t>
<t>
Some NATs try to reuse external ports flow from two internal IP to two different
external IP. For example X1:x is going to Y1:y1 and X2:x is going to Y2:y2 where
Y1:y1 does not equal Y2:y2. Some NATs will map X1:x to X1':x and will also
map X2:x to X1':x. This works in the case where the NAT Binding is address
port dependant. However some NATs change their behavior when this type of port
reuse is happening. The NAT may look like is has NAT Bindings that are
Independent when this type of reuse is not happening but change to Address Port
Dependent when this reuse happens. </t>
<t>
Any NAT that changes the NAT Binding or the External Filtering at any point in
time or under any particular conditions is referred to as a "non-deterministic"
NAT. NATs that don't are called "deterministic".</t>
<t>
Non-deterministic NATs generally change behavior when a conflict of some sort
happens, when the port that would normally be used is already in use by another
bind. The NAT binding and External Filtering when there is no conflict is
referred to as the Primary behavior. The behavior after the first conflict is
referred to as Secondary and after the second conflict is referred to as
Tertiary. No NATs have been observed that change on further conflicts but
additional testing may be required. </t>
</section>
<section title= "Requirements" >
<t>
The requirements in this section are aimed at minimizing the damage caused by
NATs and Firewalls on Peer-to-peer media applications (e.g., forcing the use of
Media Relays, or failure to establish RTCP streams).</t>
<t>
However, it should be understood that Peer-to-peer media applications normally
do not know in advance if the NAT or Firewall conforms to the recommendations
defined in this section. Therefore, Peer-to-peer media applications still need
to use normal procedures such as <xref target="I-D.ietf-mmusic-ice">ICE</xref>
or <xref target="RFC3489">STUN</xref> to determine the course of action.</t>
<t><list>
<t>
REQ-1: A NAT MUST have an "External NAT Binding is endpoint independent"
behavior (NB=I).</t>
<t></t>
<t>
REQ-2: It is RECOMMENDED that a NAT have a "Port preservation" behavior. </t>
<t><list>
<t>
REQ-2a: A NAT MAY use a "No port preservation" behavior. </t>
<t>
REQ-2b: A NAT MUST NOT have a "Port overloaded" behavior.</t>
</list></t>
<t></t>
<t>
REQ-3: A dynamic NAT UDP binding timer MUST NOT expire in less than 2
minutes. </t>
<t><list>
<t>
REQ-3a: The value of the NAT UDP binding timer MAY be configurable.</t>
<t>
REQ-3b: A default value of 5 minutes for the NAT UDP binding timer of 5 minutes
is RECOMMENDED.</t>
</list></t>
<t></t>
<t>
REQ-4: The NAT UDP timeout binding MUST have a NAT refresh direction behavior of
"Outbound" (i.e. based on outbound traffic only)</t>
<t><list>
<t>REQ-4a: The NAT UDP timeout binding MUST have a NAT refresh method behavior
  of "Per binding". (i.e. refresh all sessions active on a particular bind).</t>
</list></t>
<t></t>
<t>
REQ-5: It is RECOMMENDED that a Firewall have an "External filtering is endpoint
address dependent" behavior. (EF=AD)</t>
<t><list>
<t>
REQ-5a: A Firewall MAY have an "External filtering is endpoint independent"
behavior. (EF=I)</t>
<t>
REQ-5b: A Firewall MAY have an "External filtering is endpoint address and port
dependent" behavior. (EF=APD)</t>
</list></t>
<t></t>
<t>
REQ-6: The Firewall UDP timeout binding behavior MUST be the same as the NAT UDP
timeout.</t>
<t></t>
<t>
REQ-7: A NAT/FW MUST support "Hairpinning" behavior.</t>
<t><list>
<t>
REQ-7a: A NAT/FW Hairpinning NAT behavior MUST be "External source IP address
and port".</t>
</list></t>
<t></t>
<t>
REQ-8: A NAT MUST have the capability to turn off individually all ALGs it
supports, except for DNS and IPsec.</t>
<t><list>
<t>
REQ-8a: Any NAT ALG for SIP MUST be turned off by default.</t>
</list></t>
<t></t>
<t>
REQ-9: In order to comply with the RTP even port and RTCP odd port rule, it is
RECOMMENDED that a NAT keep the same parity (even or odd) for the external UDP
port as the internal UDP port. </t>
<t><list>
<t>
REQ-9a: In order to comply with the RTCP=RTP+1 rule, it is RECOMMENDED that upon
binding an even external port to an even internal port, the following odd
external port be reserved on the same external IP address for a short period of
time (5 seconds is RECOMMENDED). If a packet is received within that period of
time from the same internal IP address as the one that caused the even port
binding, but from the following odd port, it is RECOMMENDED that the bind be
assigned the reserved external port. </t>
</list></t>
<t></t>
<t>
REQ-10: It is RECOMMENDED that a NAT/FW have a deterministic behavior.</t>
<t><list>
<t>
REQ-10a: If a NAT/FW is non-deterministic, all the different behaviors MUST meet
the above requirements. </t>
</list></t>
</list></t>

<section title= "Requirement Discussion" >
<t>
This section describes why each requirement was chosen, and the consequences of
violating them:</t>
<t><list>
<t>
REQ-1: In order for UNSAF methods to work, REQ-1 needs to be met. Failure to
meet REQ-1 will force the use of a Media Relay which is very often
impractical.  </t>
<t></t><t>
REQ-2: REQ-2 allows certain P2P applications that do not use UNSAF methods to
work, under many restrictions. However. this is no guarantee that it will work,
therefore it is just a recommendation</t>
<t></t><t>
REQ-2a: Since REQ-2 is no guarantee of success, REQ-2a is also acceptable. </t>
<t></t><t>
REQ-2b: REQ-2b must be met in order to enable 2 applications using the same
  port trying to communicate with the same destination.</t>
<t></t><t>
REQ-3: This requirement is to ensure that the timeout is long enough to avoid
too frequent timer refresh packets. </t>
<t></t><t>
REQ-3a: Configuration is desirable for adapting to specific networks and
troubleshooting.</t>
<t></t><t>
REQ-3b: This default is to avoid too frequent timer refresh packets.</t>
<t></t><t>
REQ-4: This requirement is a security concern: it is not secure to let inbound
traffic refresh the timer as an outside party could use it to keep a port open
on the NAT/Firewall.</t>
<t></t><t>
REQ-4a: Using the refresh on a per binding basis avoids the need for separate
keep-alives for all the available sessions.</t>
<t></t><t>
REQ-5: Filtering based on the IP address is felt to have the maximum balance
between security and usefulness. See below.</t>
<t></t><t>
REQ-5a: Filtering independently of the external IP address and port is not as
secure as unauthorized packets could get at a specific port while the port is
kept opened if it is lucky enough to discover that the port is opened. </t>
<t></t><t>
REQ-5b: In theory, filtering based on both the IP address and port is more
secure than filtering only based on IP address (because the external endpoint
could in reality be 2 endpoints behind another NAT, where one of the two
endpoint is an attacker. However, such a restrictive policy could interfere with
certain applications that use more than one port.</t>
<t></t><t>
REQ-6: This is to avoid overly complex applications.</t>
<t></t><t>
REQ-7: This requirement is to allow supporting P2P applications between 2
endpoints behind the same NAT/FW when they are trying each other's external IP
address.</t>
<t></t><t>
REQ-7a: Using the external IP address is necessary for P2P applications who have
a restrictive policy of not accepting packets from an IP address different from
what it expected. This requirement is for enabling more secure P2P
applications.</t>
<t></t><t>
REQ-8: NAT ALGs may interfere with UNSAF methods.</t>
<t></t><t>
REQ-8a: A SIP NAT ALG will interfere with UNSAF methods.</t>
<t></t><t>
REQ-9: Using the same parity as the convention for RTP/RTCP port may help some
implementations. It may also facilitate network diagnostics. </t>
<t></t><t>
REQ-9a: This requirement is to maximize the chances that the RTCP flow will not
be blocked.</t>
<t></t><t>
REQ-10: Non-deterministic NATs are very difficult to troubleshoot because they
require more intensive testing.</t>
<t></t><t>
REQ-10a: This requirement is to ensure that even if it is non-deterministic, a
NAT/FW doesn't break anything.</t>
</list></t>
</section>
</section>
<section title= "Security Considerations" >
<t>
Firewalls and NATs are often deployed to achieve some security goals. Most of
the recommendations and requirements in this document do not affect the security
properties of these devices, but a few of them do have security implications and
are discussed in this section. </t>
<t>
This work recommends that the timers for binding be refreshed only on outgoing
packets and that inbound packets should not update the timers. If inbound
packets update the timers, an external attacker can keep the binding alive
forever and attack future devices that may end up with the same internal
address. Some devices today do update the timers on inbound packets.  </t>
<t>
This work recommends that the firewall filters be specific only to the external
IP and not the external IP and port. It can be argued that this is less secure
than using [CHECK] the IP and port. Devices that wish to filter on IP and port are
still compliant with these requirements.  </t>
<t>
Non-deterministic NATs and firewalls are risky from a security point of
view. They are very difficult to test because they are, well,
non-deterministic. Testing by a person configuring one may result in the person
thinking it is behaving as desired, yet under different conditions that an
attacker can create, it may behave differently. These requirements recommend
that devices not be non-deterministic [CHECK THIS PARA, BE DETERMINISTIC?] . </t>
<t>
The work requires that NATs have an "external NAT binding is endpoint
independent" behavior. This does not reduce the security of devices. Which
packets are allowed to flow across the device is determined by the external
filtering behavior, which is independent of the binding behavior.  </t>
</section>
<section title= "IANA Considerations" >
<t>
 There are no IANA considerations.
</t>
</section>
<section title= "IAB Considerations " >
<t>
 The IAB has studied the problem of "Unilateral Self Address Fixing", which is
 the general process by which a client attempts to determine its address in
 another realm on the other side of a NAT through a collaborative protocol
 reflection mechanism <xref target="RFC3424"/>. </t>
<t>
  This specification does not constitute in itself an UNSAF application. It
  consist of a series of requirements for NATs and firewalls aimed at minimizing
  the negative impact that those devices have on peer-to-peer media
  applications, especially when those applications are using UNSAF methods.</t>
<t>
  Section 3 of UNSAF lists several practical issues with solutions to NAT
  problems. This document makes recommendations to reduce the uncertainty and
  problems introduced by these pratical issues with NATs. 
  In addition, <xref target="RFC3424">UNSAF</xref> lists five architectural
  considerations. Though this is not an UNSAF proposal, it is interesting to
  consider the impact of this work on these architectural considerations.</t>
<t><list>
<t>
 Arch-1: The scope of this is limited to UDP packets in NATs like the ones
 widely deployed today. The "fix" helps constrain the variability of NATs for
 true UNSAF solutions such as STUN. </t>
<t></t>
<t>
  Arch-2: This will exit at same rate that NATs exit. It does not imply any
  protocol machinery that would continue to live after NATs were gone or make it
  more difficult to remove them. </t>
<t></t>
<t>
  Arch-3: This does not reduce the overall brittleness of NAT but will hopefully
  reduce some of the more outrageous NAT behavior and make it easer to discuss
  and predict NAT behavior in given situations. </t>
<t></t>
<t>
  Arch-4: This work combined with the test 
  results <xref target="I-D.jennings-midcom-stun-results"/>
  of various NATs represents the
  most comprehensive work at IETF on what the real issues are with NATs for
  applications like VoIP. This work and STUN have pointed
  out more than anything else the brittleness NATs introduce and the difficulty
  of solving these issues.</t>
<t></t>
<t>
  Arch-5: This work and the test results <xref target="I-D.jennings-midcom-stun-results"/>
  provide a reference model to what any UNSAF proposal might
  encounter in deployed NATs. </t>
</list></t>
</section>

<section title= "Open Issues" >
<t>
Should we discuss requirements for dealing with fragmentation of UDP packets. </t>
</section>

<section title= "Acknowledgements" >
<t>
 The editor would like to acknowledge Bryan Ford, Pyda Srisuresh and Dan Kegel
 for the <xref target="I-D.ford-natp2p">NATP2P</xref> draft, from which a lot of
 the material in this specification is derived. Thanks to Rohan Mahy for many
 discussions on this. </t>
</section>

</middle>
<back>
<references title="Normative References">

<reference anchor='RFC2119'>
<front>
<title abbrev='RFC Key Words'>Key words for use in RFCs to Indicate Requirement
Levels</title>
<author initials='S.' surname='Bradner' fullname='Scott Bradner'>
<organization>Harvard University</organization>
<address>
<postal>
<street>1350 Mass. Ave.</street>
<street>Cambridge</street>
<street>MA 02138</street></postal>
<phone>- +1 617 495 3864</phone>
<email>sob@harvard.edu</email></address></author>
<date month='March' year='1997' />
<area>General</area>
<keyword>keyword</keyword>
</front>
<seriesInfo name='BCP' value='14' />
<seriesInfo name='RFC' value='2119' />
<format type='HTML' octets='14486' 
target='http://xml.resource.org/public/rfc/html/rfc2119.html' />
<format type='XML' octets='5661' 
target='http://xml.resource.org/public/rfc/xml/rfc2119.xml' />
</reference>

<!--
<t>
 [RFC3424] Daigle and IAB, "IAB Considerations for UNilateral Self-Address
 Fixing (UNSAF) Across Network Address Translation", RFC 3424, November 2002
</t>
-->
<reference anchor='RFC3424'>

<front>
<title>IAB Considerations for UNilateral Self-Address Fixing (UNSAF) Across
Network Address Translation</title>
<author initials='L.' surname='Daigle' fullname='L. Daigle'>
<organization /></author>
<author>
<organization>IAB</organization></author>
<date month='November' year='2002' /></front>

<seriesInfo name='RFC' value='3424' />
<format type='TXT' octets='18165' 
target='ftp://ftp.isi.edu/in-notes/rfc3424.txt' />
</reference>

</references>
<references title="Informational References">

<reference anchor='RFC2663'>

<front>
<title abbrev='NAT Terminology and Considerations'>IP Network Address Translator
(NAT) Terminology and Considerations</title>
<author initials='P.' surname='Srisuresh' fullname='Pyda Srisuresh'>
<organization>Lucent Technologies</organization>
<address>
<postal>
<street>4464 Willow Road</street>
<city>Pleasanton</city>
<region>CA</region>
<code>94588-8519</code>
<country>US</country></postal>
<phone>+1 925 737 2153</phone>
<email>srisuresh@lucent.com</email></address></author>
<author initials='M.' surname='Holdrege' fullname='Matt Holdrege'>
<organization>Lucent Technologiesv</organization>
<address>
<postal>
<street>1701 Harbor Bay Parkway</street>
<city>Alameda</city>
<region>CA</region>
<code>94502</code>
<country>US</country></postal>
<phone>+1 510 769 6001</phone>
<email>holdrege@lucent.com</email></address></author>
<date month='August' year='1999' />
<abstract>
<t>Network Address Translation is a method by which IP addresses are mapped from
one realm to another, in an attempt to provide transparent routing to
hosts. Traditionally, NAT devices are used to connect an isolated address realm
with private unregistered addresses to an external realm with globally unique
registered addresses. This document attempts to describe the operation of NAT
devices and the associated considerations in general, and to define the
terminology used to identify various flavors of NAT.</t></abstract></front>

<seriesInfo name='RFC' value='2663' />
</reference>

<!-- [RFC3022] Srisuresh and Egevand, "Traditional IP Network Address Translator
 (Traditional NAT)", RFC 3022, January 2001
-->
<reference anchor='RFC3022'>

<front>
<title>Traditional IP Network Address Translator (Traditional NAT)</title>
<author initials='P.' surname='Srisuresh' fullname='P. Srisuresh'>
<organization /></author>
<author initials='K.' surname='Egevang' fullname='K. Egevang'>
<organization /></author>
<date month='January' year='2001' /></front>

<seriesInfo name='RFC' value='3022' /> <format type='TXT' octets='37675'
target='ftp://ftp.isi.edu/in-notes/rfc3022.txt' />
</reference>


<!-- [RFC3027] Holdrege and Srisuresh, "Protocol Complications with the IP
 Network Address Translator", RFC 3027, January 2001
-->
<reference anchor='RFC3027'>

<front>
<title>Protocol Complications with the IP Network Address Translator</title>
<author initials='M.' surname='Holdrege' fullname='M. Holdrege'>
<organization /></author>
<author initials='P.' surname='Srisuresh' fullname='P. Srisuresh'>
<organization /></author>
<date month='January' year='2001' /></front>

<seriesInfo name='RFC' value='3027' /> <format type='TXT' octets='48662'
target='ftp://ftp.isi.edu/in-notes/rfc3027.txt' />
</reference>


<!-- [RFC3261] J. Rosenberg et al., "SIP: Session initiation protocol," RFC
 3261, June, 2002.
-->
<reference anchor='RFC3261'>

<front>
<title>SIP: Session Initiation Protocol</title>
<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
<organization /></author>
<author initials='H.' surname='Schulzrinne' fullname='H. Schulzrinne'>
<organization /></author>
<author initials='G.' surname='Camarillo' fullname='G. Camarillo'>
<organization /></author>
<author initials='A.' surname='Johnston' fullname='A. Johnston'>
<organization /></author>
<author initials='J.' surname='Peterson' fullname='J. Peterson'>
<organization /></author>
<author initials='R.' surname='Sparks' fullname='R. Sparks'>
<organization /></author>
<author initials='M.' surname='Handley' fullname='M. Handley'>
<organization /></author>
<author initials='E.' surname='Schooler' fullname='E. Schooler'>
<organization /></author>
<date month='June' year='2002' /></front>

<seriesInfo name='RFC' value='3261' /> <format type='TXT' octets='647976'
target='ftp://ftp.isi.edu/in-notes/rfc3261.txt' />
</reference>


<!-- [RFC3489] J. Rosenberg et al., "STUN - Simple Traversal of User Datagram
 Protocol (UDP) Through Network Address Translators (NATs)", RFC 3489, March
 2003
-->
<reference anchor='RFC3489'>

<front>
<title>STUN - Simple Traversal of User Datagram Protocol (UDP) Through Network
Address Translators (NATs)</title>
<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
<organization /></author>
<author initials='J.' surname='Weinberger' fullname='J. Weinberger'>
<organization /></author>
<author initials='C.' surname='Huitema' fullname='C. Huitema'>
<organization /></author>
<author initials='R.' surname='Mahy' fullname='R. Mahy'>
<organization /></author>
<date month='March' year='2003' /></front>

<seriesInfo name='RFC' value='3489' /> <format type='TXT' octets='117562'
target='ftp://ftp.isi.edu/in-notes/rfc3489.txt' />
</reference>


<!-- [RFC3550] Shulzrinne et al., "RTP: A Transport Protocol for Real-Time
 Applications", RFC 3550, July 2003
-->
<reference anchor='RFC3550'>

<front>
<title>RTP: A Transport Protocol for Real-Time Applications</title>
<author initials='H.' surname='Schulzrinne' fullname='H. Schulzrinne'>
<organization /></author>
<author initials='S.' surname='Casner' fullname='S. Casner'>
<organization /></author>
<author initials='R.' surname='Frederick' fullname='R. Frederick'>
<organization /></author>
<author initials='V.' surname='Jacobson' fullname='V. Jacobson'>
<organization /></author>
<date month='July' year='2003' /></front>

<seriesInfo name='RFC' value='3550' /> <format type='TXT' octets='259985'
target='ftp://ftp.isi.edu/in-notes/rfc3550.txt' /> <format type='PS'
octets='630740' target='ftp://ftp.isi.edu/in-notes/rfc3550.ps' /> <format
type='PDF' octets='504117' target='ftp://ftp.isi.edu/in-notes/rfc3550.pdf' />
</reference>


<!-- [ICE] J. Rosenberg, "Interactive Connectivity Establishment (ICE): A
 Methodology for Network Address Translator (NAT) Traversal for Multimedia
 Session Establishment Protocols", draft-ietf-mmusic-ice-01.txt, February 2004
-->
<reference anchor='I-D.ietf-mmusic-ice'>
<front>
<title>Interactive Connectivity Establishment (ICE): A Methodology for Network
Address Translator (NAT) Traversal for the Session Initiation Protocol
(SIP)</title>

<author initials='J' surname='Rosenberg' fullname='Jonathan Rosenberg'>
    <organization />
</author>

<date month='February' year='2004' />
</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-mmusic-ice-00' /> <format
type='TXT'
target='http://www.ietf.org/internet-drafts/draft-ietf-mmusic-ice-01.txt' />
</reference>


<!-- [P2P] Ford, Srisuresh, and Kegel, "Peer-to-Peer (P2P) communication across
 middleboxes", October 2003
-->
<reference anchor='I-D.ford-natp2p'>
<front>
<title>Network Address Translation and Peer-to-Peer Applications (NATP2P)</title>

<author initials='B' surname='Ford' fullname='Bryan  Ford'>
    <organization />
</author>

<date month='April' day='8' year='2003' />
</front>

<seriesInfo name='Internet-Draft' value='draft-ford-natp2p-00' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ford-natp2p-00.txt' />
</reference>


<!-- [H.323] ITU-T Recommendation H.323, "Packet Based Multimedia Communication
 Systems", July 2003
-->
<reference anchor="ITU.H323v3.1999">
<front>
<title>Packet-based Multimedia Communications Systems (includes Annex C - H.323
on ATM)</title>
<author>
<organization></organization>
</author>
<date month="September" year="1999" />
</front>

<seriesInfo name="ITU-T" value="Recommendation H.323v3" />

</reference>


<!-- 
 [NATCHECK] Nat Check Web site, http://midcom-p2p.sourceforge.net/
-->
<reference anchor='NATCHECK'>
<front>
<title>Nat Check Web Site: http://midcom-p2p.sourceforge.net</title>
<author initials='B' surname='Ford' fullname='Bryan  Ford'>
    <organization />
</author>
<author initials='D' surname='Andersen' fullname='Dave Andersen'>
    <organization />
</author>
<date  month="June" year="2004"/>
</front>
<format type='TXT'
        target='http://midcom-p2p.sourceforge.net' />
</reference>


<reference anchor='I-D.jennings-midcom-stun-results'>
<front>
<title>NAT Classification Results using STUN</title>

<author initials='C' surname='Jennings' fullname='Cullen Jennings'>
    <organization />
</author>

<date month='February' day='9' year='2004' />
</front>

<seriesInfo name='Internet-Draft' value='draft-jennings-midcom-stun-results-00'
/> <format type='TXT'
target='http://www.ietf.org/internet-drafts/draft-jennings-midcom-stun-results-00.txt'
/>
</reference>

</references>
</back>
</rfc>



