home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / TCPIP.ZIP / PART2 < prev    next >
Text File  |  1987-07-13  |  44KB  |  828 lines

  1.  
  2.  
  3.  
  4. Now  that  we  know  how  to  open  connections, let's get back to the
  5. applications programs.  As mentioned earlier, once TCP  has  opened  a
  6. connection,  we  have  something  that might as well be a simple wire.
  7. All the hard parts are handled by TCP and IP.  However we  still  need
  8. some  agreement  as  to  what we send over this connection.  In effect
  9. this is simply an agreement on what set of  commands  the  application
  10. will  understand,  and  the  format  in  which  they  are  to be sent.
  11. Generally, what is sent is a combination of commands and data.    They
  12. use  context  to  differentiate.  For example, the mail protocol works
  13. like this: Your mail program opens a connection to the mail server  at
  14. the  other end.  Your program gives it your machine's name, the sender
  15. of the message, and the recipients you want it sent to.  It then sends
  16. a  command saying that it is starting the message.  At that point, the
  17. other end  stops  treating  what  it  sees  as  commands,  and  starts
  18. accepting  the  message.  Your end then starts sending the text of the
  19. message.  At the end of the message, a special mark is sent (a dot  in
  20. the first column).  After that, both ends understand that your program
  21. is again sending commands.  This is the simplest way to do things, and
  22. the one that most applications use.
  23.  
  24. File  transfer  is  somewhat more complex.  The file transfer protocol
  25. involves two different connections.  It starts  out  just  like  mail.
  26. The user's program sends commands like "log me in as this user", "here
  27. is my password", "send me the file with this name".  However once  the
  28. command  to  send  data is sent, a second connection is opened for the
  29. data itself.  It would certainly be possible to send the data  on  the
  30. same  connection,  as  mail does.  However file transfers often take a
  31. long time.  The designers of the  file  transfer  protocol  wanted  to
  32. allow  the  user  to  continue  issuing commands while the transfer is
  33. going on.  For example, the user might make an inquiry,  or  he  might
  34. abort  the  transfer.    Thus  the designers felt it was best to use a
  35. separate connection for  the  data  and  leave  the  original  command
  36. connection  for  commands.    (It  is  also  possible  to open command
  37. connections to two different computers, and tell them to send  a  file
  38. from  one  to  the other.  In that case, the data couldn't go over the
  39. command connection.)
  40.  
  41. Remote terminal connections use another mechanism still.   For  remote
  42. logins,  there  is just one connection.  It normally sends data.  When
  43. it is necessary to send a command (e.g. to set the terminal type or to
  44. change  some  mode),  a special character is used to indicate that the
  45. next character is a command.  If the user happens to type that special
  46. character as data, two of them are sent.
  47.  
  48. We  are  not  going to describe the application protocols in detail in
  49. this document.  It's better to read the RFC's yourself.  However there
  50. are  a  couple of common conventions used by applications that will be
  51. described here.  First, the common network representation:  TCP/IP  is
  52. intended  to  be  usable  on  any  computer.    Unfortunately, not all
  53. computers agree on how data is represented.  There are differences  in
  54. character  codes  (ASCII  vs.  EBCDIC),  in  end  of  line conventions
  55. (carriage return, line feed, or a representation using counts), and in
  56. whether  terminals expect characters to be sent individually or a line
  57. at a time.   In  order  to  allow  computers  of  different  kinds  to
  58. communicate,   each   applications   protocol   defines   a   standard
  59.                                   14
  60.  
  61.  
  62.  
  63. representation.    Note  that  TCP  and  IP  do  not  care  about  the
  64. representation.    TCP  simply  sends octets.  However the programs at
  65. both ends have to agree on how the octets are to be interpreted.   The
  66. RFC  for  each  application  specifies the standard representation for
  67. that application.  Normally it  is  "net  ASCII".    This  uses  ASCII
  68. characters,  with end of line denoted by a carriage return followed by
  69. a line feed.  For remote login,  there  is  also  a  definition  of  a
  70. "standard terminal", which turns out to be a half-duplex terminal with
  71. echoing happening on the local machine.  Most applications  also  make
  72. provisions  for  the  two  computers to agree on other representations
  73. that they may find more convenient.  For example, PDP-10's have 36-bit
  74. words.    There  is a way that two PDP-10's can agree to send a 36-bit
  75. binary file.  Similarly, two systems that prefer full-duplex  terminal
  76. conversations  can  agree  on  that.    However each application has a
  77. standard representation, which every machine must support.
  78.  
  79.  
  80.  
  81. 3.1 An example application: SMTP
  82.  
  83.  
  84. In order to give a bit better idea what is involved in the application
  85. protocols,  I'm  going  to  show an example of SMTP, which is the mail
  86. protocol.  (SMTP is "simple mail transfer protocol.)  We assume that a
  87. computer called TOPAZ.RUTGERS.EDU wants to send the following message.
  88.  
  89.   Date: Sat, 27 Jun 87 13:26:31 EDT
  90.   From: hedrick@topaz.rutgers.edu
  91.   To: levy@red.rutgers.edu
  92.   Subject: meeting
  93.  
  94.   Let's get together Monday at 1pm.
  95.  
  96. First,  note  that the format of the message itself is described by an
  97. Internet standard (RFC 822).  The standard specifies the fact that the
  98. message  must be transmitted as net ASCII (i.e. it must be ASCII, with
  99. carriage return/linefeed to delimit lines).   It  also  describes  the
  100. general  structure, as a group of header lines, then a blank line, and
  101. then the body of the message.  Finally, it describes the syntax of the
  102. header  lines in detail.  Generally they consist of a keyword and then
  103. a value.
  104.  
  105. Note  that  the  addressee  is  indicated   as   LEVY@RED.RUTGERS.EDU.
  106. Initially,  addresses were simply "person at machine".  However recent
  107. standards have made things more flexible.  There  are  now  provisions
  108. for  systems  to handle other systems' mail.  This can allow automatic
  109. forwarding on behalf of computers not connected to the Internet.    It
  110. can be used to direct mail for a number of systems to one central mail
  111. server.  Indeed there is no requirement that an actual computer by the
  112. name  of RED.RUTGERS.EDU even exist.  The name servers could be set up
  113. so that you mail to department names, and each  department's  mail  is
  114. routed  automatically to an appropriate computer.  It is also possible
  115. that the part before the @ is something other than a user name.  It is
  116. possible  for  programs  to be set up to process mail.  There are also
  117. provisions  to  handle  mailing  lists,  and  generic  names  such  as
  118.                                   15
  119.  
  120.  
  121.  
  122. "postmaster" or "operator".
  123.  
  124. The  way  the  message is to be sent to another system is described by
  125. RFC's 821 and 974.  The program that is going to be doing the  sending
  126. asks  the  name server several queries to determine where to route the
  127. message.  The first query is to find out which  machines  handle  mail
  128. for  the  name RED.RUTGERS.EDU.  In this case, the server replies that
  129. RED.RUTGERS.EDU handles its own mail.  The program then asks  for  the
  130. address of RED.RUTGERS.EDU, which is 128.6.4.2.  Then the mail program
  131. opens a TCP connection to port 25  on  128.6.4.2.    Port  25  is  the
  132. well-known  socket  used  for receiving mail.  Once this connection is
  133. established, the mail program starts sending  commands.    Here  is  a
  134. typical  conversation.  Each line is labelled as to whether it is from
  135. TOPAZ or RED.  Note that TOPAZ initiated the connection:
  136.  
  137.     RED    220 RED.RUTGERS.EDU SMTP Service at 29 Jun 87 05:17:18 EDT
  138.     TOPAZ  HELO topaz.rutgers.edu
  139.     RED    250 RED.RUTGERS.EDU - Hello, TOPAZ.RUTGERS.EDU
  140.     TOPAZ  MAIL From:<hedrick@topaz.rutgers.edu>
  141.     RED    250 MAIL accepted
  142.     TOPAZ  RCPT To:<levy@red.rutgers.edu>
  143.     RED    250 Recipient accepted
  144.     TOPAZ  DATA
  145.     RED    354 Start mail input; end with <CRLF>.<CRLF>
  146.     TOPAZ  Date: Sat, 27 Jun 87 13:26:31 EDT
  147.     TOPAZ  From: hedrick@topaz.rutgers.edu
  148.     TOPAZ  To: levy@red.rutgers.edu
  149.     TOPAZ  Subject: meeting
  150.     TOPAZ
  151.     TOPAZ  Let's get together Monday at 1pm.
  152.     TOPAZ  .
  153.     RED    250 OK
  154.     TOPAZ  QUIT
  155.     RED    221 RED.RUTGERS.EDU Service closing transmission channel
  156.  
  157. First, note that commands all use normal text.  This is typical of the
  158. Internet  standards.    Many  of  the  protocols  use  standard  ASCII
  159. commands.  This makes it easy  to  watch  what  is  going  on  and  to
  160. diagnose  problems.  For example, the mail program keeps a log of each
  161. conversation.  If something goes wrong, the log  file  can  simply  be
  162. mailed  to  the  postmaster.  Since it is normal text, he can see what
  163. was going on.  It also allows a human to interact  directly  with  the
  164. mail  server,  for  testing.  (Some newer protocols are complex enough
  165. that this is not practical.  The commands would have to have a  syntax
  166. that would require a significant parser.  Thus there is a tendency for
  167. newer protocols to use binary formats.  Generally they are  structured
  168. like  C or Pascal record structures.)  Second, note that the responses
  169. all begin with numbers.  This is also typical of  Internet  protocols.
  170. The  allowable  responses  are  defined  in the protocol.  The numbers
  171. allow the user program to respond unambiguously.    The  rest  of  the
  172. response  is  text,  which is normally for use by any human who may be
  173. watching or looking at a log.  It has no effect on  the  operation  of
  174. the  programs.  (However there is one point at which the protocol uses
  175. part of the text of the response.)   The  commands  themselves  simply
  176. allow  the  mail  program  on  one  end  to  tell  the mail server the
  177.                                   16
  178.  
  179.  
  180.  
  181. information it needs to know in order to deliver the message.  In this
  182. case,  the  mail  server  could  get the information by looking at the
  183. message itself.  But for more complex cases, that would not  be  safe.
  184. Every  session  must  begin  with  a HELO, which gives the name of the
  185. system that initiated the connection.  Then the sender and  recipients
  186. are specified.  (There can be more than one RCPT command, if there are
  187. several recipients.)  Finally the data itself is sent.  Note that  the
  188. text  of the message is terminated by a line containing just a period.
  189. (If such a line appears in the message, the period is doubled.)  After
  190. the  message  is  accepted,  the  sender  can send another message, or
  191. terminate the session as in the example above.
  192.  
  193. Generally, there is a pattern to the response numbers.   The  protocol
  194. defines  the  specific set of responses that can be sent as answers to
  195. any given command.  However programs that don't want to  analyze  them
  196. in  detail  can  just  look at the first digit.  In general, responses
  197. that begin with a 2  indicate  success.    Those  that  begin  with  3
  198. indicate  that some further action is needed, as shown above.  4 and 5
  199. indicate errors.  4 is a "temporary" error, such as  a  disk  filling.
  200. The  message should be saved, and tried again later.  5 is a permanent
  201. error, such as a  non-existent  recipient.    The  message  should  be
  202. returned to the sender with an error message.
  203.  
  204. (For  more  details about the protocols mentioned in this section, see
  205. RFC's 821/822 for mail, RFC 959 for file transfer, and  RFC's  854/855
  206. for  remote  logins.  For the well-known port numbers, see the current
  207. edition of Assigned Numbers, and possibly RFC 814.)
  208.  
  209.  
  210.  
  211. 4. Protocols other than TCP: UDP and ICMP
  212.  
  213.  
  214. So far, we have described only connections that use TCP.  Recall  that
  215. TCP  is  responsible  for  breaking  up  messages  into datagrams, and
  216. reassembling them properly.  However in  many  applications,  we  have
  217. messages  that  will  always  fit in a single datagram.  An example is
  218. name lookup.  When a user attempts to make  a  connection  to  another
  219. system,  he  will  generally  specify  the system by name, rather than
  220. Internet address.  His system has to translate that name to an address
  221. before  it  can  do  anything.  Generally, only a few systems have the
  222. database used to translate names to addresses.  So the  user's  system
  223. will want to send a query to one of the systems that has the database.
  224. This query is going to be very short.  It will certainly  fit  in  one
  225. datagram.    So  will the answer.  Thus it seems silly to use TCP.  Of
  226. course TCP does more than just break things up  into  datagrams.    It
  227. also  makes  sure  that  the  data  arrives, resending datagrams where
  228. necessary.  But for a question that fits  in  a  single  datagram,  we
  229. don't  need  all the complexity of TCP to do this.  If we don't get an
  230. answer after a few seconds, we can just ask again.   For  applications
  231. like this, there are alternatives to TCP.
  232.  
  233. The most common alternative is UDP ("user datagram protocol").  UDP is
  234. designed for applications where you don't need  to  put  sequences  of
  235. datagrams  together.  It fits into the system much like TCP.  There is
  236.                                   17
  237.  
  238.  
  239.  
  240. a UDP header.  The network software puts the UDP header on  the  front
  241. of  your  data, just as it would put a TCP header on the front of your
  242. data.  Then UDP sends the data  to  IP,  which  adds  the  IP  header,
  243. putting  UDP's  protocol number in the protocol field instead of TCP's
  244. protocol number.  However UDP doesn't do as much  as  TCP  does.    It
  245. doesn't  split data into multiple datagrams.  It doesn't keep track of
  246. what it has sent so it can resend if necessary.  About  all  that  UDP
  247. provides  is  port  numbers,  so  that several programs can use UDP at
  248. once.  UDP port numbers are used just like TCP port  numbers.    There
  249. are  well-known  port numbers for servers that use UDP.  Note that the
  250. UDP header is shorter than a TCP header.   It  still  has  source  and
  251. destination  port  numbers,  and  a checksum, but that's about it.  No
  252. sequence number, since it is not needed.  UDP is used by the protocols
  253. that  handle  name  lookups (see IEN 116, RFC 882, and RFC 883), and a
  254. number of similar protocols.
  255.  
  256. Another  alternative  protocol  is  ICMP  ("Internet  control  message
  257. protocol").    ICMP  is  used  for  error messages, and other messages
  258. intended for the TCP/IP software itself, rather  than  any  particular
  259. user  program.  For example, if you attempt to connect to a host, your
  260. system may get back an ICMP message saying "host unreachable".    ICMP
  261. can  also be used to find out some information about the network.  See
  262. RFC 792 for details of ICMP.  ICMP is  similar  to  UDP,  in  that  it
  263. handles messages that fit in one datagram.  However it is even simpler
  264. than UDP.  It doesn't even have port numbers in its header.  Since all
  265. ICMP  messages are interpreted by the network software itself, no port
  266. numbers are needed to say where a ICMP message is supposed to go.
  267.  
  268.  
  269.  
  270. 5. Keeping track of names and information: the domain system
  271.  
  272.  
  273. As we indicated earlier, the network software generally needs a 32-bit
  274. Internet  address  in  order  to open a connection or send a datagram.
  275. However users prefer to deal with computer names rather than  numbers.
  276. Thus  there  is  a database that allows the software to look up a name
  277. and find the corresponding number.  When the Internet was small,  this
  278. was  easy.  Each system would have a file that listed all of the other
  279. systems, giving both their name and number.  There are  now  too  many
  280. computers  for  this  approach to be practical.  Thus these files have
  281. been replaced by a set of name servers that keep track of  host  names
  282. and  the corresponding Internet addresses.  (In fact these servers are
  283. somewhat more general than that.  This is just one kind of information
  284. stored in the domain system.)  Note that a set of interlocking servers
  285. are used, rather than a single central one.  There  are  now  so  many
  286. different  institutions  connected  to  the  Internet that it would be
  287. impractical for them to  notify  a  central  authority  whenever  they
  288. installed  or moved a computer.  Thus naming authority is delegated to
  289. individual institutions.  The name servers form a tree,  corresponding
  290. to  institutional  structure.    The names themselves follow a similar
  291. structure.  A typical example is the name BORAX.LCS.MIT.EDU.  This  is
  292. a  computer  at  the Laboratory for Computer Science (LCS) at MIT.  In
  293. order to find its Internet address,  you  might  potentially  have  to
  294. consult  4  different  servers.  First, you would ask a central server
  295.                                   18
  296.  
  297.  
  298.  
  299. (called the root) where the EDU server is.  EDU is a server that keeps
  300. track of educational institutions.  The root server would give you the
  301. names and Internet addresses of several servers for EDU.   (There  are
  302. several  servers  at  each  level,  to allow for the possibly that one
  303. might be down.)  You would then ask EDU where the server for  MIT  is.
  304. Again,  it  would  give  you  names  and Internet addresses of several
  305. servers for MIT.  Generally, not all of those servers would be at MIT,
  306. to  allow for the possibility of a general power failure at MIT.  Then
  307. you would ask MIT where the server for LCS is, and finally  you  would
  308. ask one of the LCS servers about BORAX.  The final result would be the
  309. Internet address for BORAX.LCS.MIT.EDU.    Each  of  these  levels  is
  310. referred  to  as  a  "domain".  The entire name, BORAX.LCS.MIT.EDU, is
  311. called a "domain name".    (So  are  the  names  of  the  higher-level
  312. domains, such as LCS.MIT.EDU, MIT.EDU, and EDU.)
  313.  
  314. Fortunately,  you  don't really have to go through all of this most of
  315. the time.  First of all, the root name servers also happen to  be  the
  316. name  servers  for  the  top-level domains such as EDU.  Thus a single
  317. query to a root  server  will  get  you  to  MIT.    Second,  software
  318. generally  remembers answers that it got before.  So once we look up a
  319. name at LCS.MIT.EDU, our software remembers where to find servers  for
  320. LCS.MIT.EDU,  MIT.EDU,  and EDU.  It also remembers the translation of
  321. BORAX.LCS.MIT.EDU.  Each of these pieces of information has a "time to
  322. live"  associated with it.  Typically this is a few days.  After that,
  323. the information expires and has to be looked up again.    This  allows
  324. institutions to change things.
  325.  
  326. The  domain  system  is not limited to finding out Internet addresses.
  327. Each domain name is a node in a database.  The node can  have  records
  328. that  define  a number of different properties.  Examples are Internet
  329. address, computer type, and a list of services provided by a computer.
  330. A  program  can  ask  for  a  specific  piece  of  information, or all
  331. information about a given name.  It is possible  for  a  node  in  the
  332. database  to  be  marked as an "alias" (or nickname) for another node.
  333. It is also possible to use the  domain  system  to  store  information
  334. about users, mailing lists, or other objects.
  335.  
  336. There  is  an  Internet  standard  defining  the  operation  of  these
  337. databases, as well as the protocols used  to  make  queries  of  them.
  338. Every  network utility has to be able to make such queries, since this
  339. is now the official way to evaluate host names.   Generally  utilities
  340. will talk to a server on their own system.  This server will take care
  341. of contacting the other servers for them.  This keeps down the  amount
  342. of code that has to be in each application program.
  343.  
  344. The  domain  system  is  particularly  important for handling computer
  345. mail.  There are entry types to define what computer handles mail  for
  346. a  given  name, to specify where an individual is to receive mail, and
  347. to define mailing lists.
  348.  
  349. (See RFC's 882, 883, and 973 for specifications of the domain  system.
  350. RFC 974 defines the use of the domain system in sending mail.)
  351.  
  352.  
  353.  
  354.                                   19
  355.  
  356.  
  357.  
  358. 6. Routing
  359.  
  360.  
  361. The   description  above  indicated  that  the  IP  implementation  is
  362. responsible for getting datagrams to the destination indicated by  the
  363. destination address, but little was said about how this would be done.
  364. The task of finding how to  get  a  datagram  to  its  destination  is
  365. referred to as "routing".  In fact many of the details depend upon the
  366. particular implementation.  However some general things can be said.
  367.  
  368. First, it is necessary to understand the model on which IP  is  based.
  369. IP assumes that a system is attached to some local network.  We assume
  370. that the system can send datagrams to any  other  system  on  its  own
  371. network.    (In  the  case  of  Ethernet, it simply finds the Ethernet
  372. address of the destination system, and puts the datagram  out  on  the
  373. Ethernet.)    The  problem  comes  when  a  system  is asked to send a
  374. datagram to a system on a different network.  This problem is  handled
  375. by  gateways.   A gateway is a system that connects a network with one
  376. or more other networks.  Gateways  are  often  normal  computers  that
  377. happen  to have more than one network interface.  For example, we have
  378. a Unix machine that has two different Ethernet interfaces.  Thus it is
  379. connected  to networks 128.6.4 and 128.6.3.  This machine can act as a
  380. gateway between those two networks.  The software on that machine must
  381. be  set  up  so that it will forward datagrams from one network to the
  382. other.  That is, if a machine on network 128.6.4 sends a  datagram  to
  383. the  gateway,  and  the  datagram is addressed to a machine on network
  384. 128.6.3, the gateway will forward the  datagram  to  the  destination.
  385. Major communications centers often have gateways that connect a number
  386. of different  networks.    (In  many  cases,  special-purpose  gateway
  387. systems provide better performance or reliability than general-purpose
  388. systems acting as gateways.  A number of vendors sell such systems.)
  389.  
  390. Routing in IP is  based  entirely  upon  the  network  number  of  the
  391. destination  address.    Each computer has a table of network numbers.
  392. For each network number, a gateway is listed.  This is the gateway  to
  393. be used to get to that network.  Note that the gateway doesn't have to
  394. connect directly to the network.  It just has to be the best place  to
  395. go  to  get there.  For example at Rutgers, our interface to NSFnet is
  396. at the John von Neuman Supercomputer Center (JvNC). Our connection  to
  397. JvNC  is  via  a  high-speed  serial line connected to a gateway whose
  398. address is 128.6.3.12.  Systems on net 128.6.3 will list 128.6.3.12 as
  399. the  gateway  for  many  off-campus  networks.  However systems on net
  400. 128.6.4 will list 128.6.4.1 as the gateway to  those  same  off-campus
  401. networks.    128.6.4.1  is  the  gateway  between networks 128.6.4 and
  402. 128.6.3, so it is the first step in getting to JvNC.
  403.  
  404. When a computer wants to send a datagram, it first checks  to  see  if
  405. the  destination address is on the system's own local network.  If so,
  406. the datagram can be sent directly.  Otherwise, the system  expects  to
  407. find an entry for the network that the destination address is on.  The
  408. datagram is sent to the gateway listed in that entry.  This table  can
  409. get quite big.  For example, the Internet now includes several hundred
  410. individual networks.  Thus various strategies have been  developed  to
  411. reduce  the size of the routing table.  One strategy is to depend upon
  412. "default routes".  Often, there is only one gateway out of a  network.
  413.                                   20
  414.  
  415.  
  416.  
  417. This  gateway might connect a local Ethernet to a campus-wide backbone
  418. network.  In that case, we don't need to have  a  separate  entry  for
  419. every  network  in  the  world.    We  simply define that gateway as a
  420. "default".  When no specific  route  is  found  for  a  datagram,  the
  421. datagram  is  sent to the default gateway.  A default gateway can even
  422. be used when there are several gateways  on  a  network.    There  are
  423. provisions  for  gateways  to  send a message saying "I'm not the best
  424. gateway -- use this one instead."  (The message is sent via ICMP.  See
  425. RFC  792.)  Most network software is designed to use these messages to
  426. add entries to their routing tables.  Suppose network 128.6.4 has  two
  427. gateways, 128.6.4.59 and 128.6.4.1.  128.6.4.59 leads to several other
  428. internal Rutgers networks.  128.6.4.1 leads indirectly to the  NSFnet.
  429. Suppose  we  set  128.6.4.59  as  a default gateway, and have no other
  430. routing table entries.  Now what  happens  when  we  need  to  send  a
  431. datagram  to  MIT?    MIT  is  network 18.  Since we have no entry for
  432. network 18, the datagram will be sent to the default, 128.6.4.59.   As
  433. it  happens,  this  gateway  is the wrong one.  So it will forward the
  434. datagram to 128.6.4.1.  But it will also send back an error saying  in
  435. effect: "to get to network 18, use 128.6.4.1".  Our software will then
  436. add an entry to the routing table.  Any future datagrams to  MIT  will
  437. then  go  directly to 128.6.4.1.  (The error message is sent using the
  438. ICMP protocol.  The message type is called "ICMP redirect.")
  439.  
  440. Most IP experts recommend that individual computers should not try  to
  441. keep  track  of  the  entire network.  Instead, they should start with
  442. default gateways, and let the gateways tell them the routes,  as  just
  443. described.   However this doesn't say how the gateways should find out
  444. about the routes.  The gateways can't depend upon this strategy.  They
  445. have  to  have fairly complete routing tables.  For this, some sort of
  446. routing protocol is needed.  A routing protocol is simply a  technique
  447. for  the  gateways  to  find each other, and keep up to date about the
  448. best way to get to every network.   RFC  1009  contains  a  review  of
  449. gateway  design  and  routing.    However rip.doc is probably a better
  450. introduction to the subject.  It contains some tutorial material,  and
  451. a detailed description of the most commonly-used routing protocol.
  452.  
  453.  
  454.  
  455. 7. Details about Internet addresses: subnets and broadcasting
  456.  
  457.  
  458. As  indicated earlier, Internet addresses are 32-bit numbers, normally
  459. written as 4 octets (in decimal), e.g. 128.6.4.7.  There are  actually
  460. 3  different types of address.  The problem is that the address has to
  461. indicate both the network and the host within the  network.    It  was
  462. felt  that  eventually  there would be lots of networks.  Many of them
  463. would be small, but probably 24 bits would be needed to represent  all
  464. the  IP  networks.  It was also felt that some very big networks might
  465. need 24 bits to represent all of their hosts.  This would seem to lead
  466. to  48  bit  addresses.  But the designers really wanted to use 32 bit
  467. addresses.  So they adopted a kludge.  The assumption is that most  of
  468. the  networks will be small.  So they set up three different ranges of
  469. address.  Addresses beginning with 1 to 126 use only the  first  octet
  470. for  the network number.  The other three octets are available for the
  471. host number.  Thus 24 bits are available for hosts.  These numbers are
  472.                                   21
  473.  
  474.  
  475.  
  476. used  for large networks.  But there can only be 126 of these very big
  477. networks.  The Arpanet is one, and there are a  few  large  commercial
  478. networks.    But  few  normal organizations get one of these "class A"
  479. addresses.  For normal large organizations, "class  B"  addresses  are
  480. used.    Class  B  addresses  use the first two octets for the network
  481. number.  Thus network numbers are 128.1 through 191.254.  (We avoid  0
  482. and  255,  for  reasons  that  we  see below.  We also avoid addresses
  483. beginning with 127, because that is used by some systems  for  special
  484. purposes.)    The  last  two  octets  are available for host addesses,
  485. giving 16 bits of host address.   This  allows  for  64516  computers,
  486. which should be enough for most organizations.  (It is possible to get
  487. more than one class B address, if you run  out.)    Finally,  class  C
  488. addresses  use  three  octets,  in  the  range 192.1.1 to 223.254.254.
  489. These allow only 254 hosts on each network, but there can be  lots  of
  490. these  networks.   Addresses above 223 are reserved for future use, as
  491. class D and E (which are currently not defined).
  492.  
  493. Many large organizations find it convenient to  divide  their  network
  494. number into "subnets".  For example, Rutgers has been assigned a class
  495. B address, 128.6.  We find it convenient to use the third octet of the
  496. address to indicate which Ethernet a host is on.  This division has no
  497. significance outside of Rutgers.  A computer  at  another  institution
  498. would treat all datagrams addressed to 128.6 the same way.  They would
  499. not look at the third octet of the address.   Thus  computers  outside
  500. Rutgers  would  not have different routes for 128.6.4 or 128.6.5.  But
  501. inside Rutgers, we treat 128.6.4 and 128.6.5 as separate networks.  In
  502. effect, gateways inside Rutgers have separate entries for each Rutgers
  503. subnet, whereas gateways outside  Rutgers  just  have  one  entry  for
  504. 128.6.  Note  that  we  could  do  exactly  the  same thing by using a
  505. separate class C address for each Ethernet.   As  far  as  Rutgers  is
  506. concerned,  it  would be just as convenient for us to have a number of
  507. class C addresses.  However using class C addresses would make  things
  508. inconvenient for the rest of the world.  Every institution that wanted
  509. to talk to us would have to have a separate entry for each one of  our
  510. networks.   If every institution did this, there would be far too many
  511. networks for any reasonable gateway to keep track of.  By  subdividing
  512. a  class B network, we hide our internal structure from everyone else,
  513. and  save  them  trouble.    This  subnet  strategy  requires  special
  514. provisions in the network software.  It is described in RFC 950.
  515.  
  516. 0  and  255  have  special  meanings.  0 is reserved for machines that
  517. don't know their address.  In certain circumstances it is possible for
  518. a  machine not to know the number of the network it is on, or even its
  519. own host address.  For example, 0.0.0.23 would be a machine that  knew
  520. it was host number 23, but didn't know on what network.
  521.  
  522. 255  is  used for "broadcast".  A broadcast is a message that you want
  523. every system on the network to see.    Broadcasts  are  used  in  some
  524. situations  where you don't know who to talk to.  For example, suppose
  525. you need to look  up  a  host  name  and  get  its  Internet  address.
  526. Sometimes  you  don't know the address of the nearest name server.  In
  527. that case, you might send the request as a broadcast.  There are  also
  528. cases  where a number of systems are interested in information.  It is
  529. then less expensive to send a single broadcast than to send  datagrams
  530. individually  to  each host that is interested in the information.  In
  531.                                   22
  532.  
  533.  
  534.  
  535. order to send a broadcast, you use an address that is  made  by  using
  536. your  network  address, with all ones in the part of the address where
  537. the host number goes.  For example, if you are on network 128.6.4, you
  538. would   use   128.6.4.255  for  broadcasts.    How  this  is  actually
  539. implemented depends upon the medium.   It  is  not  possible  to  send
  540. broadcasts  on the Arpanet, or on point to point lines.  However it is
  541. possible on an Ethernet.  If you use an Ethernet address with all  its
  542. bits  on (all ones), every machine on the Ethernet is supposed to look
  543. at that datagram.
  544.  
  545. Although the official broadcast address for  network  128.6.4  is  now
  546. 128.6.4.255,  there  are  some  other addresses that may be treated as
  547. broadcasts by certain implementations.  For convenience, the  standard
  548. also  allows  255.255.255.255 to be used.  This refers to all hosts on
  549. the local network.  It is often simpler to use 255.255.255.255 instead
  550. of  finding out the network number for the local network and forming a
  551. broadcast address such as 128.6.4.255.   In  addition,  certain  older
  552. implementations  may  use  0  instead  of  255  to  form the broadcast
  553. address.    Such  implementations  would  use  128.6.4.0  instead   of
  554. 128.6.4.255  as  the  broadcast  address on network 128.6.4.  Finally,
  555. certain older implementations may not understand about subnets.   Thus
  556. they consider the network number to be 128.6.  In that case, they will
  557. assume a broadcast address  of  128.6.255.255  or  128.6.0.0.    Until
  558. support  for  broadcasts is implemented properly, it can be a somewhat
  559. dangerous feature to use.
  560.  
  561. Because 0 and 255 are used for unknown and broadcast addresses, normal
  562. hosts  should never be given addresses containing 0 or 255.  Addresses
  563. should never begin with 0, 127, or any number above  223.    Addresses
  564. violating these rules are sometimes referred to as "Martians", because
  565. of rumors that the Central University of Mars is using network 225.
  566.  
  567.  
  568.  
  569. 8. Datagram fragmentation and reassembly
  570.  
  571.  
  572. TCP/IP is designed for use  with  many  different  kinds  of  network.
  573. Unfortunately,  network  designers  do not agree about how big packets
  574. can be.  Ethernet packets can be 1500 octets long.    Arpanet  packets
  575. have  a  maximum  of around 1000 octets.  Some very fast networks have
  576. much larger packet sizes.  At first, you might think  that  IP  should
  577. simply  settle  on  the  smallest  possible size.  Unfortunately, this
  578. would cause serious performance problems.    When  transferring  large
  579. files, big packets are far more efficient than small ones.  So we want
  580. to be able to use the largest packet size possible.  But we also  want
  581. to  be  able  to  handle  networks  with  small limits.  There are two
  582. provisions for this.  First, TCP has the ability to "negotiate"  about
  583. datagram  size.  When a TCP connection first opens, both ends can send
  584. the maximum datagram size they can  handle.    The  smaller  of  these
  585. numbers  is  used  for  the  rest  of the connection.  This allows two
  586. implementations that can handle big datagrams to use  them,  but  also
  587. lets  them  talk  to  implementations that can't handle them.  However
  588. this doesn't completely solve the problem.  The most  serious  problem
  589. is  that the two ends don't necessarily know about all of the steps in
  590.                                   23
  591.  
  592.  
  593.  
  594. between.  For example, when sending data between Rutgers and Berkeley,
  595. it is likely that both computers will be on Ethernets.  Thus they will
  596. both  be  prepared  to  handle  1500-octet  datagrams.    However  the
  597. connection will at some point end up going over the Arpanet.  It can't
  598. handle packets of that size.  For this reason, there are provisions to
  599. split   datagrams   up   into   pieces.    (This  is  referred  to  as
  600. "fragmentation".)  The IP header  contains  fields  indicating  the  a
  601. datagram  has  been split, and enough information to let the pieces be
  602. put back together.  If a gateway connects an Ethernet to the  Arpanet,
  603. it must be prepared to take 1500-octet Ethernet packets and split them
  604. into pieces that will fit on the Arpanet.    Furthermore,  every  host
  605. implementation  of  TCP/IP  must  be prepared to accept pieces and put
  606. them back together.  This is referred to as "reassembly".
  607.  
  608. TCP/IP implementations differ in the approach they take to deciding on
  609. datagram  size.    It  is  fairly  common  for  implementations to use
  610. 576-byte datagrams whenever they can't verify that the entire path  is
  611. able  to  handle larger packets.  This rather conservative strategy is
  612. used because of the number of implementations with bugs in the code to
  613. reassemble  fragments.    Implementors  often try to avoid ever having
  614. fragmentation occur.  Different implementors take different approaches
  615. to  deciding  when  it  is safe to use large datagrams.  Some use them
  616. only for the local network.  Others will use them for any  network  on
  617. the   same   campus.    576  bytes  is  a  "safe"  size,  which  every
  618. implementation must support.
  619.  
  620.  
  621.  
  622. 9. Ethernet encapsulation: ARP
  623.  
  624.  
  625. There was a brief discussion earlier about what IP datagrams look like
  626. on  an  Ethernet.    The  discussion  showed  the  Ethernet header and
  627. checksum.  However it left one hole: It didn't say how to  figure  out
  628. what Ethernet address to use when you want to talk to a given Internet
  629. address.  In fact, there is a separate protocol for this,  called  ARP
  630. ("address  resolution protocol").  (Note by the way that ARP is not an
  631. IP protocol.  That is, the ARP datagrams  do  not  have  IP  headers.)
  632. Suppose  you  are  on  system  128.6.4.194  and you want to connect to
  633. system 128.6.4.7.  Your system will first verify that 128.6.4.7 is  on
  634. the  same network, so it can talk directly via Ethernet.  Then it will
  635. look up 128.6.4.7 in its ARP table, to see if  it  already  knows  the
  636. Ethernet  address.    If  so, it will stick on an Ethernet header, and
  637. send the packet.  But suppose this system is not  in  the  ARP  table.
  638. There  is  no  way  to  send the packet, because you need the Ethernet
  639. address.  So it  uses  the  ARP  protocol  to  send  an  ARP  request.
  640. Essentially  an  ARP  request  says  "I  need the Ethernet address for
  641. 128.6.4.7".  Every system listens to ARP requests.  When a system sees
  642. an  ARP  request  for itself, it is required to respond.  So 128.6.4.7
  643. will see the request, and will respond with an  ARP  reply  saying  in
  644. effect "128.6.4.7 is 8:0:20:1:56:34".  (Recall that Ethernet addresses
  645. are 48 bits.  This is 6 octets.  Ethernet addresses are conventionally
  646. shown  in  hex,  using  the punctuation shown.)  Your system will save
  647. this information in its ARP table, so future packets will go directly.
  648. Most  systems  treat the ARP table as a cache, and clear entries in it
  649.                                   24
  650.  
  651.  
  652.  
  653. if they have not been used in a certain period of time.
  654.  
  655. Note by the way that ARP requests must be sent as "broadcasts".  There
  656. is  no  way  that  an  ARP  request  can be sent directly to the right
  657. system.  After all, the whole reason for sending  an  ARP  request  is
  658. that  you  don't know the Ethernet address.  So an Ethernet address of
  659. all ones is  used,  i.e.  ff:ff:ff:ff:ff:ff.    By  convention,  every
  660. machine  on  the Ethernet is required to pay attention to packets with
  661. this as an address.  So every system sees every ARP  requests.    They
  662. all  look to see whether the request is for their own address.  If so,
  663. they respond.  If not, they could just ignore it.   (Some  hosts  will
  664. use  ARP  requests  to update their knowledge about other hosts on the
  665. network, even if the request isn't for them.)  Note that packets whose
  666. IP  address  indicates broadcast (e.g. 255.255.255.255 or 128.6.4.255)
  667. are also sent with an Ethernet address that is all ones.
  668.  
  669.  
  670.  
  671. 10. Getting more information
  672.  
  673.  
  674. This directory contains  documents  describing  the  major  protocols.
  675. There  are literally hundreds of documents, so we have chosen the ones
  676. that seem most important.  Internet standards are called RFC's.    RFC
  677. stands  for  Request  for  Comment.   A proposed standard is initially
  678. issued as a proposal, and given an RFC number.   When  it  is  finally
  679. accepted,  it is added to Official Internet Protocols, but it is still
  680. referred to by the RFC number.   We  have  also  included  two  IEN's.
  681. (IEN's  used  to  be  a  separate  classification  for  more  informal
  682. documents.  This classification no longer exists -- RFC's are now used
  683. for  all  official  Internet documents, and a mailing list is used for
  684. more informal reports.)  The convention is that  whenever  an  RFC  is
  685. revised, the revised version gets a new number.  This is fine for most
  686. purposes, but it causes problems with two documents: Assigned  Numbers
  687. and  Official  Internet  Protocols.  These documents are being revised
  688. all the time, so the RFC number keeps changing.  You will have to look
  689. in rfc-index.txt to find the number of the latest edition.  Anyone who
  690. is seriously interested in TCP/IP should read the  RFC  describing  IP
  691. (791).    RFC 1009 is also useful.  It is a specification for gateways
  692. to be used by NSFnet.  As such, it contains an overview of  a  lot  of
  693. the  TCP/IP technology.  You should probably also read the description
  694. of at least one of the application protocols, just to get a  feel  for
  695. the  way  things  work.    Mail is probably a good one (821/822).  TCP
  696. (793) is of course a very basic specification.  However  the  spec  is
  697. fairly  complex,  so  you should only read this when you have the time
  698. and patience to think about it carefully.  Fortunately, the author  of
  699. the  major  RFC's  (Jon Postel) is a very good writer.  The TCP RFC is
  700. far easier to read than you would expect, given the complexity of what
  701. it  is  describing.    You  can  look at the other RFC's as you become
  702. curious about their subject matter.
  703.  
  704. Here is a list of the documents you are more likely to want:
  705.  
  706.      rfc-index list of all RFC's
  707.  
  708.                                   25
  709.  
  710.  
  711.  
  712.      rfc1012   somewhat fuller list of all RFC's
  713.  
  714.      rfc1011   Official Protocols.  It's useful to scan  this  to  see
  715.                what tasks protocols have been built for.  This defines
  716.                which  RFC's  are  actual  standards,  as  opposed   to
  717.                requests for comments.
  718.  
  719.      rfc1010   Assigned  Numbers.  If you are working with TCP/IP, you
  720.                will probably want a hardcopy of this as  a  reference.
  721.                It's  not  very  exciting  to  read.   It lists all the
  722.                offically defined well-known ports and  lots  of  other
  723.                things.
  724.  
  725.      rfc1009   NSFnet  gateway  specifications.  A good overview of IP
  726.                routing and gateway technology.
  727.  
  728.      rfc1001/2 netBIOS: networking for PC's
  729.  
  730.      rfc973    update on domains
  731.  
  732.      rfc959    FTP (file transfer)
  733.  
  734.      rfc950    subnets
  735.  
  736.      rfc937    POP2: protocol for reading mail on PC's
  737.  
  738.      rfc894    how IP is to be put on Ethernet, see also rfc825
  739.  
  740.      rfc882/3  domains (the database used to go  from  host  names  to
  741.                Internet  address  and back -- also used to handle UUCP
  742.                these days).  See also rfc973
  743.  
  744.      rfc854/5  telnet - protocol for remote logins
  745.  
  746.      rfc826    ARP - protocol for finding out Ethernet addresses
  747.  
  748.      rfc821/2  mail
  749.  
  750.      rfc814    names and ports - general  concepts  behind  well-known
  751.                ports
  752.  
  753.      rfc793    TCP
  754.  
  755.      rfc792    ICMP
  756.  
  757.      rfc791    IP
  758.  
  759.      rfc768    UDP
  760.  
  761.      rip.doc   details of the most commonly-used routing protocol
  762.  
  763.      ien-116   old  name  server  (still  needed  by  several kinds of
  764.                system)
  765.  
  766.      ien-48    the  Catenet  model,   general   description   of   the
  767.                                   26
  768.  
  769.  
  770.  
  771.                philosophy behind TCP/IP 
  772.  
  773. The following documents are somewhat more specialized.
  774.  
  775.      rfc813    window and acknowledgement strategies in TCP
  776.  
  777.      rfc815    datagram reassembly techniques
  778.  
  779.      rfc816    fault isolation and resolution techniques
  780.  
  781.      rfc817    modularity and efficiency in implementation
  782.  
  783.      rfc879    the maximum segment size option in TCP
  784.  
  785.      rfc896    congestion control
  786.  
  787.      rfc827,888,904,975,985
  788.                EGP and related issues 
  789.  
  790. To those of you who may be reading this document remotely  instead  of
  791. at  Rutgers:  The  most  important  RFC's  have  been collected into a
  792. three-volume set, the DDN Protocol Handbook.  It is available from the
  793. DDN  Network  Information  Center,  SRI  International, 333 Ravenswood
  794. Avenue, Menlo Park, California 94025 (telephone: 800-235-3155).    You
  795. should  be able to get them via anonymous FTP from sri-nic.arpa.  File
  796. names are:  
  797.  
  798.   RFC's:
  799.     rfc:rfc-index.txt
  800.     rfc:rfcxxx.txt
  801.   IEN's:
  802.     ien:ien-index.txt
  803.     ien:ien-xxx.txt
  804.  
  805. rip.doc is available  by  anonymous  FTP  from  topaz.rutgers.edu,  as
  806. /pub/tcp-ip-docs/rip.doc.
  807.  
  808. Sites with access to UUCP but not FTP may be able to retreive them via
  809. UUCP from UUCP host rutgers.  The file names would be 
  810.  
  811.   RFC's:
  812.     /topaz/pub/pub/tcp-ip-docs/rfc-index.txt
  813.     /topaz/pub/pub/tcp-ip-docs/rfcxxx.txt
  814.   IEN's:
  815.     /topaz/pub/pub/tcp-ip-docs/ien-index.txt
  816.     /topaz/pub/pub/tcp-ip-docs/ien-xxx.txt
  817.   /topaz/pub/pub/tcp-ip-docs/rip.doc
  818.  
  819. Note that SRI-NIC has the entire set of RFC's and IEN's,  but  rutgers
  820. and topaz have only those specifically mentioned above.
  821.  
  822.  
  823.  
  824.  
  825.  
  826.                                   27
  827.  
  828.