home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit v2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Texts / Rfc / RFC826.TXT < prev    next >
Text File  |  1999-11-04  |  22KB  |  484 lines

  1. Network Working Group                                   David C. Plummer 
  2. Request For Comments:  826                                  (DCP@MIT-MC)
  3.                                                            November 1982
  4.  
  5.  
  6.          An Ethernet Address Resolution Protocol
  7.                             -- or --
  8.               Converting Network Protocol Addresses
  9.                    to 48.bit Ethernet Address
  10.                        for Transmission on
  11.                         Ethernet Hardware
  12.  
  13.  
  14.  
  15.  
  16.  
  17.                 Abstract
  18.  
  19. The implementation of protocol P on a sending host S decides,
  20. through protocol P's routing mechanism, that it wants to transmit
  21. to a target host T located some place on a connected piece of
  22. 10Mbit Ethernet cable.  To actually transmit the Ethernet packet
  23. a 48.bit Ethernet address must be generated.  The addresses of
  24. hosts within protocol P are not always compatible with the
  25. corresponding Ethernet address (being different lengths or
  26. values).  Presented here is a protocol that allows dynamic
  27. distribution of the information needed to build tables to
  28. translate an address A in protocol P's address space into a
  29. 48.bit Ethernet address.
  30.  
  31. Generalizations have been made which allow the protocol to be
  32. used for non-10Mbit Ethernet hardware.  Some packet radio
  33. networks are examples of such hardware.
  34.  
  35. --------------------------------------------------------------------
  36.  
  37. The protocol proposed here is the result of a great deal of
  38. discussion with several other people, most notably J. Noel
  39. Chiappa, Yogen Dalal, and James E. Kulp, and helpful comments
  40. from David Moon.
  41.  
  42.  
  43.  
  44.  
  45. [The purpose of this RFC is to present a method of Converting
  46. Protocol Addresses (e.g., IP addresses) to Local Network
  47. Addresses (e.g., Ethernet addresses).  This is a issue of general
  48. concern in the ARPA Internet community at this time.  The
  49. method proposed here is presented for your consideration and
  50. comment.  This is not the specification of a Internet Standard.]
  51.  
  52.  
  53. Notes:
  54. ------       
  55.  
  56. This protocol was originally designed for the DEC/Intel/Xerox
  57. 10Mbit Ethernet.  It has been generalized to allow it to be used
  58. for other types of networks.  Much of the discussion will be
  59. directed toward the 10Mbit Ethernet.  Generalizations, where
  60. applicable, will follow the Ethernet-specific discussion.
  61.  
  62. DOD Internet Protocol will be referred to as Internet.
  63.  
  64. Numbers here are in the Ethernet standard, which is high byte
  65. first.  This is the opposite of the byte addressing of machines
  66. such as PDP-11s and VAXes.  Therefore, special care must be taken
  67. with the opcode field (ar$op) described below.
  68.  
  69. An agreed upon authority is needed to manage hardware name space
  70. values (see below).  Until an official authority exists, requests
  71. should be submitted to
  72.     David C. Plummer
  73.     Symbolics, Inc.
  74.     243 Vassar Street
  75.     Cambridge, Massachusetts  02139
  76. Alternatively, network mail can be sent to DCP@MIT-MC.
  77.  
  78. The Problem:
  79. ------------
  80.  
  81. The world is a jungle in general, and the networking game
  82. contributes many animals.  At nearly every layer of a network
  83. architecture there are several potential protocols that could be
  84. used.  For example, at a high level, there is TELNET and SUPDUP
  85. for remote login.  Somewhere below that there is a reliable byte
  86. stream protocol, which might be CHAOS protocol, DOD TCP, Xerox
  87. BSP or DECnet.  Even closer to the hardware is the logical
  88. transport layer, which might be CHAOS, DOD Internet, Xerox PUP,
  89. or DECnet.  The 10Mbit Ethernet allows all of these protocols
  90. (and more) to coexist on a single cable by means of a type field
  91. in the Ethernet packet header.  However, the 10Mbit Ethernet
  92. requires 48.bit addresses on the physical cable, yet most
  93. protocol addresses are not 48.bits long, nor do they necessarily
  94. have any relationship to the 48.bit Ethernet address of the
  95. hardware.  For example, CHAOS addresses are 16.bits, DOD Internet
  96. addresses are 32.bits, and Xerox PUP addresses are 8.bits.  A
  97. protocol is needed to dynamically distribute the correspondences
  98. between a <protocol, address> pair and a 48.bit Ethernet address.
  99.  
  100.  
  101. Motivation:
  102. -----------
  103.  
  104. Use of the 10Mbit Ethernet is increasing as more manufacturers
  105. supply interfaces that conform to the specification published by
  106. DEC, Intel and Xerox.  With this increasing availability, more
  107. and more software is being written for these interfaces.  There
  108. are two alternatives: (1) Every implementor invents his/her own
  109. method to do some form of address resolution, or (2) every
  110. implementor uses a standard so that his/her code can be
  111. distributed to other systems without need for modification.  This
  112. proposal attempts to set the standard.
  113.  
  114. Definitions:
  115. ------------
  116.  
  117. Define the following for referring to the values put in the TYPE
  118. field of the Ethernet packet header:
  119.     ether_type$XEROX_PUP,
  120.     ether_type$DOD_INTERNET,
  121.     ether_type$CHAOS, 
  122. and a new one:
  123.     ether_type$ADDRESS_RESOLUTION.  
  124. Also define the following values (to be discussed later):
  125.     ares_op$REQUEST (= 1, high byte transmitted first) and
  126.     ares_op$REPLY   (= 2), 
  127. and
  128.     ares_hrd$Ethernet (= 1).
  129.  
  130. Packet format:
  131. --------------
  132.  
  133. To communicate mappings from <protocol, address> pairs to 48.bit
  134. Ethernet addresses, a packet format that embodies the Address
  135. Resolution protocol is needed.  The format of the packet follows.
  136.  
  137.     Ethernet transmission layer (not necessarily accessible to
  138.      the user):
  139.     48.bit: Ethernet address of destination
  140.     48.bit: Ethernet address of sender
  141.     16.bit: Protocol type = ether_type$ADDRESS_RESOLUTION
  142.     Ethernet packet data:
  143.     16.bit: (ar$hrd) Hardware address space (e.g., Ethernet,
  144.              Packet Radio Net.)
  145.     16.bit: (ar$pro) Protocol address space.  For Ethernet
  146.              hardware, this is from the set of type
  147.              fields ether_typ$<protocol>.
  148.      8.bit: (ar$hln) byte length of each hardware address
  149.      8.bit: (ar$pln) byte length of each protocol address
  150.     16.bit: (ar$op)  opcode (ares_op$REQUEST | ares_op$REPLY)
  151.     nbytes: (ar$sha) Hardware address of sender of this
  152.              packet, n from the ar$hln field.
  153.     mbytes: (ar$spa) Protocol address of sender of this
  154.              packet, m from the ar$pln field.
  155.     nbytes: (ar$tha) Hardware address of target of this
  156.              packet (if known).
  157.     mbytes: (ar$tpa) Protocol address of target.
  158.  
  159.  
  160.  
  161. Packet Generation:
  162. ------------------
  163.  
  164. As a packet is sent down through the network layers, routing
  165. determines the protocol address of the next hop for the packet
  166. and on which piece of hardware it expects to find the station
  167. with the immediate target protocol address.  In the case of the
  168. 10Mbit Ethernet, address resolution is needed and some lower
  169. layer (probably the hardware driver) must consult the Address
  170. Resolution module (perhaps implemented in the Ethernet support
  171. module) to convert the <protocol type, target protocol address>
  172. pair to a 48.bit Ethernet address.  The Address Resolution module
  173. tries to find this pair in a table.  If it finds the pair, it
  174. gives the corresponding 48.bit Ethernet address back to the
  175. caller (hardware driver) which then transmits the packet.  If it
  176. does not, it probably informs the caller that it is throwing the
  177. packet away (on the assumption the packet will be retransmitted
  178. by a higher network layer), and generates an Ethernet packet with
  179. a type field of ether_type$ADDRESS_RESOLUTION.  The Address
  180. Resolution module then sets the ar$hrd field to
  181. ares_hrd$Ethernet, ar$pro to the protocol type that is being
  182. resolved, ar$hln to 6 (the number of bytes in a 48.bit Ethernet
  183. address), ar$pln to the length of an address in that protocol,
  184. ar$op to ares_op$REQUEST, ar$sha with the 48.bit ethernet address
  185. of itself, ar$spa with the protocol address of itself, and ar$tpa
  186. with the protocol address of the machine that is trying to be
  187. accessed.  It does not set ar$tha to anything in particular,
  188. because it is this value that it is trying to determine.  It
  189. could set ar$tha to the broadcast address for the hardware (all
  190. ones in the case of the 10Mbit Ethernet) if that makes it
  191. convenient for some aspect of the implementation.  It then causes
  192. this packet to be broadcast to all stations on the Ethernet cable
  193. originally determined by the routing mechanism.
  194.  
  195.  
  196.  
  197.  
  198. Packet Reception:
  199. -----------------
  200.  
  201. When an address resolution packet is received, the receiving
  202. Ethernet module gives the packet to the Address Resolution module
  203. which goes through an algorithm similar to the following.
  204. Negative conditionals indicate an end of processing and a
  205. discarding of the packet.
  206.  
  207. ?Do I have the hardware type in ar$hrd?
  208. Yes: (almost definitely)
  209.   [optionally check the hardware length ar$hln]
  210.   ?Do I speak the protocol in ar$pro?
  211.   Yes:
  212.     [optionally check the protocol length ar$pln]
  213.     Merge_flag := false
  214.     If the pair <protocol type, sender protocol address> is
  215.         already in my translation table, update the sender
  216.     hardware address field of the entry with the new
  217.     information in the packet and set Merge_flag to true. 
  218.     ?Am I the target protocol address?
  219.     Yes:
  220.       If Merge_flag is false, add the triplet <protocol type,
  221.           sender protocol address, sender hardware address> to
  222.       the translation table.
  223.       ?Is the opcode ares_op$REQUEST?  (NOW look at the opcode!!)
  224.       Yes:
  225.     Swap hardware and protocol fields, putting the local
  226.         hardware and protocol addresses in the sender fields.
  227.     Set the ar$op field to ares_op$REPLY
  228.     Send the packet to the (new) target hardware address on
  229.         the same hardware on which the request was received.
  230.  
  231. Notice that the <protocol type, sender protocol address, sender
  232. hardware address> triplet is merged into the table before the
  233. opcode is looked at.  This is on the assumption that communcation
  234. is bidirectional; if A has some reason to talk to B, then B will
  235. probably have some reason to talk to A.  Notice also that if an
  236. entry already exists for the <protocol type, sender protocol
  237. address> pair, then the new hardware address supersedes the old
  238. one.  Related Issues gives some motivation for this.
  239.  
  240. Generalization:  The ar$hrd and ar$hln fields allow this protocol
  241. and packet format to be used for non-10Mbit Ethernets.  For the
  242. 10Mbit Ethernet <ar$hrd, ar$hln> takes on the value <1, 6>.  For
  243. other hardware networks, the ar$pro field may no longer
  244. correspond to the Ethernet type field, but it should be
  245. associated with the protocol whose address resolution is being
  246. sought.
  247.  
  248.  
  249.  
  250. Why is it done this way??
  251. -------------------------
  252.  
  253. Periodic broadcasting is definitely not desired.  Imagine 100
  254. workstations on a single Ethernet, each broadcasting address
  255. resolution information once per 10 minutes (as one possible set
  256. of parameters).  This is one packet every 6 seconds.  This is
  257. almost reasonable, but what use is it?  The workstations aren't
  258. generally going to be talking to each other (and therefore have
  259. 100 useless entries in a table); they will be mainly talking to a
  260. mainframe, file server or bridge, but only to a small number of
  261. other workstations (for interactive conversations, for example).
  262. The protocol described in this paper distributes information as
  263. it is needed, and only once (probably) per boot of a machine.
  264.  
  265. This format does not allow for more than one resolution to be
  266. done in the same packet.  This is for simplicity.  If things were
  267. multiplexed the packet format would be considerably harder to
  268. digest, and much of the information could be gratuitous.  Think
  269. of a bridge that talks four protocols telling a workstation all
  270. four protocol addresses, three of which the workstation will
  271. probably never use.
  272.  
  273. This format allows the packet buffer to be reused if a reply is
  274. generated; a reply has the same length as a request, and several
  275. of the fields are the same.
  276.  
  277. The value of the hardware field (ar$hrd) is taken from a list for
  278. this purpose.  Currently the only defined value is for the 10Mbit
  279. Ethernet (ares_hrd$Ethernet = 1).  There has been talk of using
  280. this protocol for Packet Radio Networks as well, and this will
  281. require another value as will other future hardware mediums that
  282. wish to use this protocol.
  283.  
  284. For the 10Mbit Ethernet, the value in the protocol field (ar$pro)
  285. is taken from the set ether_type$.  This is a natural reuse of
  286. the assigned protocol types.  Combining this with the opcode
  287. (ar$op) would effectively halve the number of protocols that can
  288. be resolved under this protocol and would make a monitor/debugger
  289. more complex (see Network Monitoring and Debugging below).  It is
  290. hoped that we will never see 32768 protocols, but Murphy made
  291. some laws which don't allow us to make this assumption.
  292.  
  293. In theory, the length fields (ar$hln and ar$pln) are redundant,
  294. since the length of a protocol address should be determined by
  295. the hardware type (found in ar$hrd) and the protocol type (found
  296. in ar$pro).  It is included for optional consistency checking,
  297. and for network monitoring and debugging (see below). 
  298.  
  299. The opcode is to determine if this is a request (which may cause
  300. a reply) or a reply to a previous request.  16 bits for this is
  301. overkill, but a flag (field) is needed.
  302.  
  303. The sender hardware address and sender protocol address are
  304. absolutely necessary.  It is these fields that get put in a
  305. translation table.
  306.  
  307.  
  308. The target protocol address is necessary in the request form of
  309. the packet so that a machine can determine whether or not to
  310. enter the sender information in a table or to send a reply.  It
  311. is not necessarily needed in the reply form if one assumes a
  312. reply is only provoked by a request.  It is included for
  313. completeness, network monitoring, and to simplify the suggested
  314. processing algorithm described above (which does not look at the
  315. opcode until AFTER putting the sender information in a table).
  316.  
  317. The target hardware address is included for completeness and
  318. network monitoring.  It has no meaning in the request form, since
  319. it is this number that the machine is requesting.  Its meaning in
  320. the reply form is the address of the machine making the request.
  321. In some implementations (which do not get to look at the 14.byte
  322. ethernet header, for example) this may save some register
  323. shuffling or stack space by sending this field to the hardware
  324. driver as the hardware destination address of the packet.
  325.  
  326. There are no padding bytes between addresses.  The packet data
  327. should be viewed as a byte stream in which only 3 byte pairs are
  328. defined to be words (ar$hrd, ar$pro and ar$op) which are sent
  329. most significant byte first (Ethernet/PDP-10 byte style).  
  330.  
  331.  
  332.  
  333. Network monitoring and debugging:
  334. ---------------------------------
  335.  
  336. The above Address Resolution protocol allows a machine to gain
  337. knowledge about the higher level protocol activity (e.g., CHAOS,
  338. Internet, PUP, DECnet) on an Ethernet cable.  It can determine
  339. which Ethernet protocol type fields are in use (by value) and the
  340. protocol addresses within each protocol type.  In fact, it is not
  341. necessary for the monitor to speak any of the higher level
  342. protocols involved.  It goes something like this:
  343.  
  344. When a monitor receives an Address Resolution packet, it always
  345. enters the <protocol type, sender protocol address, sender
  346. hardware address> in a table.  It can determine the length of the
  347. hardware and protocol address from the ar$hln and ar$pln fields
  348. of the packet.  If the opcode is a REPLY the monitor can then
  349. throw the packet away.  If the opcode is a REQUEST and the target
  350. protocol address matches the protocol address of the monitor, the
  351. monitor sends a REPLY as it normally would.  The monitor will
  352. only get one mapping this way, since the REPLY to the REQUEST
  353. will be sent directly to the requesting host.  The monitor could
  354. try sending its own REQUEST, but this could get two monitors into
  355. a REQUEST sending loop, and care must be taken.
  356.  
  357. Because the protocol and opcode are not combined into one field,
  358. the monitor does not need to know which request opcode is
  359. associated with which reply opcode for the same higher level
  360. protocol.  The length fields should also give enough information
  361. to enable it to "parse" a protocol addresses, although it has no
  362. knowledge of what the protocol addresses mean.
  363.  
  364. A working implementation of the Address Resolution protocol can
  365. also be used to debug a non-working implementation.  Presumably a
  366. hardware driver will successfully broadcast a packet with Ethernet
  367. type field of ether_type$ADDRESS_RESOLUTION.  The format of the
  368. packet may not be totally correct, because initial
  369. implementations may have bugs, and table management may be
  370. slightly tricky.  Because requests are broadcast a monitor will
  371. receive the packet and can display it for debugging if desired.
  372.  
  373.  
  374.  
  375. An Example:
  376. -----------
  377.  
  378. Let there exist machines X and Y that are on the same 10Mbit
  379. Ethernet cable.  They have Ethernet address EA(X) and EA(Y) and
  380. DOD Internet addresses IPA(X) and IPA(Y) .  Let the Ethernet type
  381. of Internet be ET(IP).  Machine X has just been started, and
  382. sooner or later wants to send an Internet packet to machine Y on
  383. the same cable.  X knows that it wants to send to IPA(Y) and
  384. tells the hardware driver (here an Ethernet driver) IPA(Y).  The
  385. driver consults the Address Resolution module to convert <ET(IP),
  386. IPA(Y)> into a 48.bit Ethernet address, but because X was just
  387. started, it does not have this information.  It throws the
  388. Internet packet away and instead creates an ADDRESS RESOLUTION
  389. packet with
  390.     (ar$hrd) = ares_hrd$Ethernet
  391.     (ar$pro) = ET(IP)
  392.     (ar$hln) = length(EA(X))
  393.     (ar$pln) = length(IPA(X))
  394.     (ar$op)  = ares_op$REQUEST
  395.     (ar$sha) = EA(X)
  396.     (ar$spa) = IPA(X)
  397.     (ar$tha) = don't care
  398.     (ar$tpa) = IPA(Y)
  399. and broadcasts this packet to everybody on the cable.
  400.  
  401. Machine Y gets this packet, and determines that it understands
  402. the hardware type (Ethernet), that it speaks the indicated
  403. protocol (Internet) and that the packet is for it
  404. ((ar$tpa)=IPA(Y)).  It enters (probably replacing any existing
  405. entry) the information that <ET(IP), IPA(X)> maps to EA(X).  It
  406. then notices that it is a request, so it swaps fields, putting
  407. EA(Y) in the new sender Ethernet address field (ar$sha), sets the
  408. opcode to reply, and sends the packet directly (not broadcast) to
  409. EA(X).  At this point Y knows how to send to X, but X still
  410. doesn't know how to send to Y.
  411.  
  412. Machine X gets the reply packet from Y, forms the map from
  413. <ET(IP), IPA(Y)> to EA(Y), notices the packet is a reply and
  414. throws it away.  The next time X's Internet module tries to send
  415. a packet to Y on the Ethernet, the translation will succeed, and
  416. the packet will (hopefully) arrive.  If Y's Internet module then
  417. wants to talk to X, this will also succeed since Y has remembered
  418. the information from X's request for Address Resolution.
  419.  
  420.  
  421. Related issue:
  422. ---------------
  423.  
  424. It may be desirable to have table aging and/or timeouts.  The
  425. implementation of these is outside the scope of this protocol.
  426. Here is a more detailed description (thanks to MOON@SCRC@MIT-MC).
  427.  
  428. If a host moves, any connections initiated by that host will
  429. work, assuming its own address resolution table is cleared when
  430. it moves.  However, connections initiated to it by other hosts
  431. will have no particular reason to know to discard their old
  432. address.  However, 48.bit Ethernet addresses are supposed to be
  433. unique and fixed for all time, so they shouldn't change.  A host
  434. could "move" if a host name (and address in some other protocol)
  435. were reassigned to a different physical piece of hardware.  Also,
  436. as we know from experience, there is always the danger of
  437. incorrect routing information accidentally getting transmitted
  438. through hardware or software error; it should not be allowed to
  439. persist forever.  Perhaps failure to initiate a connection should
  440. inform the Address Resolution module to delete the information on
  441. the basis that the host is not reachable, possibly because it is
  442. down or the old translation is no longer valid.  Or perhaps
  443. receiving of a packet from a host should reset a timeout in the
  444. address resolution entry used for transmitting packets to that
  445. host; if no packets are received from a host for a suitable
  446. length of time, the address resolution entry is forgotten.  This
  447. may cause extra overhead to scan the table for each incoming
  448. packet.  Perhaps a hash or index can make this faster.
  449.  
  450. The suggested algorithm for receiving address resolution packets
  451. tries to lessen the time it takes for recovery if a host does
  452. move.  Recall that if the <protocol type, sender protocol
  453. address> is already in the translation table, then the sender
  454. hardware address supersedes the existing entry.  Therefore, on a
  455. perfect Ethernet where a broadcast REQUEST reaches all stations
  456. on the cable, each station will be get the new hardware address.
  457.  
  458. Another alternative is to have a daemon perform the timeouts.
  459. After a suitable time, the daemon considers removing an entry.
  460. It first sends (with a small number of retransmissions if needed)
  461. an address resolution packet with opcode REQUEST directly to the
  462. Ethernet address in the table.  If a REPLY is not seen in a short
  463. amount of time, the entry is deleted.  The request is sent
  464. directly so as not to bother every station on the Ethernet.  Just
  465. forgetting entries will likely cause useful information to be
  466. forgotten, which must be regained.
  467.  
  468. Since hosts don't transmit information about anyone other than
  469. themselves, rebooting a host will cause its address mapping table
  470. to be up to date.  Bad information can't persist forever by being
  471. passed around from machine to machine; the only bad information
  472. that can exist is in a machine that doesn't know that some other
  473. machine has changed its 48.bit Ethernet address.  Perhaps
  474. manually resetting (or clearing) the address mapping table will
  475. suffice.
  476.  
  477. This issue clearly needs more thought if it is believed to be
  478. important.  It is caused by any address resolution-like protocol.
  479.  
  480.  
  481.  
  482.  
  483.  
  484.