home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / zines / phrack1 / phrack29.003 < prev    next >
Encoding:
Text File  |  2003-06-11  |  41.8 KB  |  711 lines

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