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-00.txt < prev    next >
Text File  |  1997-06-03  |  37KB  |  898 lines

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