<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.26 (Ruby 3.3.6) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-mclarty-nat-sub-address-protocol-00" category="info" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.28.0 -->
  <front>
    <title abbrev="NATSAP">NAT Sub Address Protocol</title>
    <seriesInfo name="Internet-Draft" value="draft-mclarty-nat-sub-address-protocol-00"/>
    <author fullname="Daniel McLarty">
      <organization>Independent</organization>
      <address>
        <email>daniel@mclarty.tech</email>
      </address>
    </author>
    <date year="2025" month="April" day="02"/>
    <area/>
    <workgroup>INTAREA</workgroup>
    <keyword>NATSAP</keyword>
    <keyword>DSAAP</keyword>
    <keyword>NATSAP Sub-Address</keyword>
    <keyword>CG NAT</keyword>
    <abstract>
      <?line 38?>

<t>This document defines the NAT Sub-Address Protocol (NATSAP), a Layer 5 encapsulation protocol designed to facilitate seamless bidirectional communication with devices behind Carrier-Grade NAT (CG NAT). NATSAP introduces dynamic sub-addresses assigned by the NAT router, which external clients can use alongside the public IP to route traffic back to internal devices without requiring traditional port forwarding. This document also defines the Dynamic Sub-Address Assignment Protocol (DSAAP), to facilitate the acquiring of a NATSAP Sub-Address.</t>
      <t>The protocol offers backward compatibility with existing IPv4 infrastructure, efficient DNS-based service discovery, and simple, stateless mapping. By encapsulating application-layer traffic, NATSAP enables direct communication with devices behind NATs using a standardized socket notation and DNS records.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://Daniel-McLarty.github.io/NAT-Sub-Address-Protocol/draft-mclarty-nat-sub-address-protocol.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-mclarty-nat-sub-address-protocol/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        INTAREA Working Group mailing list (<eref target="mailto:int-area@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/int-area/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/int-area/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/Daniel-McLarty/NAT-Sub-Address-Protocol"/>.</t>
    </note>
  </front>
  <middle>
    <?line 45?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>The proliferation of Carrier-Grade NAT (CG NAT) in IPv4 networks has made it increasingly difficult for devices behind NATs to host services. Traditional NAT traversal techniques, such as port forwarding, STUN, TURN, and UPnP, are cumbersome, inconsistent, and difficult to automate.</t>
      <t>NATSAP addresses this issue by introducing:</t>
      <ul spacing="normal">
        <li>
          <t>Dynamic sub-addresses, automatically assigned by the NAT router using DSAAP.</t>
        </li>
        <li>
          <t>Encapsulation at Layer 5, allowing transparent traversal of NAT devices.</t>
        </li>
        <li>
          <t>DNS integration for seamless service discovery.</t>
        </li>
        <li>
          <t>Backward compatibility with existing network infrastructure.</t>
        </li>
      </ul>
    </section>
    <section anchor="conventions-and-definitions">
      <name>Conventions and Definitions</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>
      <?line -18?>

<ul spacing="normal">
        <li>
          <t><strong>NATSAP</strong>: NAT Sub-Address Protocol</t>
        </li>
        <li>
          <t><strong>DSAAP</strong>: Dynamic Sub-Address Assignment Protocol</t>
        </li>
        <li>
          <t><strong>CG NAT</strong>: Carrier-Grade Network Address Translation</t>
        </li>
        <li>
          <t><strong>Sub-Address</strong>: A unique 32-bit identifier assigned by the NAT router to an internal device.</t>
        </li>
        <li>
          <t><strong>NATSAP Table</strong>: A mapping table in the NAT router that associates sub-addresses with internal IPs.</t>
        </li>
      </ul>
    </section>
    <section anchor="protocol-overview">
      <name>Protocol Overview</name>
      <section anchor="protocol-flow">
        <name>Protocol Flow</name>
        <ol spacing="normal" type="1"><li>
            <t>Client Initialization (DSAAP)
            </t>
            <ul spacing="normal">
              <li>
                <t>When a device connects to the CG NAT network, it sends a DSAAP request to the gateway router.</t>
              </li>
              <li>
                <t>The NAT router responds with a DSAAP reply, assigning a 32-bit sub-address to the client.</t>
              </li>
              <li>
                <t>The client stores the sub-address and uses it for external communication.</t>
              </li>
            </ul>
          </li>
          <li>
            <t>Service Advertising (DNS)
            </t>
            <ul spacing="normal">
              <li>
                <t>The client updates the NATSAP TXT record in DNS with its current sub-address.</t>
              </li>
              <li>
                <t>Example DNS record:</t>
              </li>
            </ul>
          </li>
        </ol>
        <t><tt>
