<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc0791 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.0791.xml'>
<!ENTITY rfc2119 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
<!ENTITY rfc2460 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2460.xml'>
<!ENTITY rfc3022 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.3022.xml'>
<!ENTITY rfc3514 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.3514.xml'>
]>
<rfc category="std" ipr="trust200902" docName="draft-bellis-behave-natpresent-00" updates="791"
    obsoletes="3514">
    <?rfc toc='yes' ?>
    <?rfc tocompact='no' ?>
    <?rfc compact='yes' ?>
    <?rfc subcompact='yes' ?>
    <?rfc sortrefs='yes' ?>
    <?rfc symrefs='yes' ?>
    <front>
        <title abbrev="NAT Signalling">Signalling the Presence of NAT</title>
        <author initials="R.P." surname="Bellis" fullname="Ray Bellis">
            <organization>Nominet UK</organization>
            <address>
            <postal>
                <street>Edmund Halley Road</street>
                <city>Oxford</city>
                <code>OX4 4DQ</code>
                <country>United Kingdom</country>
            </postal>
            <phone>+44 1865 332211</phone>
            <email>ray.bellis@nominet.org.uk</email>
            <uri>http://www.nominet.org.uk/</uri>
        </address>
        </author>

        <author initials="G.I." surname="Huston" fullname="Geoff Huston">
            <organization abbrev="APNIC">Asia Pacific Network Information Centre</organization>
            <address>            
                <email>gih@apnic.net</email>
                <uri>http://www.apnic.net/</uri>
            </address>
        </author>

        <date year="2011"/>
        <area>Internet Area</area>
        <workgroup/>
        <keyword/>

        <abstract>

            <t> End-to-end applications have difficulty distinguishing between packets that have
                been passed through a Network Address Translator (NAT) and packets that have been
                passed along a clear end-to-end path. We propose mechanisms for IPv4 and IPv6
                whereby NAT devices explicitly signal their operation as a means of allowing
                applications to distinguish the presence of otherwise undetected NATs in the
                end-to-end path.</t>

        </abstract>
    </front>

    <middle>
        <section title="Introduction" anchor="intro">
            <t> End-to-end applications have difficulty distinguishing between packets that have
                been passed through a Network Address Translator (NAT) <xref target="RFC3022"/> and
                packets that have been passed along a clear end-to-end path.</t>

            <t> The problem identified here is that detecting the presence of NATs in the path can
                be challenging for an application. The UPnP Forum has defined the <xref
                    target="IGDP">Internet Gateway Device (IGD) V2.0 protocol</xref> as a means of
                detecting the presence of a local NAT, and as a means of directing the NAT to
                perform certain actions regarding the NAT binding behaviour between internal
                addresses and ports and external addresses and ports. However, this approach fails
                if the NAT is not local, or if there are one or more remote NATs in the end-to-end
                path in addition to a local NAT.</t>

            <t> For example, an application may believe that IGD has successfully detected the NAT,
                and the application can use the IGD protocol to learn the external IP address that
                is used by the NAT for this application's communications, to direct the NAT to
                perform certain port mappings and to assign a lease time to a NAT binding, but the
                presence of a Carrier Grade NAT (CGN) further along the network path is then
                undetectable by the application using the IGD protocol, and the application behaves
                unpredictably.</t>

            <t> We note the directive in <xref target="RFC3514"/> concerning the setting of a bit
                flag in the <xref target="RFC0791">IPv4</xref> packet header by NATs, and we
                redefine here the use of this bit flag as a means of distinguishing the presence of
                an otherwise undetected NAT in the end-to-end path.</t>

            <t> We also define an <xref target="RFC2460">IPv6</xref> hop-by-hop option with similar
                semantics.</t>

            <t> To allow a distinction to be drawn between NATs that are detected by IGD-capable
                applications and all other otherwise IGD-undetected NATs in the path, we propose
                here (but do not specify) an extension to the IGD protocol to allow IGD to direct
                the NAT not to apply the mechanisms herein on a per-binding basis, in the same
                manner as IGD already allows for control of the binding time in the NAT. </t>

        </section>

        <section anchor="terminology" title="Terminology used in this document">
            <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"/>. </t>
        </section>

        <section title="Specification" anchor="specification">

            <section title="IPv4" anchor="ipv4">

                <section title="Definition" anchor="def6">
                    <t> For IPv4 packets all NATs MUST set the NAT Present bit ("E", below) in the
                        header of all IPv4 packets that have had their address and/or port fields
                        altered by the NAT.</t>
                </section>

                <section title="Syntax" anchor="syntax4">
                    <t> The high-order bit of the <xref target="RFC0791">IPv4</xref> fragment offset
                        field has been defined for use by NATs in <xref target="RFC3514"/>.</t>

                    <t>The bit field is laid out as follows: <figure>
                            <artwork>
                                <![CDATA[
       0
      +-+
      |E|
      +-+
                ]]>
                            </artwork>
                        </figure>
                    </t>

                    <t>In the context of detection of NATs, the currently-assigned values for this
                        bit are defined as follows:</t>

                    <t>
                        <list style="hanging" hangIndent="5">
                            <t hangText="0x0">If the bit is set to 0, the packet has not traversed a
                                NAT, or the NAT has been directed not to set the bit in a manner
                                supported by an IGD interaction.</t>
                            <t/>
                            <t hangText="0x1">If the bit is set to 1, the packet has been altered by
                                one or more NAT devices along the path.</t>
                        </list>
                    </t>

                </section>

            </section>

            <section title="IPv6" anchor="ipv6">

                <section title="Definition" anchor="def4">

                    <t> For <xref target="RFC2460">IPv6</xref> the presence of a NAT is conveyed in
                        a hop-by-hop NAT Present option containing an 8 bit counter.</t>

                    <t> All IPv6 NATs MUST increment this counter value in the NAT Present option in
                        all packets that have had their address and/or port fields altered by the
                        NAT. If this option is not present in the packet, the NAT MUST add the
                        option to the packet header with an initial value of 1.</t>

                </section>

                <section title="Syntax" anchor="syntax6">

                    <t>The option is laid out as follows: <figure>
                            <artwork>
                                <![CDATA[
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |  Type = TBC1  |   LEN = 0x01  |    VALUE      |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                ]]>
                            </artwork>
                        </figure>
                    </t>

                    <t> Note that the two highest order bits of the tag are both clear, indicating
                        that the option should be skipped if it is not recognised, and that the
                        third highest-order bit is set, indicating that the option's value may
                        change en-route.</t>

                </section>

            </section>

            <section title="Protocol Translation" anchor="translation">

                <t> All protocol-translating NATs MUST apply the relevant NAT Present bit or option
                    on outbound packets.</t>

            </section>
        </section>

        <section title="Application Processing">

            <t> Applications that receive a packet with a non-zero NAT Present option MUST assume
                that the IP header's source and destination address, the transport level source and
                destination ports and even the IP version value may have been altered by a NAT in
                the end-to-end path.</t>

            <t> We anticipate (but do not define) that applications will access the NAT Present
                value using the UNIX "getsockopt()" system call or its equivalent in other operating
                systems.</t>

            <t> An application MAY use extensions to the IGD protocol to direct a NAT NOT to add the
                NAT Present option as part of the IGD-managed settings on individual NAT bindings.</t>

            <t> If the IPv4 bit or IPv6 option is already present in a packet and its value is
                non-zero, the IGD protocol extension MUST be ignored. Hence for IPv4 the bit must
                remain set, and for IPv6 for value must be incremented, as specified above.</t>

        </section>

        <section title="Related Work">

            <t> RFC 3514 defines other forms of semantic intent that would set this bit field in the
                IPv4 header. We are comfortable that these additional semantics are entirely
                consistent with this IPv4 NAT Present bit.</t>

        </section>

        <section title="Security Considerations" anchor="security">

            <t> TBD </t>

        </section>

        <section title="IANA Considerations" anchor="iana">

            <t> This document requests registration of the value TBC1 in the IANA Hop-by-Hop Option
                Type registry, with required 'act' value of '00' and 'chg' value of '1'.</t>

        </section>

        <section title="Acknowledgements">

            <t> The author wishes to thank the following for their feedback and reviews during the
                development of this idea: Steven M. Bellovin, Adrian Kennard.</t>

        </section>

    </middle>

    <back>
        <references title="Normative References"> &rfc0791; &rfc2119; &rfc2460;
            &rfc3022; &rfc3514; <reference anchor="IGDP"
                target="http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v2-Device.pdf">
                <front>
                    <title>InternetGatewayDevice:2 specification</title>
                    <author>
                        <organization>UPnp Forum</organization>
                    </author>
                    <date day="10" month="12" year="2010"/>
                </front>
            </reference>
        </references>

        <!-- <references title="Informative References">
	</references> -->

        <section title="Change Log" anchor="changelog">

            <t>NB: to be removed by the RFC Editor before publication.</t>

            <t>draft-bellis-behave-natpresent-00<list>
                    <t>Initial draft</t>
                </list>
            </t>
        </section>

    </back>
</rfc>

