libdhcsrv.dox 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. @page libdhcpsrv libdhcpsrv - Server DHCP library
  3. This library contains code useful for DHCPv4 and DHCPv6 server operations, like
  4. Lease Manager that stores leases information, configuration manager that stores
  5. configuration etc. The code here is server specific. For generic (useful in
  6. server, client, relay and other tools like perfdhcp) code, please see
  7. \ref libdhcp.
  8. This library contains several crucial elements of the DHCP server operation:
  9. - isc::dhcp::LeaseMgr - Lease Manager is a name for database backend that stores
  10. leases.
  11. - isc::dhcp::CfgMgr - Configuration Manager that holds DHCP specific
  12. configuration information (subnets, pools, options, timer values etc.) in
  13. easy to use format.
  14. - AllocEngine - allocation engine that handles new requestes and allocates new
  15. leases.
  16. @section leasemgr Lease Manager
  17. LeaseMgr provides a common, unified abstract API for all database backends. All
  18. backends are derived from the base class isc::dhcp::LeaseMgr. Currently the
  19. only available backend is MySQL (see \ref isc::dhcp::MySqlLeaseMgr).
  20. @section cfgmgr Configuration Manager
  21. Configuration Manager (\ref isc::dhcp::CfgMgr) stores configuration information
  22. necessary for DHCPv4 and DHCPv6 server operation. In particular, it stores
  23. subnets (\ref isc::dhcp::Subnet4 and \ref isc::dhcp::Subnet6) together with
  24. their pools (\ref isc::dhcp::Pool4 and \ref isc::dhcp::Pool6), options and
  25. other information specified by the used in BIND10 configuration.
  26. @section allocengine Allocation Engine
  27. Allocation Engine (\ref isc::dhcp::AllocEngine) is what its name say - an engine
  28. that handles allocation of new leases. It takes parameters that the client
  29. provided (client-id, DUID, subnet, a hint if the user provided one, etc.) and
  30. then attempts to allocate a lease.
  31. There is no single best soluction to the address assignment problem. Server
  32. is expected to pick an address from its available pools is currently not used.
  33. There are many possible algorithms that can do that, each with its own advantages
  34. and drawbacks. This allocation engine must provide robust operation is radically
  35. different scenarios, so there address selection problem was abstracted into
  36. separate module, called allocator. Its sole purpose is to pick an address from
  37. a pool. Allocation engine will then check if the picked address is free and if
  38. it is not, then will ask allocator to pick again.
  39. At lease 3 allocators will be implemented:
  40. - Iterative - it iterates over all addresses in available pools, one
  41. by one. The advantages of this approach are speed (typically it only needs to
  42. increase last address), the guarantee to cover all addresses and predictability.
  43. This allocator behaves very good in case of nearing depletion. Even when pools
  44. are almost completely allocated, it still will be able to allocate outstanding
  45. leases efficiently. Predictability can also be considered a serious flaw in
  46. some environments, as prediction of the next address is trivial and can be
  47. leveraged by an attacker. Another drawback of this allocator is that it does
  48. not attempt to give the same address to returning clients (clients that released
  49. or expired their leases and are requesting a new lease will likely to get a
  50. different lease). This allocator is implemented in \ref isc::dhcp::AllocEngine::IterativeAllocator.
  51. - Hashed - ISC-DHCP uses hash of the client-id or DUID to determine, which
  52. address is tried first. If that address is not available, the result is hashed
  53. again. That procedure is repeated until available address is found or there
  54. are no more addresses left. The benefit of that approach is that it provides
  55. a relative lease stability, so returning old clients are likely to get the same
  56. address again. The drawbacks are increased computation cost, as each iteration
  57. requires use of a hashing function. That is especially difficult when the
  58. pools are almost depleted. It also may be difficult to guarantee that the
  59. repeated hashing will iterate over all available addresses in all pools. Flawed
  60. hash algorithm can go into cycles that iterate over only part of the addresses.
  61. It is difficult to detect such issues as only some initial seed (client-id
  62. or DUID) values may trigger short cycles. This allocator is currently not
  63. implemented.
  64. - Random - Another possible approach to address selection is randomization. This
  65. allocator can pick an address randomly from the configured pool. The benefit
  66. of this approach is that it is easy to implement and makes attacks based on
  67. address prediction more difficult. The drawback of this approach is that
  68. returning clients are almost guaranteed to get a different address. Another
  69. drawback is that with almost depleted pools it is increasingly difficult to
  70. "guess" an address that is free. This allocator is currently not implemented.
  71. */