A: example.com → 192.0.2.20
TXT: _natsap.example.com → "example.com, ABCD-1234"
</tt></t>
        <ol spacing="normal" type="1"><li>
            <t>Third-Party Client Connection
            </t>
            <ul spacing="normal">
              <li>
                <t>The external client resolves the public IP via the A record.</t>
              </li>
              <li>
                <t>It looks up the _natsap TXT record for the sub-address.</t>
              </li>
              <li>
                <t>It forms the NATSAP socket: <tt>natsap://192.0.2.20[ABCD-1234]:443</tt></t>
              </li>
            </ul>
          </li>
          <li>
            <t>NATSAP Encapsulation
            </t>
            <ul spacing="normal">
              <li>
                <t>The external client encapsulates its application-layer traffic inside a NATSAP packet.</t>
              </li>
              <li>
                <t>The CG NAT router receives the packet, extracts the sub-address, and performs a table lookup to route the traffic to the appropriate internal device.</t>
              </li>
              <li>
                <t>The router forwards the traffic to the internal client.</t>
              </li>
              <li>
                <t>The internal client de-encapsulates the NATSAP packet and treats the application-layer traffic like normal.</t>
              </li>
              <li>
                <t>The internal client then sends a standard reply to the external client.</t>
              </li>
              <li>
                <t>If the external client has to send new traffic to the internal client the external client will build a new NATSAP packet.</t>
              </li>
            </ul>
          </li>
        </ol>
      </section>
    </section>
    <section anchor="natsap-header-format">
      <name>NATSAP Header Format</name>
      <table>
        <thead>
          <tr>
            <th align="center">Field Name</th>
            <th align="left">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="center">Version (8 bits)</td>
            <td align="left">NATSAP protocol version (e.g., 0x01).</td>
          </tr>
          <tr>
            <td align="center">Flags (8 bits)</td>
            <td align="left">Reserved for future use.</td>
          </tr>
          <tr>
            <td align="center">Destination Sub-Address (32 bits)</td>
            <td align="left">The Sub-Address of the server.</td>
          </tr>
          <tr>
            <td align="center">Encapsulated Data Length (16 bits)</td>
            <td align="left">Length of the encapsulated payload in bytes.</td>
          </tr>
          <tr>
            <td align="center">Encapsulated Data (variable)</td>
            <td align="left">The original datagram traffic (e.g., https)</td>
          </tr>
        </tbody>
      </table>
    </section>
    <section anchor="dns-integration">
      <name>DNS Integration</name>
      <t>NATSAP uses DNS TXT records for service discovery.</t>
      <section anchor="dns-record-format">
        <name>DNS Record Format</name>
        <ul spacing="normal">
          <li>
            <t>A record: The public IP of the CG NAT router.</t>
          </li>
          <li>
            <t>TXT record:
            </t>
            <ul spacing="normal">
              <li>
                <t>Name: _natsap.FQDN</t>
              </li>
              <li>
                <t>Value: "FQDN, sub-address"</t>
              </li>
            </ul>
          </li>
        </ul>
      </section>
      <section anchor="example-dns-records">
        <name>Example DNS Records</name>
        <t><tt>
A: example.com → 192.0.2.20
TXT: _natsap.example.com → "example.com, ABCD-1234"
</tt>
Clients use the A record to find the public IP and the TXT record to retrieve the sub-address.</t>
      </section>
    </section>
    <section anchor="socket-addressing-scheme">
      <name>Socket Addressing Scheme</name>
      <t>NATSAP defines a new URI format for addressing services:</t>
      <t><tt>natsap://&lt;public-ip&gt;[&lt;sub-address&gt;]:&lt;original-port&gt;</tt></t>
      <t>Example URI: <tt>natsap://192.0.2.20[ABCD-1234]:443</tt></t>
    </section>
    <section anchor="dynamic-sub-address-assignment-protocol-dsaap">
      <name>Dynamic Sub-Address Assignment Protocol (DSAAP)</name>
      <t>TODO DSAAP</t>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <section anchor="sub-address-privacy">
        <name>Sub-Address Privacy</name>
        <ul spacing="normal">
          <li>
            <t>Sub-addresses are public, similar to ports.</t>
          </li>
          <li>
            <t>Applications should use existing encryption protocols (e.g., TLS) for security.</t>
          </li>
        </ul>
      </section>
    </section>
    <section anchor="backward-compatibility">
      <name>Backward Compatibility</name>
      <t>NATSAP is backward-compatible with existing IPv4 infrastructure:</t>
      <ul spacing="normal">
        <li>
          <t>No modifications to Layer 3 or Layer 4 protocols are required.</t>
        </li>
        <li>
          <t>Non-NATSAP routers will simply drop unrecognized NATSAP packets.</t>
        </li>
        <li>
          <t>Services using traditional ports remain unaffected.</t>
        </li>
      </ul>
      <section anchor="rate-limiting">
        <name>Rate Limiting</name>
        <ul spacing="normal">
          <li>
            <t>The CG NAT router should rate-limit DSAAP requests to prevent abuse.</t>
          </li>
        </ul>
      </section>
      <section anchor="expiration-and-reuse">
        <name>Expiration and Reuse</name>
        <ul spacing="normal">
          <li>
            <t>Sub-addresses should have a lease time to prevent stale mappings.</t>
          </li>
          <li>
            <t>Routers should implement keep-alive mechanisms to verify active clients.</t>
          </li>
        </ul>
      </section>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>IANA may need to register both a TCP and UDP port to NATSAP.
IANA may need to register a UDP port to DSAAP.</t>
    </section>
  </middle>
  <back>
    <references anchor="sec-normative-references">
      <name>Normative References</name>
      <reference anchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner"/>
          <date month="March" year="1997"/>
          <abstract>
            <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba"/>
          <date month="May" year="2017"/>
          <abstract>
            <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
    </references>
    <?line 187?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA7VZ23LbuBm+51Ogyo3tEeVj26wmza4i24lnHNkrybvdyWS6
EAlJGFMEFyClaOPc9gH6BH2WPkqfpN8PgCIp2Yn3orpISBD/+fw7DMMgl3ki
umzQG7NRMWG9ONbCGHarVa4ilQR8MtFiaS+MerdBxHMxU3rdZTKdqiCIVZTy
BRDEmk/zcBElXOfrMOV5aIpJyB26MPPowqOjAOcLaYxUab7OAHl1Mb5k7AXj
iVFd1pJpLDKBf9K81WYtEctcackTernqvcF/SuNpOL5sBWmxmAjdDWJw1Q0i
lRqRmsJ0Wa4LEYDr04BrwYG1FayUvp9pVWR4uxqMe8OLXiu4F2ucx92AhaWE
eDof9dyDOyLFhF4xdNp/Sx+CpUgLUGVsBytjTrLWz6Ap0xl7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