home *** CD-ROM | disk | FTP | other *** search
/ Caldera Network Desktop 1.0 / caldera-network-desktop-1.0.bin / doc / HOWTO / mini / Proxy-ARP < prev    next >
Text File  |  1995-03-11  |  14KB  |  320 lines

  1.                A small treatise on the use of ProxyARP
  2.                  by Al Longyear <longyear@netcom.com>
  3.                            December 5, 1994
  4.  
  5. I. Introduction
  6.  
  7. This document is written to help those who are considering using the
  8. proxy ARP (Address Resolution Protocol) logic within Linux in the aid
  9. of PPP and SLIP server devices. Proxy ARP is also called 'gracious
  10. ARP' in some sources of documentation. There have been numerous
  11. requests for the use of proxy ARP. When it is not able to be used,
  12. some people deem this as a flaw in the software and wonder why it is
  13. broken.
  14.  
  15. I hope that with the aid of this document, people will understand
  16. more about proxy ARP as well as when it is and is not useful.
  17.  
  18. The use of proxy ARP is useful when you have a server. It will allow
  19. the dynamic connection of remote systems without the need for the
  20. update of the routing tables on other system but the one associated
  21. as the 'server'.
  22.  
  23. The term 'server' is somewhat of a misnomer. TCP/IP is a peer-to-peer
  24. networking environment. It does not have a client to server relation
  25. as other systems do in that resources are offered or 'shared' on
  26. servers while clients 'use' them. However, it is convenient to call the
  27. 'system which answers the telephone' a server; while the 'system
  28. which dials the telephone to connect to the server' a client.
  29.  
  30. Linux's networking software directly supports proxy ARP. There is
  31. no need for a special daemon process such as proxyarpd used in some
  32. systems.
  33.  
  34. Both the PPP protocol support code, pppd, and at least one of the SLIP
  35. support code, dip-uri, will support proxy ARP. In addition, the
  36. networking program, arp, will manage and display the table.
  37.  
  38. To understand how Proxy ARP works and when it may be used, you need to
  39. have a basic understanding of how networking is performed in general.
  40. The next three sections of this document will describe in the
  41. briefest of terms how TCP/IP networking is performed and how routing
  42. works.
  43.  
  44.  
  45.  
  46. II. The Hardware side of Networking
  47.  
  48. All networking using ethernet or token ring is performed using a MAC
  49. (Media Access Control) address. This is a hardware address associated
  50. with a specific controller. Each MAC address is unique. They are
  51. assigned by the manufacturer of the controller. While they may be
  52. overridden in software, this is not the general rule.
  53.  
  54. IP addresses are translated to MAC addresses using a special table
  55. within the networking software called the `ARP cache'. When the
  56. networking software wishes to send an IP frame to the specified
  57. address, it will consult this cache to determine the MAC address. If
  58. the entry is not found in the cache, a special request is made of all
  59. systems attached to the network to resolve the IP address to a MAC
  60. address. This is called an ARP request.
  61.  
  62. The response to the ARP request is a reply with the MAC address. This
  63. MAC address is then added to the cache so that the translation may be
  64. performed subsequently without the aid of ARP.
  65.  
  66. It is this ARP request which is used by the proxy ARP logic to aid
  67. in the support of remote connections.
  68.  
  69. There are rules by which the entries in the cache are removed. Those
  70. rules are not germane to this document and are best left to a
  71. technical description of ip networking.
  72.  
  73. (While token ring is under development, and is available on a test
  74. basis, the common networking transport media for Linux is ethernet. I
  75. will use the term 'ethernet' from now on. Similar facilities are
  76. available for token ring, irrespective of token ring's source routing.)
  77.  
  78.  
  79.  
  80. III. Reason for the use of Proxy ARP
  81.  
  82. The purpose of proxy ARP is to allow the assignment of more than one
  83. IP address to a single network adapter.
  84.  
  85. The manner in which it does this is to create an entry in the ARP
  86. cache of Linux which associates the additional IP address with the
  87. hardware address of the ethernet controller. This permits the Linux
  88. system to respond to an ARP request to translate an IP address to a
  89. hardware address.
  90.  
  91.  
  92.  
  93. IV. TCP/IP Routing
  94.  
  95. [A small preface is in order at this time. This describes the
  96. 'spanning-tree' routing. It does not describe 'source-routing' of IP
  97. frames. The source routing performed by token ring is not IP source
  98. routing but is performed at the MAC layer. The use of IP source
  99. routing is discouraged. Token ring MAC source routing is a
  100. requirement of that transport.]
  101.  
  102. To understand more about proxy ARP, you need to understand how IP
  103. frames are routed on the network. I do not plan to go into great
  104. detail. If you wish additional information, there are many books
  105. available which will offer more in-depth information. (If you don't
  106. wish the books, then look at the RFC documents.)
  107.  
  108. IP frames are routed at each stage of their passage through the
  109. network. Each host, router, and gateway decides for itself and based
  110. upon its own copy of the routing tables where the specific IP frame is
  111. to be transmitted.
  112.  
  113. The routing is performed using the term which I will call an
  114. 'IP network'. Each network interface is assigned an unique IP network.
  115. Each is given an IP address. Each is given a netmask. The 'IP network'
  116. is simply the logical conjunction of the IP address with the netmask.
  117. For example, the IP address of 10.124.35.40 and the netmask of
  118. 255.255.0.0 would have an 'IP network' of 10.124.0.0. While I am using
  119. byte netmasks, the same logic would apply to the non-byte boundary
  120. netmasks.
  121.  
  122. Linux associates the netmask with the route entry. When you add a
  123. route into the system, you specify a IP address and the associated
  124. destination device. If you don't specify a netmask, the netmask is
  125. taken from the destination device's default netmask which is set when
  126. the device is configured with ifconfig.
  127.  
  128. To better understand routing, consider the following configuration of
  129. a sample system.
  130.  
  131. Destination     Netmask          Gateway       Flags    Device
  132. 10.124.0.0      255.255.0.0      0.0.0.0       U        eth0
  133. 10.125.0.0      255.255.0.0      0.0.0.0       U        eth1
  134. 10.126.0.0      255.255.0.0      10.125.31.1   UG       eth1
  135. 10.124.12.5     255.255.255.255  0.0.0.0       UH       ppp0
  136. 0.0.0.0         0.0.0.0          10.124.25.1   U        eth0
  137.  
  138. This is a system with three network devices. It has two ethernet
  139. controllers and one PPP device. IP frames may come into this system
  140. from any one of the three sources. In addition, frames are forwarded
  141. through this system to any one of the three destination devices.
  142.  
  143. The default route is to the gateway device at 10.124.25.1 as
  144. demonstrated by the last entry. To reach that gateway, the frame is
  145. to be transmitted by the eth0 controller.
  146.  
  147. There is one PPP device connected. Its IP address is 10.124.12.5.
  148.  
  149. The eth0 device is on the IP network of 10.124.0.0 while the eth1
  150. device is on the IP network 10.125.0.0.
  151.  
  152. In addition, there is a net route to the IP network 10.126.0.0
  153. available at the gateway associated with 10.125.31.1.
  154.  
  155. To understand how routing is performed, consider an IP frame for the
  156. destination of 10.125.45.1.
  157.  
  158. Linux will go through the route table and for each entry, take the
  159. netmask, perform a logical conjunction (and) with the netmask and
  160. then compare it to the entry's destination IP address. If the result
  161. matches, the frame is sent to the device indicated.
  162.  
  163. The result is that the frame for the IP address of 10.125.45.1 will
  164. be sent to the eth1 device.
  165.  
  166. Likewise a frame for the IP address of 10.124.12.5 will go to the
  167. ppp0 device while the IP address of 10.124.12.6 will go to the eth0
  168. device since the ppp0 device will only accept its one IP address of
  169. 10.124.12.5.
  170.  
  171. Frames for 10.126.31.4 are different. They have a 'gateway'
  172. associated with them. They are found in the similar manner. However,
  173. instead of just sending them to the eth1 device, they are sent to the
  174. one system which is associated with the IP address of 10.125.31.1. It
  175. is this IP address which is translated to a MAC address, rather than
  176. the destination address, 10.126.31.4.
  177.  
  178. When they arrive at the 10.126.31.1 system, that system will forward
  179. them on to the final destination of 10.126.31.4 by using its routing
  180. table which may say to send it on its eth3 interface.
  181.  
  182. There are many error conditions which are caught by this form of
  183. routing. I don't want to go into all of them, however, if for
  184. example, 10.126.31.1 did not have a path to reach the .4 address,
  185. then it would send back a ICMP (Internet Control Message Protocol)
  186. frame to the original sender that it does not have a 'route to the
  187. host' condition.
  188.  
  189.  
  190.  
  191. V. Routing with Proxy ARP
  192.  
  193. Finally, we are getting to the focus of this document now that all of
  194. the foundation has been described.
  195.  
  196. Remember that Linux will put an entry into the ARP cache for the IP
  197. address and the associated hardware MAC address when it is to do proxy
  198. ARP. Remember that this cache is used to translate IP addresses to
  199. MAC addresses.
  200.  
  201. When the remote connects at IP address 10.124.12.5, the Linux system
  202. will add this IP address and the MAC address associated with the eth0
  203. controller to the ARP cache.
  204.  
  205. When it receives a request to translate the IP address 10.124.12.5 to
  206. a MAC address, it will send the entry from its tables to the
  207. requester. The result is that frames to this IP address will be sent
  208. to the server and the server may then forward them to the remote
  209. system.
  210.  
  211. This is how proxy ARP works. The server is a proxy (an agent, an
  212. inter-lopper, a 'front' person, etc.) for the remote IP address. It is
  213. saying to the network that it can accept frames for the remote IP
  214. address and deliver them by responding to the ARP requests.
  215.  
  216. So, for proxy ARP to work, the IP address of the remote (10.124.12.5
  217. in my example) needs to be on one of the IP networks for a network
  218. adapter.
  219.  
  220. There are two reasons for this requirement.
  221.  
  222. The first reason is that the MAC address of the controller is entered
  223. into the ARP cache to be associated with the IP address. A MAC
  224. address is required for the ARP assignment since the ARP cache is a
  225. translation from IP addresses to MAC addresses.
  226.  
  227. The second reason is that all systems on the network do their own
  228. routing. They know that to send a IP frame to the remote's IP address
  229. that they must 'put it on the same wire' which is connected to the
  230. server's network adapter.
  231.  
  232.  
  233.  
  234. VI. When Proxy ARP will not work
  235.  
  236. Consider what would happen if the remote's IP address was 10.200.3.1
  237. rather than 10.124.12.5.
  238.  
  239. 1. The remote systems would not know where to send this address.
  240.  
  241. They all know that to reach the IP network 10.124.0.0 that the frames
  242. should go on the cable attached to eth0. However, there is no IP
  243. network for 10.200.0.0. They would not know where to send frames to
  244. this destination.
  245.  
  246. 2. The server would not know what controller to use for the
  247.    appropriate MAC address when it made the ARP entry.
  248.  
  249. This is the most common reason why proxy ARP will not work for people
  250. who wish to use it. They have a different IP network associated with
  251. the remote IP address than one of their own network interfaces.
  252.  
  253.  
  254.  
  255. VII. Problems with Proxy ARP and what must be avoided
  256.  
  257. 1. Do not have more than one system respond to the proxy ARP entry for
  258.    a specific IP address. In the case of BSD, this will may mean that
  259.    since proxy ARP for a range of addresses, ensure that that the
  260.    address ranges do not conflict. For a network based upon BSD networking,
  261.    this means that you should dedicate the entire network to one server.
  262.  
  263. Again, BSD systems will bitterly complain if it receives more than one
  264. reply for its ARP request.
  265.  
  266. 2. Do not attempt to perform Proxy ARP for an address which is already
  267.    present on the network.
  268.  
  269. This is a slight variation of the above problem. If you attempt to
  270. perform proxy ARP for an IP address which is presently available on
  271. the network, then two replies will be generated. This may mean that
  272. you should not take IP addresses from one network and move them to a
  273. remote connection which may cause the server to attempt to perform
  274. Proxy ARP.
  275.  
  276.  
  277.  
  278. VII. What to do if you can't use Proxy ARP but want the same
  279. functionality.
  280.  
  281. There are several choices available if you are unable to use proxy
  282. ARP.
  283.  
  284. The easiest is to subnet the remote IP addresses so that all of the
  285. remote addresses are on their own IP network. Then add a network route
  286. on each of the routers (those devices which are indicated by the
  287. 'gateway' addresses of all of your hosts) so that the IP network is to
  288. be sent to the server to which the remote IP addresses connect.
  289.  
  290. Alternately, you could use gated on the server and the routers.
  291.  
  292. Alternately, you could put a host route if you don't wish to subnet
  293. the IP network. You would put entries in each of the routers for all
  294. of the remote IP addresses.
  295.  
  296. You need to update only the gateways and routers. You do not need to
  297. change all of the hosts in your network. The default routes which the
  298. hosts use to send frames to routers will cause what is called a "ICMP
  299. re-direct" frame to be sent to the host making the request. This will
  300. automatically add a 'host' route to the appropriate server.
  301.  
  302.  
  303.  
  304. VIII. Conclusion
  305.  
  306. I hope that I have explained a little more about the proxy ARP and
  307. how it works. Fortunately, if you use pppd or dip-uri, you do not
  308. need to know how the mechanical steps in using it. It is
  309. automatically performed for you by these pieces of software.
  310.  
  311. Proxy ARP is not for everyone. It is a workable solution in some
  312. cases. Hopefully, you can determine for yourself whether this will
  313. help you with your networking problems.
  314.  
  315. Additional information may be found in the book 'TCP/IP Illustrated,
  316. volume 1' "The protocols" by W. Richard Stevens and published by
  317. Addison Wessley.
  318.  
  319. Thank you.
  320.