home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_n_r / draft-rfced-info-srisuresh-01.txt < prev    next >
Text File  |  1997-06-12  |  38KB  |  893 lines

  1.  
  2. Network Working Group                                       P. Srisuresh
  3. INTERNET-DRAFT                                          3Com Corporation
  4. Obsoletes: RFC 1631                                           K. Egevang
  5. Category: Informational                                Intel Corporation
  6. Expire in six months                                           June 1997
  7.  
  8.  
  9.                 The IP Network Address Translator (NAT)
  10.  
  11. Status of this Memo
  12.  
  13.    This document is an Internet-Draft.  Internet-Drafts are
  14.    working documents of the Internet Engineering Task Force
  15.    (IETF), its areas, and its working groups. Note that other
  16.    groups may also distribute working documents as Internet-
  17.    Drafts.
  18.  
  19.    Internet-Drafts are draft documents valid for a maximum of six
  20.    months. Internet-Drafts may be updated, replaced, or obsoleted
  21.    by other documents at any time.  It is not appropriate to use
  22.    Internet-Drafts as reference material or to cite them other
  23.    than as a "working draft" or "work in progress".
  24.  
  25.    To learn the current status of any Internet-Draft, please
  26.    check the 1id-abstracts.txt listing contained in the
  27.    Internet-Drafts Shadow Directories on ds.internic.net (US East
  28.    Coast), nic.nordu.net (Europe), ftp.isi.edu (US West Coast),
  29.    or munnari.oz.au (Pacific Rim).
  30.  
  31. Preface
  32.  
  33.    This document extends address translation introduced in RFC 1631 
  34.    to incorporate TCP/UDP port translation.  In addition, this 
  35.    document corrects the Checksum adjustment algorithm published in 
  36.    RFC 1631 and attempts to discuss NAT operation and limitations
  37.    in detail.
  38.  
  39. Abstract
  40.  
  41.    Basic Network Address Translation or Basic NAT is a feature by 
  42.    which IP addresses are mapped from one group to another, transparent 
  43.    to users. Network Address Port Translation, or NAPT is an extension 
  44.    to Basic NAT, in that many network addresses and their TCP/UDP ports 
  45.    are translated to a single network address and its TCP/UDP ports.
  46.  
  47.  
  48.  
  49.  
  50.  
  51. Srisuresh & Egevang                                             [Page 1]
  52.  
  53. Internet Draft         Network Address Translator              June 1997
  54.  
  55.  
  56. 1. Introduction
  57.  
  58.    The need for IP Address translation arises when a network's internal 
  59.    IP addresses cannot be used outside the network either for security 
  60.    reasons or because they are invalid for use outside the network. 
  61.  
  62.    Network topology outside a local domain can change in many ways. 
  63.    Customers may change providers, company backbones may be 
  64.    reorganized, or providers may merge or split.  Whenever external 
  65.    topology changes with time, address assignment for nodes within the
  66.    local domain must also change to reflect the external changes.
  67.    Changes of this type can be hidden from the users within the domain
  68.    by centralizing changes to a single address translation router.
  69.  
  70.    Basic Address translation feature would allow local hosts on a 
  71.    private network to transparently access the external global network 
  72.    and enable access to  selective local hosts from the outside. 
  73.    Organizations with a network setup predominantly for internal use, 
  74.    with a need for occasional external access are good candidates for 
  75.    this feature.
  76.  
  77.    Many Small Office, Home Office (SOHO) users and telecommuting 
  78.    employees have multiple Network nodes in their office, running 
  79.    TCP/UDP applications, but have a single IP address assigned to 
  80.    their remote access router by their service provider to access 
  81.    remote networks. This ever increasing community of remote access 
  82.    users would be benefited by NAPT, which would permit multiple 
  83.    nodes in a local network to simultaneously access remote networks 
  84.    using the single IP address assigned to their router. 
  85.  
  86.    There are limitations to using the translation feature. Address 
  87.    translation must be enabled only on border routers to a stub domain, 
  88.    where all IP packets are either originated from the domain or 
  89.    destined to the domain.  Address translation requires translation of 
  90.    not only the IP headers but also some application specific headers 
  91.    and data, which make reference to IP addresses.  FTP is one such 
  92.    application. Encoded FTP sessions and any encoded sessions in 
  93.    general that might include IP addresses in the encoding will not 
  94.    be supported by NAT.
  95.  
  96.    This solution has the disadvantage of taking away the end-to-end
  97.    significance of an IP address, and making up for it with increased
  98.    state in the network. The huge advantage of this approach is that it 
  99.    can be installed without changes to either hosts or routers. (A few 
  100.    unusual applications may require changes). 
  101.  
  102. 2. Terminology and concepts used
  103.  
  104.  
  105.  
  106.  
  107. Srisuresh & Egevang                                             [Page 2]
  108.  
  109. Internet Draft         Network Address Translator              June 1997
  110.  
  111.  
  112. 2.1. Session flow vs. Packet flow
  113.  
  114.    Connection or session flows are different from packet flows. 
  115.    A session flow  indicates the direction in which the session was 
  116.    initiated with reference to a network port. Packet flow is the 
  117.    direction in which the packet has traveled with reference to a 
  118.    network port.
  119.  
  120.    Take for example, an outbound telnet session. The telnet session 
  121.    consists of packet flows in both inbound and outbound directions. 
  122.    Outbound telnet packets carry terminal keystrokes and inbound 
  123.    telnet packets carry screen displays from the telnet server.
  124.  
  125.    Performing address or TCP port translation for a telnet session 
  126.    would involve translation of incoming as well as outgoing packets 
  127.    belonging to that session.
  128.  
  129.    Packets belonging to a TCP/UDP  session are uniquely identified 
  130.    by the tuple of (source IP address, source TU port, target IP 
  131.    address, target TU port). Packets belonging to all other sessions 
  132.    are characterized simply by the tuple of (source IP address, target 
  133.    IP address, IP protocol). A session is uniquely identified by the 
  134.    first packet of that session.
  135.  
  136. 2.2. TU ports, Server ports, Client ports
  137.  
  138.    For the reminder of this document, we will refer TCP/UDP ports 
  139.    associated with an IP address simply as "TU ports".
  140.  
  141.    For most TCP/IP hosts, TU port range 0-1023 is used by servers 
  142.    listening for incoming connections. Clients trying to initiate 
  143.    a connection typically select a TU port in the range of 1024-65535. 
  144.    However, this convention is not universal and not always followed. 
  145.    Some client stations initiate connections using a TU port number 
  146.    in the range of 0-1023, and there are servers  listening on TU 
  147.    port numbers in the range of 1024-65535.
  148.  
  149.    A complete list of TU port services may be found in Ref[2].
  150.  
  151. 2.3. Start of session for TCP, UDP and others
  152.  
  153.    The first packet of every TCP session tries to establish a session 
  154.    and contains connection startup information. The first packet of a 
  155.    TCP session may be recognized by the presence of SYN bit and 
  156.    absence of ACK bit in the TCP flags. All TCP packets, with the 
  157.    exception of the first packet must have the ACK bit set.
  158.  
  159.    However, there is no deterministic way of recognizing the start of 
  160.  
  161.  
  162.  
  163. Srisuresh & Egevang                                             [Page 3]
  164.  
  165. Internet Draft         Network Address Translator              June 1997
  166.  
  167.  
  168.    a UDP based session or any non-TCP session. 
  169.  
  170. 3. Overview of NAT
  171.  
  172.    The design presented in this memo is called NAT, for Network Address
  173.    Translator. NAT is a router function that involves address 
  174.    translation alone or address and TCP/UDP port translation. We will 
  175.    call the former Basic NAT and the latter NAPT. Together they are 
  176.    referred to as NAT.  Unless mentioned otherwise, Address Translation 
  177.    or NAT throughout this document will pertain to Basic NAT as well 
  178.    as NAPT.  Only the stub border routers may be configured to perform 
  179.    address translation.
  180.  
  181. 3.1 Overview of Basic NAT
  182.  
  183.    Basic NAT operation is as follows. A stub domain with a set of 
  184.    private network addresses could be enabled to communicate with 
  185.    external network by dynamically mapping to a set of globally 
  186.    valid network addresses. If the number of local nodes are less 
  187.    than or equal to addresses in the global set, each local address 
  188.    is guaranteed to be mapped to an address from global set. Otherwise, 
  189.    local nodes allowed to have simultaneous access to external network 
  190.    are limited by the number of addresses in global set. In addition, 
  191.    individual local addresses may be statically mapped to specific 
  192.    global addresses to ensure guaranteed access to the outside or to 
  193.    expose a local node for access from the outside.  Multiple sessions 
  194.    may be initiated from a local node, using the same address mapping. 
  195.    
  196.    Addresses inside a stub domain are local to that domain and not
  197.    valid outside the domain. Thus, addresses inside a stub domain
  198.    can be reused by any other stub domain. For instance, a single
  199.    Class A address could be used by many stub domains. At each exit
  200.    point between a stub domain and backbone, NAT is installed. If 
  201.    there is more than one exit point it is of great importance that 
  202.    each NAT has the same translation table.
  203.  
  204.  
  205.         \ | /                 .                                /
  206.    +---------------+  WAN     .           +-----------------+/
  207.    |Regional Router|----------------------|Stub Router w/NAT|---
  208.    +---------------+          .           +-----------------+\
  209.                               .                      |         \
  210.                               .                      |  LAN
  211.                               .               ---------------
  212.                         Stub border
  213.  
  214.                       Figure 1: NAT Configuration
  215.  
  216.  
  217.  
  218.  
  219. Srisuresh & Egevang                                             [Page 4]
  220.  
  221. Internet Draft         Network Address Translator              June 1997
  222.  
  223.  
  224.    For instance, in the example of figure 2, both stubs A and B
  225.    internally use class A address 10.0.0.0. Stub A's NAT is 
  226.    assigned the class C address 198.76.29.0, and Stub B's NAT is 
  227.    assigned the class C address 198.76.28.0. The class C addresses 
  228.    are globally unique no other NAT boxes can use them.
  229.  
  230.                                    \ | /
  231.                                  +---------------+
  232.                                  |Regional Router|
  233.                                  +---------------+
  234.                                WAN |           | WAN
  235.                                    |           |
  236.                Stub A .............|....   ....|............ Stub B
  237.                                    |           |
  238.                  {s=198.76.29.7,^  |           |  v{s=198.76.29.7,
  239.                   d=198.76.28.4}^  |           |  v d=198.76.28.4}
  240.                    +-----------------+       +-----------------+
  241.                    |Stub Router w/NAT|       |Stub Router w/NAT|
  242.                    +-----------------+       +-----------------+
  243.                          |                         |
  244.                          |  LAN               LAN  |
  245.                    -------------             -------------
  246.                              |                 |
  247.            {s=10.33.96.5, ^  |                 |  v{s=198.76.29.7,
  248.             d=198.76.28.4}^ +--+             +--+ v d=10.81.13.22}
  249.                             |--|             |--|
  250.                            /____\           /____\
  251.                          10.33.96.5       10.81.13.22
  252.  
  253.                      Figure 2: Basic NAT Operation
  254.  
  255.    When stub A host 10.33.96.5 wishes to send a packet to stub B host
  256.    10.81.13.22, it uses the globally unique address 198.76.28.4 as
  257.    destination, and sends the packet to it's primary router. The stub
  258.    router has a static route for net 198.76.0.0 so the packet is
  259.    forwarded to the WAN-link. However, NAT translates the source 
  260.    address 10.33.96.5 of the IP header to the globally unique 
  261.    198.76.29.7 before the packet is forwarded. Likewise, IP packets
  262.    on the return path go through similar address translations.
  263.  
  264.    Notice that this requires no changes to hosts or routers. For
  265.    instance, as far as the stub A host is concerned, 198.76.28.4 is
  266.    the address used by the host in stub B. The address translations
  267.    are completely transparent. Of course, this is just a simple 
  268.    example. There are numerous issues to be explored.
  269.  
  270. 3.2. Overview of NAPT
  271.  
  272.  
  273.  
  274.  
  275. Srisuresh & Egevang                                             [Page 5]
  276.  
  277. Internet Draft         Network Address Translator              June 1997
  278.  
  279.  
  280.    Say, an organization has a private IP network and a WAN link to a
  281.    service provider. The private network's stub router is assigned
  282.    a globally valid address on the WAN link and the remaining nodes 
  283.    in the organization have IP addresses that have only local 
  284.    significance. In such a case, nodes on the private network could 
  285.    be allowed simultaneous access to external network, using the 
  286.    single registered IP address with the aid of NAPT. NAPT would 
  287.    allow mapping of tuples of the type (local IP addresses, local 
  288.    TU port number) to tuples of the type (registered IP address, 
  289.    assigned TU port number).
  290.  
  291.    This model fits the requirements of most Small Office Home Office 
  292.    (SOHO) groups to access external network using a single service 
  293.    provider assigned IP address. This model could be extended to 
  294.    allow inbound access by statically mapping a local node per each 
  295.    service TU port of the registered IP address.
  296.  
  297.    In the example of figure 3 below, stub A internally uses class A 
  298.    address 10.0.0.0. The stub router's WAN interface is assigned an 
  299.    IP address 138.76.28.4 by the service provider.
  300.  
  301.  
  302.                                    \ | /
  303.                                  +-----------------------+
  304.                                  |Service Provider Router|
  305.                                  +-----------------------+
  306.                                WAN |
  307.                                    |
  308.                Stub A .............|....
  309.                                    |
  310.        ^{s=138.76.28.4,sport=1024, |  v{s=138.76.29.7, sport = 23,
  311.        ^ d=138.76.29.7,dport=23}   |  v d=138.76.28.4, dport = 1024}
  312.                        +------------------+
  313.                        |Stub Router w/NAPT|
  314.                        +------------------+
  315.                          |
  316.                          |  LAN
  317.    --------------------------------------------
  318.       |        ^{s=10.0.0.10,sport=3017, |  v{s=138.76.29.7, sport=23,
  319.       |        ^ d=138.76.29.7,dport=23} |  v d=10.0.0.10, dport=3017}
  320.       |                                  |
  321.      +--+      +--+                    +--+
  322.      |--|      |--|                    |--|
  323.     /____\    /____\                  /____\
  324.    10.0.0.1  10.0.0.2   .....        10.0.0.10
  325.  
  326.     Figure 3: Network Address Port Translation (NAPT) Operation
  327.  
  328.  
  329.  
  330.  
  331. Srisuresh & Egevang                                             [Page 6]
  332.  
  333. Internet Draft         Network Address Translator              June 1997
  334.  
  335.  
  336.  
  337.    When stub A host 10.0.0.10 sends a telnet packet to host 
  338.    138.76.29.7, it uses the globally unique address 138.76.29.7 as 
  339.    destination, and sends the packet to it's primary router. The 
  340.    stub router has a static route for net 138.76.0.0 so the packet 
  341.    is forwarded to the WAN-link. However, NAPT translates the tuple 
  342.    of source address 10.0.0.10 and source TCP port 3017 in the IP 
  343.    and TCP headers into the globally unique 138.76.28.4 and a 
  344.    uniquely assigned TCP port, say 1024, before the packet is 
  345.    forwarded. Packets on the return path go through similar address 
  346.    and TCP port translations for the target IP address and target 
  347.    TCP port. Once again, notice that this requires no changes to 
  348.    hosts or routers.  The translation is completely transparent.
  349.  
  350.    In NAPT setup, only TCP/UDP sessions are allowed and must originate 
  351.    from the local network. However, there are services such as DNS that 
  352.    demand inbound access. There may be other services for which the 
  353.    organization wishes to allow inbound session access.  It is possible 
  354.    to statically configure a TU port service on the stub router to be 
  355.    directed to a specific node in the private network. 
  356.  
  357.    In NAPT setup, where the registered IP address is the same as the IP 
  358.    address of the stub router WAN interface, the router has to be sure
  359.    to make distinction between sessions originated from itself versus 
  360.    those originated from the nodes on local network. All inbound 
  361.    TCP/UDP sessions are assumed to be directed to the NAT router as 
  362.    the end node, unless the target service port is statically mapped to 
  363.    a different node in the local network.
  364.  
  365.    In addition to TCP/UDP sessions, ICMP reject messages will be NAT 
  366.    monitored as well. But, all other types of sessions are simply not 
  367.    permitted from local nodes and limited only to the NAT router alone, 
  368.    as the end node.
  369.    
  370. 4.0. Translation phases of a session.
  371.  
  372.    There are three phases to Address translation, as follows.
  373.  
  374. 4.1. Address binding:
  375.  
  376.    Address binding is the phase in which a local node IP address is 
  377.    associated with a global address for purposes of translation. For
  378.    addresses that have static mapping, the binding happens at startup 
  379.    time. Otherwise, a local address is bound to a global address 
  380.    dynamically at the time of session initiation from the local node. 
  381.    Once a local address is bound to a global address, all subsequent 
  382.    sessions originating from the same local address will use the same 
  383.    binding for session based packet translation. 
  384.  
  385.  
  386.  
  387. Srisuresh & Egevang                                             [Page 7]
  388.  
  389. Internet Draft         Network Address Translator              June 1997
  390.  
  391.  
  392.  
  393.    In the case of NAPT, where many local addresses are mapped to a 
  394.    single globally unique address, the binding would be from (local 
  395.    IP addr, TU port#) to a TU port of Registered IP address.  As 
  396.    with Basic NAT, this binding is determined at the time of session 
  397.    initiation. 
  398.  
  399. 4.2. Address lookup and translation:
  400.  
  401.    Once address binding is established for a connection setup 
  402.    through a NAT port, all subsequent packets belonging to the same 
  403.    connection will be subject to address lookup (and TU port lookup, 
  404.    in the case of NAPT) for translation purposes.
  405.  
  406.    For outbound packets of a session, the source IP address (and 
  407.    source TU port, in case of NAPT) and related fields (such as 
  408.    IP, TCP, UDP and ICMP header checksums) will undergo translation. 
  409.    For inbound packets of a session, the destination IP address 
  410.    (and destination TU port, in case of NAPT) and related fields
  411.    such as IP, TCP, UDP and ICMP header checksums) will undergo 
  412.    translation.
  413.  
  414. 4.3. Address unbinding:
  415.  
  416.    Address unbinding is the phase in which a local node IP address is 
  417.    no longer associated with a global address for purposes of 
  418.    translation. When the last session based on an address binding is 
  419.    terminated, it is safe to do the address unbinding after session 
  420.    termination.  
  421.  
  422.    The end of a TCP session is detected when FIN is acknowledged by 
  423.    both halves of the session or when either half sets RST bit in 
  424.    TCP flags field. Within a couple seconds after this, the session 
  425.    can be safely assumed to have been terminated. Dynamically bound 
  426.    TCP entries that have not been used for say, 24 hours, should 
  427.    also be safe to delete from the bound list. Dynamically bound 
  428.    non-TCP entries that have not been used for say, 1 minute, should 
  429.    also be safe to delete from the bound list. Session timeouts for 
  430.    TCP and non-TCP sessions could optionally be made user  
  431.    configurable. Another good way to handle session terminations is 
  432.    to timestamp entries and keep them as long as possible and retire 
  433.    the longest idle session when it becomes necessary. 
  434.  
  435. 5.0. Header Manipulations
  436.  
  437.    In Basic NAT model, the IP header of every packet must be 
  438.    modified. This modification includes IP address (source IP 
  439.    address for outbound packets and destination IP address for 
  440.  
  441.  
  442.  
  443. Srisuresh & Egevang                                             [Page 8]
  444.  
  445. Internet Draft         Network Address Translator              June 1997
  446.  
  447.  
  448.    inbound packets) and the IP checksum. 
  449.  
  450.    For TCP/UDP sessions, modifications must include update of 
  451.    checksum in the TCP/UDP headers. This is because TCP/UDP 
  452.    checksum also covers a pseudo header which contains the source 
  453.    and destination IP addresses. As an exception, UDP headers 
  454.    with 0 checksum should not be modified. Basic NAT must also look 
  455.    out for ICMP and FTP and modify the places where the IP address 
  456.    appears. There may be other places, where modifications must be 
  457.    done. Those are not widely known applications. 
  458.  
  459.    In NAPT model, modifications to IP header are similar to that of
  460.    Basic NAT. For TCP/UDP sessions, modifications must be extended
  461.    to include translation of TU port (source TU port for outbound 
  462.    packets and destination TU port for inbound packets) in the 
  463.    TCP/UDP header.  In general, NAPT must look for IP address as well 
  464.    as TU port and modify all places in the packet where IP address 
  465.    and TU port appear.
  466.  
  467.    NAT modifications are per packet based and can be very compute 
  468.    intensive, as they involve one or more checksum modifications
  469.    in addition to simple field translations. Luckily, we have
  470.    an algorithm below, which makes checksum adjustment to IP, TCP,
  471.    UDP and ICMP headers very simple and efficient. Since all these
  472.    headers use a one's complement sum, it is sufficient to calculate
  473.    the arithmetic difference between the before-translation and after-
  474.    translation addresses and add this to the checksum. The algorithm 
  475.    below is applicable only for even offsets (i.e., optr must be at
  476.    an even offset from start of header) and even lengths (i.e., olen 
  477.    and nlen below must be even). Sample code (in C) for this is as 
  478.    follows. 
  479.  
  480.  
  481.    void checksumadjust(unsigned char *chksum, unsigned char *optr,
  482.    int olen, unsigned char *nptr, int nlen)
  483.    /* assuming: unsigned char is 8 bits, long is 32 bits.
  484.      - chksum points to the chksum in the packet
  485.      - optr points to the old data in the packet
  486.      - nptr points to the new data in the packet
  487.    */
  488.    {
  489.      long x, old, new;
  490.      x=chksum[0]*256+chksum[1];
  491.      x=~x & 0xFFFF;
  492.      while (olen) 
  493.      {
  494.          old=optr[0]*256+optr[1]; optr+=2;
  495.          x-=old & 0xffff;
  496.  
  497.  
  498.  
  499. Srisuresh & Egevang                                             [Page 9]
  500.  
  501. Internet Draft         Network Address Translator              June 1997
  502.  
  503.  
  504.          if (x<=0) { x--; x&=0xffff; }
  505.          olen-=2;
  506.      }
  507.      while (nlen) 
  508.      {
  509.          new=nptr[0]*256+nptr[1]; nptr+=2;
  510.          x+=new & 0xffff;
  511.          if (x & 0x10000) { x++; x&=0xffff; }
  512.          nlen-=2;
  513.      }
  514.      x=~x & 0xFFFF;
  515.      chksum[0]=x/256; chksum[1]=x & 0xff;
  516.    }
  517.  
  518.  
  519.  
  520. 5.1. FTP sessions
  521.  
  522.    The arguments to the File Transfer Protocol (FTP) PORT command and 
  523.    PASV response include an IP address and a TCP port (in ASCII!). If 
  524.    the IP address in PORT command or PASV response is local to the 
  525.    stub domain, then NAT must substitute this.  Because the address 
  526.    and TCP port are encoded in ASCII, this may result in a change in 
  527.    the size of packet.  For instance, 10,18,177,42,64,87 is 18 ASCII 
  528.    characters, whereas 193,45,228,137,64,87 is 20 ASCII characters. 
  529.    If the new size is same as the previous, only the TCP checksum 
  530.    needs adjustment as a result of change of data. If the new size 
  531.    is less than or greater than the previous, TCP sequence numbers 
  532.    must also be changed to reflect the change in length of FTP control 
  533.    data portion.
  534.  
  535.    A special table is used to correct the TCP sequence and acknowledge
  536.    numbers with source port FTP or destination port FTP. The table
  537.    entries should have source, destination, source port, destination
  538.    port, delta for sequence numbers and a timestamp. New entries are 
  539.    created only when FTP PORT commands or PASV responses are seen. The 
  540.    sequence number delta may be increased or decreased for every FTP 
  541.    PORT command or PASV response. Sequence numbers are incremented 
  542.    and acknowledge numbers are decremented by this delta. 
  543.  
  544.    The sequence number adjustment must be coded carefully, not to harm
  545.    performance for TCP in general. Of course, if the FTP session is
  546.    encrypted, PORT command and/or PASV response will fail.
  547.  
  548. 5.2. ICMP packet modifications
  549.  
  550.    If an ICMP message is passed through NAT, it may require two address
  551.    modifications and three checksum modifications. This is because most
  552.  
  553.  
  554.  
  555. Srisuresh & Egevang                                            [Page 10]
  556.  
  557. Internet Draft         Network Address Translator              June 1997
  558.  
  559.  
  560.    ICMP messages contain part of the original IP packet in the body.
  561.    Therefore, for NAT to be completely transparent to the host, the 
  562.    IP address of the IP header embedded in the data part of the ICMP 
  563.    packet must be modified, the checksum field of the same IP header 
  564.    must correspondingly be modified, and the ICMP header checksum must 
  565.    be modified to reflect the changes to the IP header and checksum in 
  566.    the ICMP body. Furthermore, the normal IP header must also be 
  567.    modified as already described. In a NAPT setup, if the IP message 
  568.    embedded within ICMP happens to be a TCP or UDP packet, you will 
  569.    also need to modify the appropriate TU port number within the 
  570.    TCP/UDP header.
  571.  
  572.    No modifications are needed for the Echo and Timestamp messages, 
  573.    and NAT should never need to handle a Redirect message. As for
  574.    SNMP and SMTP applications, translation of addresses within SNMP 
  575.    or SMTP messages would not be attempted by NAT routers. At some 
  576.    point, it must be left to application specific proxy agents to 
  577.    do the translations as appropriate to the application.
  578.  
  579.  
  580. 5.3. IP option handling
  581.  
  582.    An IP datagram with any of the IP options Record Route, Strict 
  583.    Source Route or Loose Source Route would involve IP addresses of the 
  584.    intermediate routers. A NAT intermediate router would simply leave 
  585.    the addresses untranslated and essentially not participate in the 
  586.    processing of these options.  The reason is simply that NAT is not
  587.    a full solution, but just a hack (a nice hack, may be). 
  588.  
  589.    An ICMP datagram with record route option is very likely intended
  590.    for debugging purposes. Hence, leaving the local addresses 
  591.    untranslated will likely not break the application.
  592.  
  593.  
  594. 5.4. Applications with IP-address Content
  595.  
  596.    Any application that carries (and uses) the IP address (and 
  597.    TU port, in case of NAPT) inside the application will not work 
  598.    through NAT unless NAT knows of such instances and knows to do 
  599.    the appropriate translation. It is not possible or even 
  600.    necessarily desirable for NAT to know of all such applications.  
  601.    And, if encryption is used then it is impossible for NAT to make 
  602.    the translation.
  603.  
  604.    It may be possible for such systems to avoid using NAT, if the hosts
  605.    in which they run are assigned global addresses. Whether or not this
  606.    can work depends on the capability of the intra-domain routing
  607.    algorithm and the internal topology. This is because the global
  608.  
  609.  
  610.  
  611. Srisuresh & Egevang                                            [Page 11]
  612.  
  613. Internet Draft         Network Address Translator              June 1997
  614.  
  615.  
  616.    address must be advertised in the intra-domain routing algorithm.
  617.    With a low-feature routing algorithm like RIP, the host may 
  618.    require its own class C address space, that must not only be 
  619.    advertised internally but externally as well (thus hurting global 
  620.    scaling). With a high-feature routing algorithm like OSPF, the 
  621.    host address can be passed around individually, and can come from 
  622.    the NAT table.
  623.  
  624. 6. Miscellaneous issues
  625.  
  626. 6.1. Partitioning of Local and Global Addresses
  627.  
  628.    For NAT to operate properly, it is necessary to partition the IP
  629.    address space into two parts - the local addresses used internal
  630.    to stub domains, and the globally unique addresses.  Any given 
  631.    address must either be a local address or a global address. 
  632.    There is no overlap.
  633.  
  634.    The problem with overlap is the following. Say a host in stub A
  635.    wished to send packets to a host in stub B, but the global 
  636.    addresses of stub B overlapped the local addressees of stub A. In 
  637.    this case, the routers in stub A would not be able to distinguish 
  638.    the global address of stub B from its own local addresses.
  639.  
  640. 6.2. Private address space recommendation
  641.  
  642.    The RFC listed in ref[1] has recommendations on address space 
  643.    allocation for private networks. Internet Assigned Numbers 
  644.    Authority (IANA) has three blocks of IP address space, namely 
  645.    10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 for private 
  646.    internets. In pre-CIDR notation, the first block is nothing but 
  647.    a single class A network number, while the second block is a set 
  648.    of 16 contiguous class B networks, and the third block is a set of 
  649.    256 contiguous class C networks.
  650.  
  651.    An organization that decides to use IP addresses in the address 
  652.    space defined above can do so without any coordination with IANA 
  653.    or an Internet registry. The address space can thus be used 
  654.    privately by many independent organizations at the same time, 
  655.    with NAT operation enabled on their border routers.
  656.  
  657. 6.3. Routing Across NAT
  658.  
  659.    The router running NAT should not advertise the local networks to
  660.    the backbone. Only the networks with global addresses may be known
  661.    outside the stub. However, global information that NAT receives from
  662.    the stub border router can be advertised in the stub the usual way.
  663.  
  664.  
  665.  
  666.  
  667. Srisuresh & Egevang                                            [Page 12]
  668.  
  669. Internet Draft         Network Address Translator              June 1997
  670.  
  671.  
  672.    Typically, the NAT stub router will have a static route configured
  673.    to forward all external traffic to service provider router over WAN 
  674.    link, and the service provider router will have a static route 
  675.    configured to forward NAT packets (i.e., those whose destination 
  676.    IP address fall within the range of NAT managed global address list) 
  677.    to NAT router over WAN link.
  678.  
  679. 6.4. Private Networks that Span Backbones
  680.  
  681.    In many cases, a private network (such as a corporate network) will
  682.    be spread over different locations and will use a public backbone 
  683.    for communications between those locations. In this case, it is not
  684.    desirable to do address translation, both because large numbers of
  685.    hosts may want to communicate across the backbone, thus requiring
  686.    large address tables, and because there will be more applications
  687.    that depend on configured addresses, as opposed to going to a name
  688.    server. We call such a private network a backbone-partitioned stub.
  689.  
  690.    Backbone-partitioned stubs should behave as though they were a non-
  691.    partitioned stub. That is, the routers in all partitions should
  692.    maintain routes to the local address spaces of all partitions. Of
  693.    course, the (public) backbones do not maintain routes to any local
  694.    addresses. Therefore, the border routers must tunnel through the
  695.    backbones using encapsulation. To do this, each NAT box will set
  696.    aside one global address for tunneling. When a NAT box x in stub
  697.    partition X wishes to deliver a packet to stub partition Y, it will
  698.    encapsulate the packet in an IP header with destination address set
  699.    to the global address of NAT box y that has been reserved for
  700.    encapsulation. When NAT box y receives a packet with that destination
  701.    address, it decapsulates the IP header and routes the packet
  702.    internally.
  703.  
  704.  
  705. 6.5. Switch-over from Basic NAT to NAPT
  706.  
  707.    In Basic NAT setup, when local network nodes outnumber global 
  708.    addresses available for mapping (say, a class B local network 
  709.    mapped to a class C global address block), external network 
  710.    access to some of the local nodes is abruptly cut off after the 
  711.    last global address from the address list is used up. This is 
  712.    very inconvenient and constraining. Such an incident can be 
  713.    safely avoided by optionally allowing the Basic NAT router to 
  714.    switch over to NAPT setup for the last global address in the 
  715.    address list.  Doing this will guarantee that hosts on local 
  716.    network will have continued, uninterrupted access to the external 
  717.    nodes and services.  
  718.  
  719. 7.0. NAT limitations
  720.  
  721.  
  722.  
  723. Srisuresh & Egevang                                            [Page 13]
  724.  
  725. Internet Draft         Network Address Translator              June 1997
  726.  
  727.  
  728.  
  729. 7.1. Privacy, Security, and Debugging Considerations
  730.  
  731.    Unfortunately, NAT reduces the number of options for providing
  732.    security. With NAT, nothing that carries an IP address or TU port or 
  733.    information derived from an IP address or TU port (such as the 
  734.    IP/TCP/UDP/ICMP header checksum) can be encrypted. While most 
  735.    application-level encryption should be ok, this prevents encryption 
  736.    of TCP/UDP headers.
  737.  
  738.    On the other hand, NAT itself can be seen as providing a kind of
  739.    privacy mechanism. This comes from the fact that machines on the
  740.    backbone cannot monitor which hosts are sending and receiving traffic
  741.    (assuming of course that the application data is encrypted).
  742.  
  743.    The same characteristic that enhances privacy potentially makes
  744.    debugging problems (including security violations) more difficult. 
  745.    If a host is abusing the Internet in some way (such as trying to 
  746.    attack another machine or even sending large amounts of junk mail
  747.    or something) it is more difficult to pinpoint the source of the 
  748.    trouble because the IP address of the host is hidden in a NAT router.
  749.  
  750.  
  751. 7.2. ARP responses to NAT mapped global addresses on a LAN interface
  752.  
  753.    NAT must be enabled only on border routers of a stub domain. The 
  754.    examples provided in the document to illustrate Basic NAT and 
  755.    NAPT have maintained a WAN link for connection to external router 
  756.    (i.e., service provider router) from NAT router. However, if the 
  757.    WAN link were to be replaced by a LAN connection and if part or 
  758.    all of the global address space used for NAT mapping belongs to 
  759.    the same IP subnet as the LAN segment, the NAT router would be 
  760.    expected to provide ARP support for the address range that belongs 
  761.    to the same subnet.  Responding to ARP requests for the NAT 
  762.    mapped global addresses with its own MAC address is a must in 
  763.    such a situation with Basic NAT setup. If the NAT router did 
  764.    not respond to these requests, there is no other node in the 
  765.    network that has ownership to these addresses and hence will
  766.    go unresponded. 
  767.  
  768.    This scenario is unlikely with NAPT setup except when the single 
  769.    address used in NAPT mapping is not the interface address of the 
  770.    NAT router (as in the case of a switch-over from Basic NAT to NAPT 
  771.    explained in 6.5 above, for example).
  772.  
  773.    Using an address range from a directly connected subnet for NAT 
  774.    address mapping would obviate static route configuration on the 
  775.    service provider router.
  776.  
  777.  
  778.  
  779. Srisuresh & Egevang                                            [Page 14]
  780.  
  781. Internet Draft         Network Address Translator              June 1997
  782.  
  783.  
  784.  
  785.    It is the opinion of the authors that a LAN link to a service 
  786.    provider router is not very common. However, vendors may be 
  787.    interested to optionally support proxy ARP just in case.
  788.  
  789. 7.3. Negative characteristics:
  790.  
  791. 1. NAT is compute intensive even with the help of a clever checksum 
  792.    adjust algorithm, as each data packet is subject to NAT lookup and 
  793.    modifications.  As a result, router forwarding throughput will be 
  794.    slowed considerably. 
  795.  
  796. 2. NAT increases the probability of mis-addressing. For example, same 
  797.    local address may be bound to different global address at different
  798.    times and vice versa. As a result, any traffic flow study based 
  799.    purely on global addresses and TU ports could be confused and 
  800.    might misinterpret the results.
  801.    
  802.  
  803. 3. It breaks certain applications or at least makes them more difficult
  804.    to run.
  805.  
  806.    With the exception of FTP, NAT will not do address and TU port 
  807.    translations outside of the IP and the TCP/UDP headers. This 
  808.    includes DNS request and response messages. It is expected that 
  809.    internal DNS servers maintain mapping of names to IP addresses for 
  810.    internal hosts as well as some external hosts. External DNS servers 
  811.    would be expected to maintain name mapping for external hosts alone 
  812.    and not for any of the internal hosts. If the local network does not 
  813.    have an internal DNS server, all DNS requests may be directed to the 
  814.    external DNS server to get address mapping for the external hosts.
  815.  
  816.    There may be issues with SNMP  as well.
  817.  
  818. 4. It hides the identity of hosts. This is not to be confused with 
  819.    security however. Security on a router must be relegated to firewall
  820.    functionality, independent of or in conjunction with NAT operation.
  821.  
  822. 8.0. Current Implementations
  823.  
  824.    Many commercial implementations are available in the industry that
  825.    adhere to the NAT description provided in this document.  However,
  826.    the authors are not aware of any public domain software for NAT.
  827.  
  828. REFERENCES
  829.  
  830.    [1] Rekhter, Y., Moskowitz, B., Karrenberg, D., G. de Groot, and, 
  831.        Lear, E.  "Address Allocation for Private Internets", RFC 1918 
  832.  
  833.  
  834.  
  835. Srisuresh & Egevang                                            [Page 15]
  836.  
  837. Internet Draft         Network Address Translator              June 1997
  838.  
  839.  
  840.        or its successor.
  841.  
  842.    [2] J. Reynolds and J. Postel, "Assigned Numbers", RFC 1700 or 
  843.        its successor.
  844.  
  845.    
  846. 9.0. Security Considerations
  847.  
  848.    Security issues are not discussed in this memo.
  849.  
  850. Authors' Addresses
  851.  
  852.    Pyda Srisuresh
  853.    3Com Corporation
  854.    Santa Clara, CA 
  855.    U.S.A.
  856.  
  857.    Voice: (408) 764-6968
  858.    Fax:   (408) 764-6134 
  859.    EMail: suresh@3com.com
  860.  
  861.    Kjeld Borch Egevang
  862.    Intel Denmark ApS
  863.  
  864.    Voice: +45 44530100
  865.    Fax:   +45 44531415
  866.    EMail: kbe@casetech.dk
  867.    http:  //www.geocities.com/Paris/2610
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891. Srisuresh & Egevang                                            [Page 16]
  892.  
  893.