home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 1100s / rfc1180.txt < prev    next >
Text File  |  1991-01-14  |  64KB  |  1,571 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                      T. Socolofsky
  8. Request for Comments:  1180                                      C. Kale
  9.                                                   Spider Systems Limited
  10.                                                             January 1991
  11.  
  12.  
  13.                            A TCP/IP Tutorial
  14.  
  15. Status of this Memo
  16.  
  17.    This RFC is a tutorial on the TCP/IP protocol suite, focusing
  18.    particularly on the steps in forwarding an IP datagram from source
  19.    host to destination host through a router.  It does not specify an
  20.    Internet standard.  Distribution of this memo is unlimited.
  21.  
  22. Table of Contents
  23.  
  24.     1.  Introduction................................................   1
  25.     2.  TCP/IP Overview.............................................   2
  26.     3.  Ethernet....................................................   8
  27.     4.  ARP.........................................................   9
  28.     5.  Internet Protocol...........................................  12
  29.     6.  User Datagram Protocol......................................  22
  30.     7.  Transmission Control Protocol...............................  24
  31.     8.  Network Applications........................................  25
  32.     9.  Other Information...........................................  27
  33.    10.  References..................................................  27
  34.    11.  Relation to other RFCs......................................  27
  35.    12.  Security Considerations.....................................  27
  36.    13.  Authors' Addresses..........................................  28
  37.  
  38. 1.  Introduction
  39.  
  40.    This tutorial contains only one view of the salient points of TCP/IP,
  41.    and therefore it is the "bare bones" of TCP/IP technology.  It omits
  42.    the history of development and funding, the business case for its
  43.    use, and its future as compared to ISO OSI.  Indeed, a great deal of
  44.    technical information is also omitted.  What remains is a minimum of
  45.    information that must be understood by the professional working in a
  46.    TCP/IP environment.  These professionals include the systems
  47.    administrator, the systems programmer, and the network manager.
  48.  
  49.    This tutorial uses examples from the UNIX TCP/IP environment, however
  50.    the main points apply across all implementations of TCP/IP.
  51.  
  52.    Note that the purpose of this memo is explanation, not definition.
  53.    If any question arises about the correct specification of a protocol,
  54.    please refer to the actual standards defining RFC.
  55.  
  56.  
  57.  
  58. Socolofsky & Kale                                               [Page 1]
  59.  
  60. RFC 1180                   A TCP/IP Tutorial                January 1991
  61.  
  62.  
  63.    The next section is an overview of TCP/IP, followed by detailed
  64.    descriptions of individual components.
  65.  
  66. 2.  TCP/IP Overview
  67.  
  68.    The generic term "TCP/IP" usually means anything and everything
  69.    related to the specific protocols of TCP and IP.  It can include
  70.    other protocols, applications, and even the network medium.  A sample
  71.    of these protocols are: UDP, ARP, and ICMP.  A sample of these
  72.    applications are: TELNET, FTP, and rcp.  A more accurate term is
  73.    "internet technology".  A network that uses internet technology is
  74.    called an "internet".
  75.  
  76. 2.1  Basic Structure
  77.  
  78.    To understand this technology you must first understand the following
  79.    logical structure:
  80.  
  81.                      ----------------------------
  82.                      |    network applications  |
  83.                      |                          |
  84.                      |...  \ | /  ..  \ | /  ...|
  85.                      |     -----      -----     |
  86.                      |     |TCP|      |UDP|     |
  87.                      |     -----      -----     |
  88.                      |         \      /         |
  89.                      |         --------         |
  90.                      |         |  IP  |         |
  91.                      |  -----  -*------         |
  92.                      |  |ARP|   |               |
  93.                      |  -----   |               |
  94.                      |      \   |               |
  95.                      |      ------              |
  96.                      |      |ENET|              |
  97.                      |      ---@--              |
  98.                      ----------|-----------------
  99.                                |
  100.          ----------------------o---------
  101.              Ethernet Cable
  102.  
  103.                   Figure 1.  Basic TCP/IP Network Node
  104.  
  105.    This is the logical structure of the layered protocols inside a
  106.    computer on an internet.  Each computer that can communicate using
  107.    internet technology has such a logical structure.  It is this logical
  108.    structure that determines the behavior of the computer on the
  109.    internet.  The boxes represent processing of the data as it passes
  110.    through the computer, and the lines connecting boxes show the path of
  111.  
  112.  
  113.  
  114. Socolofsky & Kale                                               [Page 2]
  115.  
  116. RFC 1180                   A TCP/IP Tutorial                January 1991
  117.  
  118.  
  119.    data.  The horizontal line at the bottom represents the Ethernet
  120.    cable; the "o" is the transceiver.  The "*" is the IP address and the
  121.    "@" is the Ethernet address.  Understanding this logical structure is
  122.    essential to understanding internet technology; it is referred to
  123.    throughout this tutorial.
  124.  
  125. 2.2  Terminology
  126.  
  127.    The name of a unit of data that flows through an internet is
  128.    dependent upon where it exists in the protocol stack.  In summary: if
  129.    it is on an Ethernet it is called an Ethernet frame; if it is between
  130.    the Ethernet driver and the IP module it is called a IP packet; if it
  131.    is between the IP module and the UDP module it is called a UDP
  132.    datagram; if it is between the IP module and the TCP module it is
  133.    called a TCP segment (more generally, a transport message); and if it
  134.    is in a network application it is called a application message.
  135.  
  136.    These definitions are imperfect.  Actual definitions vary from one
  137.    publication to the next.  More specific definitions can be found in
  138.    RFC 1122, section 1.3.3.
  139.  
  140.    A driver is software that communicates directly with the network
  141.    interface hardware.  A module is software that communicates with a
  142.    driver, with network applications, or with another module.
  143.  
  144.    The terms driver, module, Ethernet frame, IP packet, UDP datagram,
  145.    TCP message, and application message are used where appropriate
  146.    throughout this tutorial.
  147.  
  148. 2.3  Flow of Data
  149.  
  150.    Let's follow the data as it flows down through the protocol stack
  151.    shown in Figure 1.  For an application that uses TCP (Transmission
  152.    Control Protocol), data passes between the application and the TCP
  153.    module.  For applications that use UDP (User Datagram Protocol), data
  154.    passes between the application and the UDP module.  FTP (File
  155.    Transfer Protocol) is a typical application that uses TCP.  Its
  156.    protocol stack in this example is FTP/TCP/IP/ENET.  SNMP (Simple
  157.    Network Management Protocol) is an application that uses UDP.  Its
  158.    protocol stack in this example is SNMP/UDP/IP/ENET.
  159.  
  160.    The TCP module, UDP module, and the Ethernet driver are n-to-1
  161.    multiplexers.  As multiplexers they switch many inputs to one output.
  162.    They are also 1-to-n de-multiplexers.  As de-multiplexers they switch
  163.    one input to many outputs according to the type field in the protocol
  164.    header.
  165.  
  166.  
  167.  
  168.  
  169.  
  170. Socolofsky & Kale                                               [Page 3]
  171.  
  172. RFC 1180                   A TCP/IP Tutorial                January 1991
  173.  
  174.  
  175.          1   2 3 ...   n                   1   2 3 ...   n
  176.           \  |      /      |               \  | |      /       ^
  177.            \ | |   /       |                \ | |     /        |
  178.          -------------   flow              ----------------   flow
  179.          |multiplexer|    of               |de-multiplexer|    of
  180.          -------------   data              ----------------   data
  181.               |            |                     |              |
  182.               |            v                     |              |
  183.               1                                  1
  184.  
  185.         Figure 2.  n-to-1 multiplexer and 1-to-n de-multiplexer
  186.  
  187.    If an Ethernet frame comes up into the Ethernet driver off the
  188.    network, the packet can be passed upwards to either the ARP (Address
  189.    Resolution Protocol) module or to the IP (Internet Protocol) module.
  190.    The value of the type field in the Ethernet frame determines whether
  191.    the Ethernet frame is passed to the ARP or the IP module.
  192.  
  193.    If an IP packet comes up into IP, the unit of data is passed upwards
  194.    to either TCP or UDP, as determined by the value of the protocol
  195.    field in the IP header.
  196.  
  197.    If the UDP datagram comes up into UDP, the application message is
  198.    passed upwards to the network application based on the value of the
  199.    port field in the UDP header.  If the TCP message comes up into TCP,
  200.    the application message is passed upwards to the network application
  201.    based on the value of the port field in the TCP header.
  202.  
  203.    The downwards multiplexing is simple to perform because from each
  204.    starting point there is only the one downward path; each protocol
  205.    module adds its header information so the packet can be de-
  206.    multiplexed at the destination computer.
  207.  
  208.    Data passing out from the applications through either TCP or UDP
  209.    converges on the IP module and is sent downwards through the lower
  210.    network interface driver.
  211.  
  212.    Although internet technology supports many different network media,
  213.    Ethernet is used for all examples in this tutorial because it is the
  214.    most common physical network used under IP.  The computer in Figure 1
  215.    has a single Ethernet connection.  The 6-byte Ethernet address is
  216.    unique for each interface on an Ethernet and is located at the lower
  217.    interface of the Ethernet driver.
  218.  
  219.    The computer also has a 4-byte IP address.  This address is located
  220.    at the lower interface to the IP module.  The IP address must be
  221.    unique for an internet.
  222.  
  223.  
  224.  
  225.  
  226. Socolofsky & Kale                                               [Page 4]
  227.  
  228. RFC 1180                   A TCP/IP Tutorial                January 1991
  229.  
  230.  
  231.    A running computer always knows its own IP address and Ethernet
  232.    address.
  233.  
  234. 2.4  Two Network Interfaces
  235.  
  236.    If a computer is connected to 2 separate Ethernets it is as in Figure
  237.    3.
  238.  
  239.                 ----------------------------
  240.                 |    network applications  |
  241.                 |                          |
  242.                 |...  \ | /  ..  \ | /  ...|
  243.                 |     -----      -----     |
  244.                 |     |TCP|      |UDP|     |
  245.                 |     -----      -----     |
  246.                 |         \      /         |
  247.                 |         --------         |
  248.                 |         |  IP  |         |
  249.                 |  -----  -*----*-  -----  |
  250.                 |  |ARP|   |    |   |ARP|  |
  251.                 |  -----   |    |   -----  |
  252.                 |      \   |    |   /      |
  253.                 |      ------  ------      |
  254.                 |      |ENET|  |ENET|      |
  255.                 |      ---@--  ---@--      |
  256.                 ----------|-------|---------
  257.                           |       |
  258.                           |    ---o---------------------------
  259.                           |             Ethernet Cable 2
  260.            ---------------o----------
  261.              Ethernet Cable 1
  262.  
  263.              Figure 3.  TCP/IP Network Node on 2 Ethernets
  264.  
  265.    Please note that this computer has 2 Ethernet addresses and 2 IP
  266.    addresses.
  267.  
  268.    It is seen from this structure that for computers with more than one
  269.    physical network interface, the IP module is both a n-to-m
  270.    multiplexer and an m-to-n de-multiplexer.
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Socolofsky & Kale                                               [Page 5]
  283.  
  284. RFC 1180                   A TCP/IP Tutorial                January 1991
  285.  
  286.  
  287.          1   2 3 ...   n                   1   2 3 ...   n
  288.           \  | |      /    |                \  | |      /       ^
  289.            \ | |     /     |                 \ | |     /        |
  290.          -------------   flow              ----------------   flow
  291.          |multiplexer|    of               |de-multiplexer|    of
  292.          -------------   data              ----------------   data
  293.            / | |     \     |                 / | |     \        |
  294.           /  | |      \    v                /  | |      \       |
  295.          1   2 3 ...   m                   1   2 3 ...   m
  296.  
  297.         Figure 4.  n-to-m multiplexer and m-to-n de-multiplexer
  298.  
  299.    It performs this multiplexing in either direction to accommodate
  300.    incoming and outgoing data.  An IP module with more than 1 network
  301.    interface is more complex than our original example in that it can
  302.    forward data onto the next network.  Data can arrive on any network
  303.    interface and be sent out on any other.
  304.  
  305.                            TCP      UDP
  306.                              \      /
  307.                               \    /
  308.                           --------------
  309.                           |     IP     |
  310.                           |            |
  311.                           |    ---     |
  312.                           |   /   \    |
  313.                           |  /     v   |
  314.                           --------------
  315.                            /         \
  316.                           /           \
  317.                        data           data
  318.                       comes in         goes out
  319.                      here               here
  320.  
  321.             Figure 5.  Example of IP Forwarding a IP Packet
  322.  
  323.    The process of sending an IP packet out onto another network is
  324.    called "forwarding" an IP packet.  A computer that has been dedicated
  325.    to the task of forwarding IP packets is called an "IP-router".
  326.  
  327.    As you can see from the figure, the forwarded IP packet never touches
  328.    the TCP and UDP modules on the IP-router.  Some IP-router
  329.    implementations do not have a TCP or UDP module.
  330.  
  331. 2.5  IP Creates a Single Logical Network
  332.  
  333.    The IP module is central to the success of internet technology.  Each
  334.    module or driver adds its header to the message as the message passes
  335.  
  336.  
  337.  
  338. Socolofsky & Kale                                               [Page 6]
  339.  
  340. RFC 1180                   A TCP/IP Tutorial                January 1991
  341.  
  342.  
  343.    down through the protocol stack.  Each module or driver strips the
  344.    corresponding header from the message as the message climbs the
  345.    protocol stack up towards the application.  The IP header contains
  346.    the IP address, which builds a single logical network from multiple
  347.    physical networks.  This interconnection of physical networks is the
  348.    source of the name: internet.  A set of interconnected physical
  349.    networks that limit the range of an IP packet is called an
  350.    "internet".
  351.  
  352. 2.6  Physical Network Independence
  353.  
  354.    IP hides the underlying network hardware from the network
  355.    applications.  If you invent a new physical network, you can put it
  356.    into service by implementing a new driver that connects to the
  357.    internet underneath IP.  Thus, the network applications remain intact
  358.    and are not vulnerable to changes in hardware technology.
  359.  
  360. 2.7  Interoperability
  361.  
  362.    If two computers on an internet can communicate, they are said to
  363.    "interoperate"; if an implementation of internet technology is good,
  364.    it is said to have "interoperability".  Users of general-purpose
  365.    computers benefit from the installation of an internet because of the
  366.    interoperability in computers on the market.  Generally, when you buy
  367.    a computer, it will interoperate.  If the computer does not have
  368.    interoperability, and interoperability can not be added, it occupies
  369.    a rare and special niche in the market.
  370.  
  371. 2.8  After the Overview
  372.  
  373.    With the background set, we will answer the following questions:
  374.  
  375.    When sending out an IP packet, how is the destination Ethernet
  376.    address determined?
  377.  
  378.    How does IP know which of multiple lower network interfaces to use
  379.    when sending out an IP packet?
  380.  
  381.    How does a client on one computer reach the server on another?
  382.  
  383.    Why do both TCP and UDP exist, instead of just one or the other?
  384.  
  385.    What network applications are available?
  386.  
  387.    These will be explained, in turn, after an Ethernet refresher.
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Socolofsky & Kale                                               [Page 7]
  395.  
  396. RFC 1180                   A TCP/IP Tutorial                January 1991
  397.  
  398.  
  399. 3.  Ethernet
  400.  
  401.    This section is a short review of Ethernet technology.
  402.  
  403.    An Ethernet frame contains the destination address, source address,
  404.    type field, and data.
  405.  
  406.    An Ethernet address is 6 bytes.  Every device has its own Ethernet
  407.    address and listens for Ethernet frames with that destination
  408.    address.  All devices also listen for Ethernet frames with a wild-
  409.    card destination address of "FF-FF-FF-FF-FF-FF" (in hexadecimal),
  410.    called a "broadcast" address.
  411.  
  412.    Ethernet uses CSMA/CD (Carrier Sense and Multiple Access with
  413.    Collision Detection).  CSMA/CD means that all devices communicate on
  414.    a single medium, that only one can transmit at a time, and that they
  415.    can all receive simultaneously.  If 2 devices try to transmit at the
  416.    same instant, the transmit collision is detected, and both devices
  417.    wait a random (but short) period before trying to transmit again.
  418.  
  419. 3.1  A Human Analogy
  420.  
  421.    A good analogy of Ethernet technology is a group of people talking in
  422.    a small, completely dark room.  In this analogy, the physical network
  423.    medium is sound waves on air in the room instead of electrical
  424.    signals on a coaxial cable.
  425.  
  426.    Each person can hear the words when another is talking (Carrier
  427.    Sense).  Everyone in the room has equal capability to talk (Multiple
  428.    Access), but none of them give lengthy speeches because they are
  429.    polite.  If a person is impolite, he is asked to leave the room
  430.    (i.e., thrown off the net).
  431.  
  432.    No one talks while another is speaking.  But if two people start
  433.    speaking at the same instant, each of them know this because each
  434.    hears something they haven't said (Collision Detection).  When these
  435.    two people notice this condition, they wait for a moment, then one
  436.    begins talking.  The other hears the talking and waits for the first
  437.    to finish before beginning his own speech.
  438.  
  439.    Each person has an unique name (unique Ethernet address) to avoid
  440.    confusion.  Every time one of them talks, he prefaces the message
  441.    with the name of the person he is talking to and with his own name
  442.    (Ethernet destination and source address, respectively), i.e., "Hello
  443.    Jane, this is Jack, ..blah blah blah...".  If the sender wants to
  444.    talk to everyone he might say "everyone" (broadcast address), i.e.,
  445.    "Hello Everyone, this is Jack, ..blah blah blah...".
  446.  
  447.  
  448.  
  449.  
  450. Socolofsky & Kale                                               [Page 8]
  451.  
  452. RFC 1180                   A TCP/IP Tutorial                January 1991
  453.  
  454.  
  455. 4.  ARP
  456.  
  457.    When sending out an IP packet, how is the destination Ethernet
  458.    address determined?
  459.  
  460.    ARP (Address Resolution Protocol) is used to translate IP addresses
  461.    to Ethernet addresses.  The translation is done only for outgoing IP
  462.    packets, because this is when the IP header and the Ethernet header
  463.    are created.
  464.  
  465. 4.1  ARP Table for Address Translation
  466.  
  467.    The translation is performed with a table look-up.  The table, called
  468.    the ARP table, is stored in memory and contains a row for each
  469.    computer.  There is a column for IP address and a column for Ethernet
  470.    address.  When translating an IP address to an Ethernet address, the
  471.    table is searched for a matching IP address.  The following is a
  472.    simplified ARP table:
  473.  
  474.                   ------------------------------------
  475.                   |IP address       Ethernet address |
  476.                   ------------------------------------
  477.                   |223.1.2.1        08-00-39-00-2F-C3|
  478.                   |223.1.2.3        08-00-5A-21-A7-22|
  479.                   |223.1.2.4        08-00-10-99-AC-54|
  480.                   ------------------------------------
  481.                       TABLE 1.  Example ARP Table
  482.  
  483.    The human convention when writing out the 4-byte IP address is each
  484.    byte in decimal and separating bytes with a period.  When writing out
  485.    the 6-byte Ethernet address, the conventions are each byte in
  486.    hexadecimal and separating bytes with either a minus sign or a colon.
  487.  
  488.    The ARP table is necessary because the IP address and Ethernet
  489.    address are selected independently; you can not use an algorithm to
  490.    translate IP address to Ethernet address.  The IP address is selected
  491.    by the network manager based on the location of the computer on the
  492.    internet.  When the computer is moved to a different part of an
  493.    internet, its IP address must be changed.  The Ethernet address is
  494.    selected by the manufacturer based on the Ethernet address space
  495.    licensed by the manufacturer.  When the Ethernet hardware interface
  496.    board changes, the Ethernet address changes.
  497.  
  498. 4.2  Typical Translation Scenario
  499.  
  500.    During normal operation a network application, such as TELNET, sends
  501.    an application message to TCP, then TCP sends the corresponding TCP
  502.    message to the IP module.  The destination IP address is known by the
  503.  
  504.  
  505.  
  506. Socolofsky & Kale                                               [Page 9]
  507.  
  508. RFC 1180                   A TCP/IP Tutorial                January 1991
  509.  
  510.  
  511.    application, the TCP module, and the IP module.  At this point the IP
  512.    packet has been constructed and is ready to be given to the Ethernet
  513.    driver, but first the destination Ethernet address must be
  514.    determined.
  515.  
  516.    The ARP table is used to look-up the destination Ethernet address.
  517.  
  518.    4.3  ARP Request/Response Pair
  519.  
  520.    But how does the ARP table get filled in the first place?  The answer
  521.    is that it is filled automatically by ARP on an "as-needed" basis.
  522.  
  523.    Two things happen when the ARP table can not be used to translate an
  524.    address:
  525.  
  526.      1. An ARP request packet with a broadcast Ethernet address is sent
  527.         out on the network to every computer.
  528.  
  529.      2. The outgoing IP packet is queued.
  530.  
  531.    Every computer's Ethernet interface receives the broadcast Ethernet
  532.    frame.  Each Ethernet driver examines the Type field in the Ethernet
  533.    frame and passes the ARP packet to the ARP module.  The ARP request
  534.    packet says "If your IP address matches this target IP address, then
  535.    please tell me your Ethernet address".  An ARP request packet looks
  536.    something like this:
  537.  
  538.                 ---------------------------------------
  539.                 |Sender IP Address   223.1.2.1        |
  540.                 |Sender Enet Address 08-00-39-00-2F-C3|
  541.                 ---------------------------------------
  542.                 |Target IP Address   223.1.2.2        |
  543.                 |Target Enet Address <blank>          |
  544.                 ---------------------------------------
  545.                      TABLE 2.  Example ARP Request
  546.  
  547.    Each ARP module examines the IP address and if the Target IP address
  548.    matches its own IP address, it sends a response directly to the
  549.    source Ethernet address.  The ARP response packet says "Yes, that
  550.    target IP address is mine, let me give you my Ethernet address".  An
  551.    ARP response packet has the sender/target field contents swapped as
  552.    compared to the request.  It looks something like this:
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562. Socolofsky & Kale                                              [Page 10]
  563.  
  564. RFC 1180                   A TCP/IP Tutorial                January 1991
  565.  
  566.  
  567.                 ---------------------------------------
  568.                 |Sender IP Address   223.1.2.2        |
  569.                 |Sender Enet Address 08-00-28-00-38-A9|
  570.                 ---------------------------------------
  571.                 |Target IP Address   223.1.2.1        |
  572.                 |Target Enet Address 08-00-39-00-2F-C3|
  573.                 ---------------------------------------
  574.                      TABLE 3.  Example ARP Response
  575.  
  576.    The response is received by the original sender computer.  The
  577.    Ethernet driver looks at the Type field in the Ethernet frame then
  578.    passes the ARP packet to the ARP module.  The ARP module examines the
  579.    ARP packet and adds the sender's IP and Ethernet addresses to its ARP
  580.    table.
  581.  
  582.    The updated table now looks like this:
  583.  
  584.                    ----------------------------------
  585.                    |IP address     Ethernet address |
  586.                    ----------------------------------
  587.                    |223.1.2.1      08-00-39-00-2F-C3|
  588.                    |223.1.2.2      08-00-28-00-38-A9|
  589.                    |223.1.2.3      08-00-5A-21-A7-22|
  590.                    |223.1.2.4      08-00-10-99-AC-54|
  591.                    ----------------------------------
  592.                    TABLE 4.  ARP Table after Response
  593.  
  594. 4.4  Scenario Continued
  595.  
  596.    The new translation has now been installed automatically in the
  597.    table, just milli-seconds after it was needed.  As you remember from
  598.    step 2 above, the outgoing IP packet was queued.  Next, the IP
  599.    address to Ethernet address translation is performed by look-up in
  600.    the ARP table then the Ethernet frame is transmitted on the Ethernet.
  601.    Therefore, with the new steps 3, 4, and 5, the scenario for the
  602.    sender computer is:
  603.  
  604.      1. An ARP request packet with a broadcast Ethernet address is sent
  605.         out on the network to every computer.
  606.  
  607.      2. The outgoing IP packet is queued.
  608.  
  609.      3. The ARP response arrives with the IP-to-Ethernet address
  610.         translation for the ARP table.
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618. Socolofsky & Kale                                              [Page 11]
  619.  
  620. RFC 1180                   A TCP/IP Tutorial                January 1991
  621.  
  622.  
  623.      4. For the queued IP packet, the ARP table is used to translate the
  624.         IP address to the Ethernet address.
  625.  
  626.      5. The Ethernet frame is transmitted on the Ethernet.
  627.  
  628.    In summary, when the translation is missing from the ARP table, one
  629.    IP packet is queued.  The translation data is quickly filled in with
  630.    ARP request/response and the queued IP packet is transmitted.
  631.  
  632.    Each computer has a separate ARP table for each of its Ethernet
  633.    interfaces.  If the target computer does not exist, there will be no
  634.    ARP response and no entry in the ARP table.  IP will discard outgoing
  635.    IP packets sent to that address.  The upper layer protocols can't
  636.    tell the difference between a broken Ethernet and the absence of a
  637.    computer with the target IP address.
  638.  
  639.    Some implementations of IP and ARP don't queue the IP packet while
  640.    waiting for the ARP response.  Instead the IP packet is discarded and
  641.    the recovery from the IP packet loss is left to the TCP module or the
  642.    UDP network application.  This recovery is performed by time-out and
  643.    retransmission.  The retransmitted message is successfully sent out
  644.    onto the network because the first copy of the message has already
  645.    caused the ARP table to be filled.
  646.  
  647. 5.  Internet Protocol
  648.  
  649.    The IP module is central to internet technology and the essence of IP
  650.    is its route table.  IP uses this in-memory table to make all
  651.    decisions about routing an IP packet.  The content of the route table
  652.    is defined by the network administrator.  Mistakes block
  653.    communication.
  654.  
  655.    To understand how a route table is used is to understand
  656.    internetworking.  This understanding is necessary for the successful
  657.    administration and maintenance of an IP network.
  658.  
  659.    The route table is best understood by first having an overview of
  660.    routing, then learning about IP network addresses, and then looking
  661.    at the details.
  662.  
  663. 5.1  Direct Routing
  664.  
  665.    The figure below is of a tiny internet with 3 computers: A, B, and C.
  666.    Each computer has the same TCP/IP protocol stack as in Figure 1.
  667.    Each computer's Ethernet interface has its own Ethernet address.
  668.    Each computer has an IP address assigned to the IP interface by the
  669.    network manager, who also has assigned an IP network number to the
  670.    Ethernet.
  671.  
  672.  
  673.  
  674. Socolofsky & Kale                                              [Page 12]
  675.  
  676. RFC 1180                   A TCP/IP Tutorial                January 1991
  677.  
  678.  
  679.                           A      B      C
  680.                           |      |      |
  681.                         --o------o------o--
  682.                         Ethernet 1
  683.                         IP network "development"
  684.  
  685.                        Figure 6.  One IP Network
  686.  
  687.    When A sends an IP packet to B, the IP header contains A's IP address
  688.    as the source IP address, and the Ethernet header contains A's
  689.    Ethernet address as the source Ethernet address.  Also, the IP header
  690.    contains B's IP address as the destination IP address and the
  691.    Ethernet header contains B's Ethernet address as the destination
  692.    Ethernet address.
  693.  
  694.                 ----------------------------------------
  695.                 |address            source  destination|
  696.                 ----------------------------------------
  697.                 |IP header          A       B          |
  698.                 |Ethernet header    A       B          |
  699.                 ----------------------------------------
  700.        TABLE 5.  Addresses in an Ethernet frame for an IP packet
  701.                               from A to B
  702.  
  703.    For this simple case, IP is overhead because the IP adds little to
  704.    the service offered by Ethernet.  However, IP does add cost: the
  705.    extra CPU processing and network bandwidth to generate, transmit, and
  706.    parse the IP header.
  707.  
  708.    When B's IP module receives the IP packet from A, it checks the
  709.    destination IP address against its own, looking for a match, then it
  710.    passes the datagram to the upper-level protocol.
  711.  
  712.    This communication between A and B uses direct routing.
  713.  
  714. 5.2  Indirect Routing
  715.  
  716.    The figure below is a more realistic view of an internet.  It is
  717.    composed of 3 Ethernets and 3 IP networks connected by an IP-router
  718.    called computer D.  Each IP network has 4 computers; each computer
  719.    has its own IP address and Ethernet address.
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Socolofsky & Kale                                              [Page 13]
  731.  
  732. RFC 1180                   A TCP/IP Tutorial                January 1991
  733.  
  734.  
  735.           A      B      C      ----D----      E      F      G
  736.           |      |      |      |   |   |      |      |      |
  737.         --o------o------o------o-  |  -o------o------o------o--
  738.         Ethernet 1                 |  Ethernet 2
  739.         IP network "development"   |  IP network "accounting"
  740.                                    |
  741.                                    |
  742.                                    |     H      I      J
  743.                                    |     |      |      |
  744.                                  --o-----o------o------o--
  745.                                   Ethernet 3
  746.                                   IP network "factory"
  747.  
  748.                Figure 7.  Three IP Networks; One internet
  749.  
  750.    Except for computer D, each computer has a TCP/IP protocol stack like
  751.    that in Figure 1.  Computer D is the IP-router; it is connected to
  752.    all 3 networks and therefore has 3 IP addresses and 3 Ethernet
  753.    addresses.  Computer D has a TCP/IP protocol stack similar to that in
  754.    Figure 3, except that it has 3 ARP modules and 3 Ethernet drivers
  755.    instead of 2.  Please note that computer D has only one IP module.
  756.  
  757.    The network manager has assigned a unique number, called an IP
  758.    network number, to each of the Ethernets.  The IP network numbers are
  759.    not shown in this diagram, just the network names.
  760.  
  761.    When computer A sends an IP packet to computer B, the process is
  762.    identical to the single network example above.  Any communication
  763.    between computers located on a single IP network matches the direct
  764.    routing example discussed previously.
  765.  
  766.    When computer D and A communicate, it is direct communication.  When
  767.    computer D and E communicate, it is direct communication.  When
  768.    computer D and H communicate, it is direct communication.  This is
  769.    because each of these pairs of computers is on the same IP network.
  770.  
  771.    However, when computer A communicates with a computer on the far side
  772.    of the IP-router, communication is no longer direct.  A must use D to
  773.    forward the IP packet to the next IP network.  This communication is
  774.    called "indirect".
  775.  
  776.    This routing of IP packets is done by IP modules and happens
  777.    transparently to TCP, UDP, and the network applications.
  778.  
  779.    If A sends an IP packet to E, the source IP address and the source
  780.    Ethernet address are A's.  The destination IP address is E's, but
  781.    because A's IP module sends the IP packet to D for forwarding, the
  782.    destination Ethernet address is D's.
  783.  
  784.  
  785.  
  786. Socolofsky & Kale                                              [Page 14]
  787.  
  788. RFC 1180                   A TCP/IP Tutorial                January 1991
  789.  
  790.  
  791.                 ----------------------------------------
  792.                 |address            source  destination|
  793.                 ----------------------------------------
  794.                 |IP header          A       E          |
  795.                 |Ethernet header    A       D          |
  796.                 ----------------------------------------
  797.        TABLE 6.  Addresses in an Ethernet frame for an IP packet
  798.                          from A to E (before D)
  799.  
  800.    D's IP module receives the IP packet and upon examining the
  801.    destination IP address, says "This is not my IP address," and sends
  802.    the IP packet directly to E.
  803.  
  804.                 ----------------------------------------
  805.                 |address            source  destination|
  806.                 ----------------------------------------
  807.                 |IP header          A       E          |
  808.                 |Ethernet header    D       E          |
  809.                 ----------------------------------------
  810.        TABLE 7.  Addresses in an Ethernet frame for an IP packet
  811.                          from A to E (after D)
  812.  
  813.    In summary, for direct communication, both the source IP address and
  814.    the source Ethernet address is the sender's, and the destination IP
  815.    address and the destination Ethernet address is the recipient's.  For
  816.    indirect communication, the IP address and Ethernet addresses do not
  817.    pair up in this way.
  818.  
  819.    This example internet is a very simple one.  Real networks are often
  820.    complicated by many factors, resulting in multiple IP-routers and
  821.    several types of physical networks.  This example internet might have
  822.    come about because the network manager wanted to split a large
  823.    Ethernet in order to localize Ethernet broadcast traffic.
  824.  
  825. 5.3  IP Module Routing Rules
  826.  
  827.    This overview of routing has shown what happens, but not how it
  828.    happens.  Now let's examine the rules, or algorithm, used by the IP
  829.    module.
  830.  
  831.      For an outgoing IP packet, entering IP from an upper layer, IP must
  832.      decide whether to send the IP packet directly or indirectly, and IP
  833.      must choose a lower network interface.  These choices are made by
  834.      consulting the route table.
  835.  
  836.      For an incoming IP packet, entering IP from a lower interface, IP
  837.      must decide whether to forward the IP packet or pass it to an upper
  838.      layer.  If the IP packet is being forwarded, it is treated as an
  839.  
  840.  
  841.  
  842. Socolofsky & Kale                                              [Page 15]
  843.  
  844. RFC 1180                   A TCP/IP Tutorial                January 1991
  845.  
  846.  
  847.      outgoing IP packet.
  848.  
  849.      When an incoming IP packet arrives it is never forwarded back out
  850.      through the same network interface.
  851.  
  852.    These decisions are made before the IP packet is handed to the lower
  853.    interface and before the ARP table is consulted.
  854.  
  855. 5.4  IP Address
  856.  
  857.    The network manager assigns IP addresses to computers according to
  858.    the IP network to which the computer is attached.  One part of a 4-
  859.    byte IP address is the IP network number, the other part is the IP
  860.    computer number (or host number).  For the computer in table 1, with
  861.    an IP address of 223.1.2.1, the network number is 223.1.2 and the
  862.    host number is number 1.
  863.  
  864.    The portion of the address that is used for network number and for
  865.    host number is defined by the upper bits in the 4-byte address.  All
  866.    example IP addresses in this tutorial are of type class C, meaning
  867.    that the upper 3 bits indicate that 21 bits are the network number
  868.    and 8 bits are the host number.  This allows 2,097,152 class C
  869.    networks up to 254 hosts on each network.
  870.  
  871.    The IP address space is administered by the NIC (Network Information
  872.    Center).  All internets that are connected to the single world-wide
  873.    Internet must use network numbers assigned by the NIC.  If you are
  874.    setting up your own internet and you are not intending to connect it
  875.    to the Internet, you should still obtain your network numbers from
  876.    the NIC.  If you pick your own number, you run the risk of confusion
  877.    and chaos in the eventuality that your internet is connected to
  878.    another internet.
  879.  
  880. 5.5  Names
  881.  
  882.    People refer to computers by names, not numbers.  A computer called
  883.    alpha might have the IP address of 223.1.2.1.  For small networks,
  884.    this name-to-address translation data is often kept on each computer
  885.    in the "hosts" file.  For larger networks, this translation data file
  886.    is stored on a server and accessed across the network when needed.  A
  887.    few lines from that file might look like this:
  888.  
  889.    223.1.2.1     alpha
  890.    223.1.2.2     beta
  891.    223.1.2.3     gamma
  892.    223.1.2.4     delta
  893.    223.1.3.2     epsilon
  894.    223.1.4.2     iota
  895.  
  896.  
  897.  
  898. Socolofsky & Kale                                              [Page 16]
  899.  
  900. RFC 1180                   A TCP/IP Tutorial                January 1991
  901.  
  902.  
  903.    The IP address is the first column and the computer name is the
  904.    second column.
  905.  
  906.    In most cases, you can install identical "hosts" files on all
  907.    computers.  You may notice that "delta" has only one entry in this
  908.    file even though it has 3 IP addresses.  Delta can be reached with
  909.    any of its IP addresses; it does not matter which one is used.  When
  910.    delta receives an IP packet and looks at the destination address, it
  911.    will recognize any of its own IP addresses.
  912.  
  913.    IP networks are also given names.  If you have 3 IP networks, your
  914.    "networks" file for documenting these names might look something like
  915.    this:
  916.  
  917.    223.1.2     development
  918.    223.1.3     accounting
  919.    223.1.4     factory
  920.  
  921.    The IP network number is in the first column and its name is in the
  922.    second column.
  923.  
  924.    From this example you can see that alpha is computer number 1 on the
  925.    development network, beta is computer number 2 on the development
  926.    network and so on.  You might also say that alpha is development.1,
  927.    Beta is development.2, and so on.
  928.  
  929.    The above hosts file is adequate for the users, but the network
  930.    manager will probably replace the line for delta with:
  931.  
  932.    223.1.2.4     devnetrouter    delta
  933.    223.1.3.1     facnetrouter
  934.    223.1.4.1     accnetrouter
  935.  
  936.    These three new lines for the hosts file give each of delta's IP
  937.    addresses a meaningful name.  In fact, the first IP address listed
  938.    has 2 names; "delta" and "devnetrouter" are synonyms.  In practice
  939.    "delta" is the general-purpose name of the computer and the other 3
  940.    names are only used when administering the IP route table.
  941.  
  942.    These files are used by network administration commands and network
  943.    applications to provide meaningful names.  They are not required for
  944.    operation of an internet, but they do make it easier for us.
  945.  
  946. 5.6  IP Route Table
  947.  
  948.    How does IP know which lower network interface to use when sending
  949.    out a IP packet?  IP looks it up in the route table using a search
  950.    key of the IP network number extracted from the IP destination
  951.  
  952.  
  953.  
  954. Socolofsky & Kale                                              [Page 17]
  955.  
  956. RFC 1180                   A TCP/IP Tutorial                January 1991
  957.  
  958.  
  959.    address.
  960.  
  961.    The route table contains one row for each route.  The primary columns
  962.    in the route table are:  IP network number, direct/indirect flag,
  963.    router IP address, and interface number.  This table is referred to
  964.    by IP for each outgoing IP packet.
  965.  
  966.    On most computers the route table can be modified with the "route"
  967.    command.  The content of the route table is defined by the network
  968.    manager, because the network manager assigns the IP addresses to the
  969.    computers.
  970.  
  971. 5.7  Direct Routing Details
  972.  
  973.    To explain how it is used, let us visit in detail the routing
  974.    situations we have reviewed previously.
  975.  
  976.                         ---------         ---------
  977.                         | alpha |         | beta  |
  978.                         |    1  |         |  1    |
  979.                         ---------         ---------
  980.                              |               |
  981.                      --------o---------------o-
  982.                       Ethernet 1
  983.                       IP network "development"
  984.  
  985.                Figure 8.  Close-up View of One IP Network
  986.  
  987.    The route table inside alpha looks like this:
  988.  
  989.      --------------------------------------------------------------
  990.      |network      direct/indirect flag  router   interface number|
  991.      --------------------------------------------------------------
  992.      |development  direct                <blank>  1               |
  993.      --------------------------------------------------------------
  994.                   TABLE 8.  Example Simple Route Table
  995.  
  996.    This view can be seen on some UNIX systems with the "netstat -r"
  997.    command.  With this simple network, all computers have identical
  998.    routing tables.
  999.  
  1000.    For discussion, the table is printed again without the network number
  1001.    translated to its network name.
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010. Socolofsky & Kale                                              [Page 18]
  1011.  
  1012. RFC 1180                   A TCP/IP Tutorial                January 1991
  1013.  
  1014.  
  1015.      --------------------------------------------------------------
  1016.      |network      direct/indirect flag  router   interface number|
  1017.      --------------------------------------------------------------
  1018.      |223.1.2      direct                <blank>  1               |
  1019.      --------------------------------------------------------------
  1020.            TABLE 9.  Example Simple Route Table with Numbers
  1021.  
  1022. 5.8  Direct Scenario
  1023.  
  1024.    Alpha is sending an IP packet to beta.  The IP packet is in alpha's
  1025.    IP module and the destination IP address is beta or 223.1.2.2.  IP
  1026.    extracts the network portion of this IP address and scans the first
  1027.    column of the table looking for a match.  With this network a match
  1028.    is found on the first entry.
  1029.  
  1030.    The other information in this entry indicates that computers on this
  1031.    network can be reached directly through interface number 1.  An ARP
  1032.    table translation is done on beta's IP address then the Ethernet
  1033.    frame is sent directly to beta via interface number 1.
  1034.  
  1035.    If an application tries to send data to an IP address that is not on
  1036.    the development network, IP will be unable to find a match in the
  1037.    route table.  IP then discards the IP packet.  Some computers provide
  1038.    a "Network not reachable" error message.
  1039.  
  1040. 5.9  Indirect Routing Details
  1041.  
  1042.    Now, let's take a closer look at the more complicated routing
  1043.    scenario that we examined previously.
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Socolofsky & Kale                                              [Page 19]
  1067.  
  1068. RFC 1180                   A TCP/IP Tutorial                January 1991
  1069.  
  1070.  
  1071.           ---------           ---------           ---------
  1072.           | alpha |           | delta |           |epsilon|
  1073.           |    1  |           |1  2  3|           |   1   |
  1074.           ---------           ---------           ---------
  1075.                |               |  |  |                |
  1076.        --------o---------------o- | -o----------------o--------
  1077.         Ethernet 1                |     Ethernet 2
  1078.         IP network "Development"  |     IP network "accounting"
  1079.                                   |
  1080.                                   |     --------
  1081.                                   |     | iota |
  1082.                                   |     |  1   |
  1083.                                   |     --------
  1084.                                   |        |
  1085.                                 --o--------o--------
  1086.                                     Ethernet 3
  1087.                                     IP network "factory"
  1088.  
  1089.              Figure 9.  Close-up View of Three IP Networks
  1090.  
  1091.    The route table inside alpha looks like this:
  1092.  
  1093.  ---------------------------------------------------------------------
  1094.  |network      direct/indirect flag  router          interface number|
  1095.  ---------------------------------------------------------------------
  1096.  |development  direct                <blank>         1               |
  1097.  |accounting   indirect              devnetrouter    1               |
  1098.  |factory      indirect              devnetrouter    1               |
  1099.  ---------------------------------------------------------------------
  1100.                       TABLE 10.  Alpha Route Table
  1101.  
  1102.    For discussion the table is printed again using numbers instead of
  1103.    names.
  1104.  
  1105.   --------------------------------------------------------------------
  1106.   |network      direct/indirect flag  router         interface number|
  1107.   --------------------------------------------------------------------
  1108.   |223.1.2      direct                <blank>        1               |
  1109.   |223.1.3      indirect              223.1.2.4      1               |
  1110.   |223.1.4      indirect              223.1.2.4      1               |
  1111.   --------------------------------------------------------------------
  1112.                TABLE 11.  Alpha Route Table with Numbers
  1113.  
  1114.    The router in Alpha's route table is the IP address of delta's
  1115.    connection to the development network.
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122. Socolofsky & Kale                                              [Page 20]
  1123.  
  1124. RFC 1180                   A TCP/IP Tutorial                January 1991
  1125.  
  1126.  
  1127. 5.10  Indirect Scenario
  1128.  
  1129.    Alpha is sending an IP packet to epsilon.  The IP packet is in
  1130.    alpha's IP module and the destination IP address is epsilon
  1131.    (223.1.3.2).  IP extracts the network portion of this IP address
  1132.    (223.1.3) and scans the first column of the table looking for a
  1133.    match.  A match is found on the second entry.
  1134.  
  1135.    This entry indicates that computers on the 223.1.3 network can be
  1136.    reached through the IP-router devnetrouter.  Alpha's IP module then
  1137.    does an ARP table translation for devnetrouter's IP address and sends
  1138.    the IP packet directly to devnetrouter through Alpha's interface
  1139.    number 1.  The IP packet still contains the destination address of
  1140.    epsilon.
  1141.  
  1142.    The IP packet arrives at delta's development network interface and is
  1143.    passed up to delta's IP module.  The destination IP address is
  1144.    examined and because it does not match any of delta's own IP
  1145.    addresses, delta decides to forward the IP packet.
  1146.  
  1147.    Delta's IP module extracts the network portion of the destination IP
  1148.    address (223.1.3) and scans its route table for a matching network
  1149.    field.  Delta's route table looks like this:
  1150.  
  1151.  ----------------------------------------------------------------------
  1152.  |network      direct/indirect flag  router           interface number|
  1153.  ----------------------------------------------------------------------
  1154.  |development  direct                <blank>          1               |
  1155.  |factory      direct                <blank>          3               |
  1156.  |accounting   direct                <blank>          2               |
  1157.  ----------------------------------------------------------------------
  1158.                      TABLE 12.  Delta's Route Table
  1159.  
  1160.    Below is delta's table printed again, without the translation to
  1161.    names.
  1162.  
  1163.  ----------------------------------------------------------------------
  1164.  |network      direct/indirect flag  router           interface number|
  1165.  ----------------------------------------------------------------------
  1166.  |223.1.2      direct                <blank>          1               |
  1167.  |223.1.3      direct                <blank>          3               |
  1168.  |223.1.4      direct                <blank>          2               |
  1169.  ----------------------------------------------------------------------
  1170.               TABLE 13.  Delta's Route Table with Numbers
  1171.  
  1172.    The match is found on the second entry.  IP then sends the IP packet
  1173.    directly to epsilon through interface number 3.  The IP packet
  1174.    contains the IP destination address of epsilon and the Ethernet
  1175.  
  1176.  
  1177.  
  1178. Socolofsky & Kale                                              [Page 21]
  1179.  
  1180. RFC 1180                   A TCP/IP Tutorial                January 1991
  1181.  
  1182.  
  1183.    destination address of epsilon.
  1184.  
  1185.    The IP packet arrives at epsilon and is passed up to epsilon's IP
  1186.    module.  The destination IP address is examined and found to match
  1187.    with epsilon's IP address, so the IP packet is passed to the upper
  1188.    protocol layer.
  1189.  
  1190. 5.11  Routing Summary
  1191.  
  1192.    When a IP packet travels through a large internet it may go through
  1193.    many IP-routers before it reaches its destination.  The path it takes
  1194.    is not determined by a central source but is a result of consulting
  1195.    each of the routing tables used in the journey.  Each computer
  1196.    defines only the next hop in the journey and relies on that computer
  1197.    to send the IP packet on its way.
  1198.  
  1199. 5.12  Managing the Routes
  1200.  
  1201.    Maintaining correct routing tables on all computers in a large
  1202.    internet is a difficult task; network configuration is being modified
  1203.    constantly by the network managers to meet changing needs.  Mistakes
  1204.    in routing tables can block communication in ways that are
  1205.    excruciatingly tedious to diagnose.
  1206.  
  1207.    Keeping a simple network configuration goes a long way towards making
  1208.    a reliable internet.  For instance, the most straightforward method
  1209.    of assigning IP networks to Ethernet is to assign a single IP network
  1210.    number to each Ethernet.
  1211.  
  1212.    Help is also available from certain protocols and network
  1213.    applications.  ICMP (Internet Control Message Protocol) can report
  1214.    some routing problems.  For small networks the route table is filled
  1215.    manually on each computer by the network administrator.  For larger
  1216.    networks the network administrator automates this manual operation
  1217.    with a routing protocol to distribute routes throughout a network.
  1218.  
  1219.    When a computer is moved from one IP network to another, its IP
  1220.    address must change.  When a computer is removed from an IP network
  1221.    its old address becomes invalid.  These changes require frequent
  1222.    updates to the "hosts" file.  This flat file can become difficult to
  1223.    maintain for even medium-size networks.  The Domain Name System helps
  1224.    solve these problems.
  1225.  
  1226. 6.  User Datagram Protocol
  1227.  
  1228.    UDP is one of the two main protocols to reside on top of IP.  It
  1229.    offers service to the user's network applications.  Example network
  1230.    applications that use UDP are:  Network File System (NFS) and Simple
  1231.  
  1232.  
  1233.  
  1234. Socolofsky & Kale                                              [Page 22]
  1235.  
  1236. RFC 1180                   A TCP/IP Tutorial                January 1991
  1237.  
  1238.  
  1239.    Network Management Protocol (SNMP).  The service is little more than
  1240.    an interface to IP.
  1241.  
  1242.    UDP is a connectionless datagram delivery service that does not
  1243.    guarantee delivery.  UDP does not maintain an end-to-end connection
  1244.    with the remote UDP module; it merely pushes the datagram out on the
  1245.    net and accepts incoming datagrams off the net.
  1246.  
  1247.    UDP adds two values to what is provided by IP.  One is the
  1248.    multiplexing of information between applications based on port
  1249.    number.  The other is a checksum to check the integrity of the data.
  1250.  
  1251. 6.1  Ports
  1252.  
  1253.    How does a client on one computer reach the server on another?
  1254.  
  1255.    The path of communication between an application and UDP is through
  1256.    UDP ports.  These ports are numbered, beginning with zero.  An
  1257.    application that is offering service (the server) waits for messages
  1258.    to come in on a specific port dedicated to that service.  The server
  1259.    waits patiently for any client to request service.
  1260.  
  1261.    For instance, the SNMP server, called an SNMP agent, always waits on
  1262.    port 161.  There can be only one SNMP agent per computer because
  1263.    there is only one UDP port number 161.  This port number is well
  1264.    known; it is a fixed number, an internet assigned number.  If an SNMP
  1265.    client wants service, it sends its request to port number 161 of UDP
  1266.    on the destination computer.
  1267.  
  1268.    When an application sends data out through UDP it arrives at the far
  1269.    end as a single unit.  For example, if an application does 5 writes
  1270.    to the UDP port, the application at the far end will do 5 reads from
  1271.    the UDP port.  Also, the size of each write matches the size of each
  1272.    read.
  1273.  
  1274.    UDP preserves the message boundary defined by the application.  It
  1275.    never joins two application messages together, or divides a single
  1276.    application message into parts.
  1277.  
  1278. 6.2  Checksum
  1279.  
  1280.    An incoming IP packet with an IP header type field indicating "UDP"
  1281.    is passed up to the UDP module by IP.  When the UDP module receives
  1282.    the UDP datagram from IP it examines the UDP checksum.  If the
  1283.    checksum is zero, it means that checksum was not calculated by the
  1284.    sender and can be ignored.  Thus the sending computer's UDP module
  1285.    may or may not generate checksums.  If Ethernet is the only network
  1286.    between the 2 UDP modules communicating, then you may not need
  1287.  
  1288.  
  1289.  
  1290. Socolofsky & Kale                                              [Page 23]
  1291.  
  1292. RFC 1180                   A TCP/IP Tutorial                January 1991
  1293.  
  1294.  
  1295.    checksumming.  However, it is recommended that checksum generation
  1296.    always be enabled because at some point in the future a route table
  1297.    change may send the data across less reliable media.
  1298.  
  1299.    If the checksum is valid (or zero), the destination port number is
  1300.    examined and if an application is bound to that port, an application
  1301.    message is queued for the application to read.  Otherwise the UDP
  1302.    datagram is discarded.  If the incoming UDP datagrams arrive faster
  1303.    than the application can read them and if the queue fills to a
  1304.    maximum value, UDP datagrams are discarded by UDP.  UDP will continue
  1305.    to discard UDP datagrams until there is space in the queue.
  1306.  
  1307. 7.  Transmission Control Protocol
  1308.  
  1309.    TCP provides a different service than UDP.  TCP offers a connection-
  1310.    oriented byte stream, instead of a connectionless datagram delivery
  1311.    service.  TCP guarantees delivery, whereas UDP does not.
  1312.  
  1313.    TCP is used by network applications that require guaranteed delivery
  1314.    and cannot be bothered with doing time-outs and retransmissions.  The
  1315.    two most typical network applications that use TCP are File Transfer
  1316.    Protocol (FTP) and the TELNET.  Other popular TCP network
  1317.    applications include X-Window System, rcp (remote copy), and the r-
  1318.    series commands.  TCP's greater capability is not without cost: it
  1319.    requires more CPU and network bandwidth.  The internals of the TCP
  1320.    module are much more complicated than those in a UDP module.
  1321.  
  1322.    Similar to UDP, network applications connect to TCP ports.  Well-
  1323.    defined port numbers are dedicated to specific applications.  For
  1324.    instance, the TELNET server uses port number 23.  The TELNET client
  1325.    can find the server simply by connecting to port 23 of TCP on the
  1326.    specified computer.
  1327.  
  1328.    When the application first starts using TCP, the TCP module on the
  1329.    client's computer and the TCP module on the server's computer start
  1330.    communicating with each other.  These two end-point TCP modules
  1331.    contain state information that defines a virtual circuit.  This
  1332.    virtual circuit consumes resources in both TCP end-points.  The
  1333.    virtual circuit is full duplex; data can go in both directions
  1334.    simultaneously.  The application writes data to the TCP port, the
  1335.    data traverses the network and is read by the application at the far
  1336.    end.
  1337.  
  1338.    TCP packetizes the byte stream at will; it does not retain the
  1339.    boundaries between writes.  For example, if an application does 5
  1340.    writes to the TCP port, the application at the far end might do 10
  1341.    reads to get all the data.  Or it might get all the data with a
  1342.    single read.  There is no correlation between the number and size of
  1343.  
  1344.  
  1345.  
  1346. Socolofsky & Kale                                              [Page 24]
  1347.  
  1348. RFC 1180                   A TCP/IP Tutorial                January 1991
  1349.  
  1350.  
  1351.    writes at one end to the number and size of reads at the other end.
  1352.  
  1353.    TCP is a sliding window protocol with time-out and retransmits.
  1354.    Outgoing data must be acknowledged by the far-end TCP.
  1355.    Acknowledgements can be piggybacked on data.  Both receiving ends can
  1356.    flow control the far end, thus preventing a buffer overrun.
  1357.  
  1358.    As with all sliding window protocols, the protocol has a window size.
  1359.    The window size determines the amount of data that can be transmitted
  1360.    before an acknowledgement is required.  For TCP, this amount is not a
  1361.    number of TCP segments but a number of bytes.
  1362.  
  1363. 8.  Network Applications
  1364.  
  1365.    Why do both TCP and UDP exist, instead of just one or the other?
  1366.  
  1367.    They supply different services.  Most applications are implemented to
  1368.    use only one or the other.  You, the programmer, choose the protocol
  1369.    that best meets your needs.  If you need a reliable stream delivery
  1370.    service, TCP might be best.  If you need a datagram service, UDP
  1371.    might be best.  If you need efficiency over long-haul circuits, TCP
  1372.    might be best.  If you need efficiency over fast networks with short
  1373.    latency, UDP might be best.  If your needs do not fall nicely into
  1374.    these categories, then the "best" choice is unclear.  However,
  1375.    applications can make up for deficiencies in the choice.  For
  1376.    instance if you choose UDP and you need reliability, then the
  1377.    application must provide reliability.  If you choose TCP and you need
  1378.    a record oriented service, then the application must insert markers
  1379.    in the byte stream to delimit records.
  1380.  
  1381.    What network applications are available?
  1382.  
  1383.    There are far too many to list.  The number is growing continually.
  1384.    Some of the applications have existed since the beginning of internet
  1385.    technology: TELNET and FTP.  Others are relatively new: X-Windows and
  1386.    SNMP.  The following is a brief description of the applications
  1387.    mentioned in this tutorial.
  1388.  
  1389. 8.1  TELNET
  1390.  
  1391.    TELNET provides a remote login capability on TCP.  The operation and
  1392.    appearance is similar to keyboard dialing through a telephone switch.
  1393.    On the command line the user types "telnet delta" and receives a
  1394.    login prompt from the computer called "delta".
  1395.  
  1396.    TELNET works well; it is an old application and has widespread
  1397.    interoperability.  Implementations of TELNET usually work between
  1398.    different operating systems.  For instance, a TELNET client may be on
  1399.  
  1400.  
  1401.  
  1402. Socolofsky & Kale                                              [Page 25]
  1403.  
  1404. RFC 1180                   A TCP/IP Tutorial                January 1991
  1405.  
  1406.  
  1407.    VAX/VMS and the server on UNIX System V.
  1408.  
  1409. 8.2  FTP
  1410.  
  1411.    File Transfer Protocol (FTP), as old as TELNET, also uses TCP and has
  1412.    widespread interoperability.  The operation and appearance is as if
  1413.    you TELNETed to the remote computer.  But instead of typing your
  1414.    usual commands, you have to make do with a short list of commands for
  1415.    directory listings and the like.  FTP commands allow you to copy
  1416.    files between computers.
  1417.  
  1418. 8.3  rsh
  1419.  
  1420.    Remote shell (rsh or remsh) is one of an entire family of remote UNIX
  1421.    style commands.  The UNIX copy command, cp, becomes rcp.  The UNIX
  1422.    "who is logged in" command, who, becomes rwho.  The list continues
  1423.    and is referred to collectively to as the "r" series commands or the
  1424.    "r*" (r star) commands.
  1425.  
  1426.    The r* commands mainly work between UNIX systems and are designed for
  1427.    interaction between trusted hosts.  Little consideration is given to
  1428.    security, but they provide a convenient user environment.
  1429.  
  1430.    To execute the "cc file.c" command on a remote computer called delta,
  1431.    type "rsh delta cc file.c".  To copy the "file.c" file to delta, type
  1432.    "rcp file.c delta:".  To login to delta, type "rlogin delta", and if
  1433.    you administered the computers in a certain way, you will not be
  1434.    challenged with a password prompt.
  1435.  
  1436. 8.4  NFS
  1437.  
  1438.    Network File System, first developed by Sun Microsystems Inc, uses
  1439.    UDP and is excellent for mounting UNIX file systems on multiple
  1440.    computers.  A diskless workstation can access its server's hard disk
  1441.    as if the disk were local to the workstation.  A single disk copy of
  1442.    a database on mainframe "alpha" can also be used by mainframe "beta"
  1443.    if the database's file system is NFS mounted on "beta".
  1444.  
  1445.    NFS adds significant load to a network and has poor utility across
  1446.    slow links, but the benefits are strong.  The NFS client is
  1447.    implemented in the kernel, allowing all applications and commands to
  1448.    use the NFS mounted disk as if it were local disk.
  1449.  
  1450. 8.5  SNMP
  1451.  
  1452.    Simple Network Management Protocol (SNMP) uses UDP and is designed
  1453.    for use by central network management stations.  It is a well known
  1454.    fact that if given enough data, a network manager can detect and
  1455.  
  1456.  
  1457.  
  1458. Socolofsky & Kale                                              [Page 26]
  1459.  
  1460. RFC 1180                   A TCP/IP Tutorial                January 1991
  1461.  
  1462.  
  1463.    diagnose network problems.  The central station uses SNMP to collect
  1464.    this data from other computers on the network.  SNMP defines the
  1465.    format for the data; it is left to the central station or network
  1466.    manager to interpret the data.
  1467.  
  1468. 8.6  X-Window
  1469.  
  1470.    The X Window System uses the X Window protocol on TCP to draw windows
  1471.    on a workstation's bitmap display.  X Window is much more than a
  1472.    utility for drawing windows; it is entire philosophy for designing a
  1473.    user interface.
  1474.  
  1475. 9.  Other Information
  1476.  
  1477.    Much information about internet technology was not included in this
  1478.    tutorial.  This section lists information that is considered the next
  1479.    level of detail for the reader who wishes to learn more.
  1480.  
  1481.      o administration commands: arp, route, and netstat
  1482.      o ARP: permanent entry, publish entry, time-out entry, spoofing
  1483.      o IP route table: host entry, default gateway, subnets
  1484.      o IP: time-to-live counter, fragmentation, ICMP
  1485.      o RIP, routing loops
  1486.      o Domain Name System
  1487.  
  1488. 10.  References
  1489.  
  1490.    [1] Comer, D., "Internetworking with TCP/IP Principles, Protocols,
  1491.        and Architecture", Prentice Hall, Englewood Cliffs, New Jersey,
  1492.        U.S.A., 1988.
  1493.  
  1494.    [2] Feinler, E., et al, DDN Protocol Handbook, Volume 2 and 3, DDN
  1495.        Network Information Center, SRI International, 333 Ravenswood
  1496.        Avenue, Room EJ291, Menlow Park, California, U.S.A., 1985.
  1497.  
  1498.    [3] Spider Systems, Ltd., "Packets and Protocols", Spider Systems
  1499.        Ltd., Stanwell Street, Edinburgh, U.K. EH6 5NG, 1990.
  1500.  
  1501. 11.  Relation to other RFCs
  1502.  
  1503.    This RFC is a tutorial and it does not UPDATE or OBSOLETE any other
  1504.    RFC.
  1505.  
  1506. 12.  Security Considerations
  1507.  
  1508.    There are security considerations within the TCP/IP protocol suite.
  1509.    To some people these considerations are serious problems, to others
  1510.    they are not; it depends on the user requirements.
  1511.  
  1512.  
  1513.  
  1514. Socolofsky & Kale                                              [Page 27]
  1515.  
  1516. RFC 1180                   A TCP/IP Tutorial                January 1991
  1517.  
  1518.  
  1519.    This tutorial does not discuss these issues, but if you want to learn
  1520.    more you should start with the topic of ARP-spoofing, then use the
  1521.    "Security Considerations" section of RFC 1122 to lead you to more
  1522.    information.
  1523.  
  1524. 13.  Authors' Addresses
  1525.  
  1526.    Theodore John Socolofsky
  1527.    Spider Systems Limited
  1528.    Spider Park
  1529.    Stanwell Street
  1530.    Edinburgh EH6 5NG
  1531.    United Kingdom
  1532.  
  1533.    Phone:
  1534.      from UK        031-554-9424
  1535.      from USA 011-44-31-554-9424
  1536.    Fax:
  1537.      from UK        031-554-0649
  1538.      from USA 011-44-31-554-0649
  1539.  
  1540.    EMail: TEDS@SPIDER.CO.UK
  1541.  
  1542.  
  1543.    Claudia Jeanne Kale
  1544.    12 Gosford Place
  1545.    Edinburgh EH6 4BJ
  1546.    United Kingdom
  1547.  
  1548.    Phone:
  1549.      from UK        031-554-7432
  1550.      from USA 011-44-31-554-7432
  1551.  
  1552.    EMail: CLAUDIAK@SPIDER.CO.UK
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570. Socolofsky & Kale                                              [Page 28]
  1571.