From: Ted Lemon Date: Fri, 28 Jan 2000 20:30:37 +0000 (+0000) Subject: Brian Murrell's changes to allow the client to be directed using OMAPI. X-Git-Tag: V3-BETA-2-PATCH-1~375 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=347de8bdb628837f37076ce06143be2c9c0f3c03;p=thirdparty%2Fdhcp.git Brian Murrell's changes to allow the client to be directed using OMAPI. --- diff --git a/client/Makefile.dist b/client/Makefile.dist index 584d8b583..43c42e2d6 100644 --- a/client/Makefile.dist +++ b/client/Makefile.dist @@ -21,8 +21,8 @@ CATMANPAGES = dhclient.cat8 dhclient.conf.cat5 dhclient-script.cat8 \ dhclient.leases.cat5 SEDMANPAGES = dhclient.man8 dhclient.conf.man5 dhclient-script.man8 \ dhclient.leases.man5 -SRCS = dhclient.c clparse.c -OBJS = dhclient.o clparse.o +SRCS = dhclient.c clparse.c omapi.c +OBJS = dhclient.o clparse.o omapi.o PROG = dhclient MAN = dhclient.8 dhclient.conf.5 dhclient-script.8 dhclient.leases.5 diff --git a/client/dhclient.c b/client/dhclient.c index 7764e6fb1..9c18c47db 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -29,7 +29,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.93 2000/01/26 14:55:26 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.94 2000/01/28 20:30:26 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -73,6 +73,8 @@ int save_scripts; static void usage PROTO ((void)); +void do_release(struct client_state *); + int main (argc, argv, envp) int argc; char **argv, **envp; @@ -86,6 +88,9 @@ int main (argc, argv, envp) char *server = (char *)0; char *relay = (char *)0; isc_result_t status; + int release_mode = 0; + omapi_object_t *listener; + isc_result_t result; #ifdef SYSLOG_4_2 openlog ("dhclient", LOG_NDELAY); @@ -99,7 +104,10 @@ int main (argc, argv, envp) #endif for (i = 1; i < argc; i++) { - if (!strcmp (argv [i], "-p")) { + if (!strcmp (argv [i], "-r")) { + release_mode = 1; + no_daemon = 1; + } else if (!strcmp (argv [i], "-p")) { if (++i == argc) usage (); local_port = htons (atoi (argv [i])); @@ -132,6 +140,9 @@ int main (argc, argv, envp) if (++i == argc) usage (); relay = argv [i]; + } else if (!strcmp (argv [i], "-n")) { + /* do not start up any interfaces */ + interfaces_requested = 1; } else if (argv [i][0] == '-') { usage (); } else { @@ -149,6 +160,16 @@ int main (argc, argv, envp) } } + /* first kill of any currently running client */ + if (release_mode) { + /* XXX inelegant hack to prove concept */ + char command[1024]; + + snprintf (command, 1024, "kill `cat %s`", + path_dhclient_pid); + system (command); + } + if (!quiet) { log_info ("%s %s", message, DHCP_VERSION); log_info (copyright); @@ -225,6 +246,10 @@ int main (argc, argv, envp) log_fatal ("Can't initialize OMAPI: %s", isc_result_totext (status)); + /* Set up the OMAPI wrappers for various server database internal + objects. */ + dhclient_db_objects_setup (); + /* Discover all the network interfaces. */ discover_interfaces (DISCOVER_UNCONFIGURED); @@ -251,7 +276,7 @@ int main (argc, argv, envp) /* Nothing more to do. */ exit (0); - } else { + } else if (!release_mode) { /* Call the script with the list of interfaces. */ for (ip = interfaces; ip; ip = ip -> next) { /* If interfaces were specified, don't configure @@ -295,15 +320,35 @@ int main (argc, argv, envp) /* Start a configuration state machine for each interface. */ for (ip = interfaces; ip; ip = ip -> next) { + ip -> flags |= INTERFACE_RUNNING; for (client = ip -> client; client; client = client -> next) { - client -> state = S_INIT; - /* Set up a timeout to start the initialization - process. */ - add_timeout (cur_time + random () % 5, - state_reboot, client); + if (release_mode) + do_release (client); + else { + client -> state = S_INIT; + /* Set up a timeout to start the initialization + process. */ + add_timeout (cur_time + random () % 5, + state_reboot, client); + } } } + if (release_mode) + return 0; + + /* Start up a listener for the object management API protocol. */ + listener = (omapi_object_t *)0; + result = omapi_generic_new (&listener, MDL); + if (result != ISC_R_SUCCESS) + log_fatal ("Can't allocate new generic object: %s\n", + isc_result_totext (result)); + result = omapi_protocol_listen (listener, + OMAPI_PROTOCOL_PORT, 1); + if (result != ISC_R_SUCCESS) + log_fatal ("Can't start OMAPI protocol: %s", + isc_result_totext (result)); + /* Set up the bootp packet handler... */ bootp_packet_handler = do_packet; @@ -1778,7 +1823,7 @@ void make_release (client, lease) oc = lookup_option (&dhcp_universe, lease -> options, DHO_DHCP_SERVER_IDENTIFIER); make_client_options (client, lease, &request, oc, - &lease -> address, (u_int32_t *)0, + (struct iaddr *)0, (u_int32_t *)0, &options); /* Set up the option buffer... */ @@ -2276,6 +2321,37 @@ void client_location_changed () } } +void do_release(client) + struct client_state *client; +{ + /* make_request doesn't initialize xid because it normally comes + from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER, + so pick an xid now. */ + client -> xid = random (); + + /* Make a DHCPREQUEST packet, and set appropriate per-interface + flags. */ + make_release (client, client -> active); + client -> destination = iaddr_broadcast; + client -> first_sending = cur_time; + client -> interval = client -> config -> initial_interval; + + /* Zap the medium list... */ + client -> medium = (struct string_list *)0; + + /* Send out the first DHCPREQUEST packet. */ + send_release (client); + + script_init (client, + "RELEASE", (struct string_list *)0); + if (client -> alias) + script_write_params (client, "alias_", + client -> alias); + script_go (client); +} + + + /* The client should never receive a relay agent information option, so if it does, log it and discard it. */ diff --git a/client/omapi.c b/client/omapi.c new file mode 100644 index 000000000..442bc6303 --- /dev/null +++ b/client/omapi.c @@ -0,0 +1,259 @@ +/* omapi.c + + OMAPI object interfaces for the DHCP client. */ + +#ifndef lint +static char copyright[] = +"$Id: omapi.c,v 1.1 2000/01/28 20:30:26 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +#endif /* not lint */ + +#include "dhcpd.h" +#include + +void dhclient_db_objects_setup () +{ + isc_result_t status; + + status = omapi_object_type_register (&dhcp_type_interface, + "interface", + dhclient_interface_set_value, + dhclient_interface_get_value, + dhclient_interface_destroy, + dhclient_interface_signal_handler, + dhclient_interface_stuff_values, + dhclient_interface_lookup, + dhclient_interface_create, + dhclient_interface_remove); + if (status != ISC_R_SUCCESS) + log_fatal ("Can't register interface object type: %s", + isc_result_totext (status)); + +} + +isc_result_t dhclient_interface_set_value (omapi_object_t *h, + omapi_object_t *id, + omapi_data_string_t *name, + omapi_typed_data_t *value) +{ + struct interface_info *interface; + isc_result_t status; + int foo; + + if (h -> type != dhcp_type_interface) + return ISC_R_INVALIDARG; + interface = (struct interface_info *)h; + + if (!omapi_ds_strcmp (name, "name")) { + if (value -> type == omapi_datatype_data || + value -> type == omapi_datatype_string) { + memcpy (interface -> name, + value -> u.buffer.value, + value -> u.buffer.len); + interface -> name [value -> u.buffer.len] = 0; + } else + return ISC_R_INVALIDARG; + return ISC_R_SUCCESS; + } + + /* Try to find some inner object that can take the value. */ + if (h -> inner && h -> inner -> type -> set_value) { + status = ((*(h -> inner -> type -> set_value)) + (h -> inner, id, name, value)); + if (status == ISC_R_SUCCESS || status == ISC_R_UNCHANGED) + return status; + } + + return ISC_R_NOTFOUND; +} + + +isc_result_t dhclient_interface_get_value (omapi_object_t *h, + omapi_object_t *id, + omapi_data_string_t *name, + omapi_value_t **value) +{ + return ISC_R_NOTIMPLEMENTED; +} + +isc_result_t dhclient_interface_destroy (omapi_object_t *h, + const char *file, int line) +{ + struct interface_info *interface; + isc_result_t status; + + if (h -> type != dhcp_type_interface) + return ISC_R_INVALIDARG; + interface = (struct interface_info *)h; + + + if (interface -> ifp) + free (interface -> ifp); + dfree (interface, file, line); + return ISC_R_SUCCESS; +} + +isc_result_t dhclient_interface_signal_handler (omapi_object_t *h, + const char *name, va_list ap) +{ + struct interface_info *ip, *interface; + struct client_config *config; + struct client_state *client; + + if (h -> type != dhcp_type_interface) + return ISC_R_INVALIDARG; + interface = (struct interface_info *)h; + + interface -> next = interfaces; + interfaces = interface; + + discover_interfaces (DISCOVER_UNCONFIGURED); + + for (ip = interfaces; ip; ip = ip -> next) { + /* If interfaces were specified, don't configure + interfaces that weren't specified! */ + if (ip -> flags & INTERFACE_RUNNING || + (ip -> flags & (INTERFACE_REQUESTED | + INTERFACE_AUTOMATIC)) != + INTERFACE_REQUESTED) + continue; + script_init (ip -> client, + "PREINIT", (struct string_list *)0); + if (ip -> client -> alias) + script_write_params (ip -> client, "alias_", + ip -> client -> alias); + script_go (ip -> client); + } + + discover_interfaces (interfaces_requested + ? DISCOVER_REQUESTED + : DISCOVER_RUNNING); + + for (ip = interfaces; ip; ip = ip -> next) { + if (ip -> flags & INTERFACE_RUNNING) + continue; + ip -> flags |= INTERFACE_RUNNING; + for (client = ip -> client; client; client = client -> next) { + client -> state = S_INIT; + /* Set up a timeout to start the initialization + process. */ + add_timeout (cur_time + random () % 5, + state_reboot, client); + } + } + return ISC_R_SUCCESS; +} + +isc_result_t dhclient_interface_stuff_values (omapi_object_t *c, + omapi_object_t *id, + omapi_object_t *h) +{ + struct interface_info *interface; + isc_result_t status; + + if (h -> type != dhcp_type_interface) + return ISC_R_INVALIDARG; + interface = (struct interface_info *)h; + + /* Write out all the values. */ + + status = omapi_connection_put_name (c, "state"); + if (status != ISC_R_SUCCESS) + return status; + if (interface -> flags && INTERFACE_REQUESTED) + status = omapi_connection_put_string (c, "up"); + else + status = omapi_connection_put_string (c, "down"); + if (status != ISC_R_SUCCESS) + return status; + + /* Write out the inner object, if any. */ + if (h -> inner && h -> inner -> type -> stuff_values) { + status = ((*(h -> inner -> type -> stuff_values)) + (c, id, h -> inner)); + if (status == ISC_R_SUCCESS) + return status; + } + + return ISC_R_SUCCESS; +} + +isc_result_t dhclient_interface_lookup (omapi_object_t **ip, + omapi_object_t *id, + omapi_object_t *ref) +{ + omapi_value_t *tv = (omapi_value_t *)0; + isc_result_t status; + struct interface_info *interface; + + /* First see if we were sent a handle. */ + status = omapi_get_value_str (ref, id, "handle", &tv); + if (status == ISC_R_SUCCESS) { + status = omapi_handle_td_lookup (ip, tv -> value); + + omapi_value_dereference (&tv, MDL); + if (status != ISC_R_SUCCESS) + return status; + + /* Don't return the object if the type is wrong. */ + if ((*ip) -> type != dhcp_type_interface) { + omapi_object_dereference (ip, MDL); + return ISC_R_INVALIDARG; + } + } + + /* Now look for an interface name. */ + status = omapi_get_value_str (ref, id, "name", &tv); + if (status == ISC_R_SUCCESS) { + for (interface = interfaces; interface; + interface = interface -> next) { + if (strncmp (interface -> name, + tv -> value -> u.buffer.value, + tv -> value -> u.buffer.len) == 0) + break; + } + omapi_value_dereference (&tv, MDL); + if (*ip && *ip != (omapi_object_t *)interface) { + omapi_object_dereference (ip, MDL); + return ISC_R_KEYCONFLICT; + } else if (!interface) { + if (*ip) + omapi_object_dereference (ip, MDL); + return ISC_R_NOTFOUND; + } else if (!*ip) + /* XXX fix so that hash lookup itself creates + XXX the reference. */ + omapi_object_reference (ip, + (omapi_object_t *)interface, + MDL); + } + + /* If we get to here without finding an interface, no valid key was + specified. */ + if (!*ip) + return ISC_R_NOKEYS; + return ISC_R_SUCCESS; +} + +/* actually just go discover the interface */ +isc_result_t dhclient_interface_create (omapi_object_t **lp, + omapi_object_t *id) +{ + struct interface_info *hp; + + hp = (struct interface_info *)dmalloc (sizeof (struct interface_info), + MDL); + if (!hp) + return ISC_R_NOMEMORY; + memset (hp, 0, sizeof *hp); + hp -> refcnt = 0; + hp -> type = dhcp_type_interface; + hp -> flags = INTERFACE_REQUESTED; + return omapi_object_reference (lp, (omapi_object_t *)hp, MDL); + +} + +isc_result_t dhclient_interface_remove (omapi_object_t *lp, + omapi_object_t *id) +{ + return ISC_R_NOTIMPLEMENTED; +} diff --git a/common/dhcp-options.cat5 b/common/dhcp-options.cat5 index f45205c2b..3275f2130 100644 --- a/common/dhcp-options.cat5 +++ b/common/dhcp-options.cat5 @@ -554,12 +554,8 @@ dhcpd-options(5) dhcpd-options(5) ooppttiioonn rroouutteerr--ssoolliicciittaattiioonn--aaddddrreessss _i_p_-_a_d_d_r_e_s_s;; - <<<<<<< dhcp-options.5 This option specifies a list of - IP addresses indicating NTP (RFC 1305) servers avail­ - able to the client. Servers should be listed in order - of preference. ======= This option specifies the - address to which the client should transmit router - solicitation requests. >>>>>>> 1.9 + This option specifies the address to which the client + should transmit router solicitation requests. ooppttiioonn rroouutteerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s... ];; @@ -586,6 +582,10 @@ dhcpd-options(5) dhcpd-options(5) ond address is the router for the destination. The default route (0.0.0.0) is an illegal destination + for a static route. To specify the default route, use + the rroouutteerrss option. Also, please note that this + option is not intended for classless IP routing - it + does not include a subnet mask. Since classless IP @@ -598,10 +598,6 @@ dhcpd-options(5) dhcpd-options(5) dhcpd-options(5) dhcpd-options(5) - for a static route. To specify the default route, use - the rroouutteerrss option. Also, please note that this - option is not intended for classless IP routing - it - does not include a subnet mask. Since classless IP routing is now the most widely deployed routing stan­ dard, this option is virtually useless, and is not implemented by any of the popular DHCP clients, for @@ -652,6 +648,10 @@ dhcpd-options(5) dhcpd-options(5) the client TCP should wait before sending a keepalive message on a TCP connection. The time is specified as a 32-bit unsigned integer. A value of zero indicates + that the client should not generate keepalive messages + on connections unless specifically requested by an + application. + @@ -664,10 +664,6 @@ dhcpd-options(5) dhcpd-options(5) dhcpd-options(5) dhcpd-options(5) - that the client should not generate keepalive messages - on connections unless specifically requested by an - application. - ooppttiioonn ttffttpp--sseerrvveerr--nnaammee _t_e_x_t;; This option is used to identify a TFTP server and, if @@ -718,21 +714,21 @@ dhcpd-options(5) dhcpd-options(5) whose contents are specific to the vendor and are not specified in a standard. To see what vendor class identifier a clients are sending, you can write the + following in your DHCP server configuration file: + set vendor-class option vendor-class-identifier; - 11 + 11 -dhcpd-options(5) dhcpd-options(5) - following in your DHCP server configuration file: +dhcpd-options(5) dhcpd-options(5) - set vendor-class option vendor-class-identifier; This will result in all entries in the DHCP server lease database file for clients that sent vendor-class- @@ -784,6 +780,10 @@ RREELLAAYY AAGGEENNTT IINNFFOORRMMAATTIIOONN OOPPTTIIO agent can add to a DHCP packet when relaying it to the DHCP server. The server can then make address allocation decisions (or whatever other decisions it wants) based on + these options. The server also returns these options in + any replies it sends through the relay agent, so that the + relay agent can use the information in these options for + delivery or accounting purposes. @@ -796,11 +796,6 @@ RREELLAAYY AAGGEENNTT IINNFFOORRMMAATTIIOONN OOPPTTIIO dhcpd-options(5) dhcpd-options(5) - these options. The server also returns these options in - any replies it sends through the relay agent, so that the - relay agent can use the information in these options for - delivery or accounting purposes. - The current draft defines two options. To reference these options in the dhcp server, specify the option space name, "agent", followed by a period, followed by the @@ -850,6 +845,11 @@ TTHHEE NNEETTWWAARREE//IIPP SSUUBBOOPPTTIIOONNSS addresses, each of which should be the IP address of a NetWare Domain SAP/RIP server (DSS). + ooppttiioonn nnwwiipp..nneeaarreesstt--nnwwiipp--sseerrvveerr _i_p_-_a_d_d_r_e_s_s + [,, _i_p_-_a_d_d_r_e_s_s...];; + + This suboption specifies a list of up to five IP + addresses, each of which should be the IP address of a @@ -862,11 +862,6 @@ TTHHEE NNEETTWWAARREE//IIPP SSUUBBOOPPTTIIOONNSS dhcpd-options(5) dhcpd-options(5) - ooppttiioonn nnwwiipp..nneeaarreesstt--nnwwiipp--sseerrvveerr _i_p_-_a_d_d_r_e_s_s - [,, _i_p_-_a_d_d_r_e_s_s...];; - - This suboption specifies a list of up to five IP - addresses, each of which should be the IP address of a Nearest NetWare IP server. ooppttiioonn nnwwiipp..aauuttoorreettrriieess _u_i_n_t_8;; @@ -917,6 +912,11 @@ DDEEFFIINNIINNGG NNEEWW OOPPTTIIOONNSS "local-host-name", feeling some confidence that no offi­ cial DHCP option name will ever start with "local". + Once you have chosen a name, you must choose a code. For + site-local options, all codes between 128 and 254 are + reserved for DHCP options, so you can pick any one of + these. In practice, some vendors have interpreted the + 14 @@ -928,10 +928,6 @@ DDEEFFIINNIINNGG NNEEWW OOPPTTIIOONNSS dhcpd-options(5) dhcpd-options(5) - Once you have chosen a name, you must choose a code. For - site-local options, all codes between 128 and 254 are - reserved for DHCP options, so you can pick any one of - these. In practice, some vendors have interpreted the protocol rather loosely and have used option code values greater than 128 themselves. There's no real way to avoid this problem, but it's not likely to cause too much @@ -982,6 +978,10 @@ dhcpd-options(5) dhcpd-options(5) IIPP--AADDDDRREESSSS + ooppttiioonn _n_e_w_-_n_a_m_e ccooddee _n_e_w_-_c_o_d_e == iipp--aaddddrreessss ;; + + An option whose structure is an IP address can be + expressed either as a domain name or as a dotted quad. So @@ -994,10 +994,6 @@ dhcpd-options(5) dhcpd-options(5) dhcpd-options(5) dhcpd-options(5) - ooppttiioonn _n_e_w_-_n_a_m_e ccooddee _n_e_w_-_c_o_d_e == iipp--aaddddrreessss ;; - - An option whose structure is an IP address can be - expressed either as a domain name or as a dotted quad. So the following is an example use of the ip-address type: option sql-server-address code 193 = ip-address; @@ -1048,6 +1044,10 @@ dhcpd-options(5) dhcpd-options(5) option contrived-001 code 201 = { boolean, integer 32, text }; option contrived-001 on 1772 "contrivance"; + It's also possible to have options that are arrays of + records, for example: + + option new-static-routes code 201 = array of { @@ -1060,10 +1060,6 @@ dhcpd-options(5) dhcpd-options(5) dhcpd-options(5) dhcpd-options(5) - It's also possible to have options that are arrays of - records, for example: - - option new-static-routes code 201 = array of { ip-address, ip-address, ip-address, integer 8 }; option static-routes 10.0.0.0 255.255.255.0 net-0-rtr.example.com 1, @@ -1114,6 +1110,10 @@ VVEENNDDOORR EENNCCAAPPSSUULLAATTEEDD OOPPTTIIOONNSS option SUNW.server-name code 3 = text; option SUNW.root-path code 4 = text; + Once you have defined an option space and the format of + some options, you can set up scopes that define values for + those options, and you can say when to use them. For + example, suppose you want to handle two different classes @@ -1126,10 +1126,6 @@ VVEENNDDOORR EENNCCAAPPSSUULLAATTEEDD OOPPTTIIOONNSS dhcpd-options(5) dhcpd-options(5) - Once you have defined an option space and the format of - some options, you can set up scopes that define values for - those options, and you can say when to use them. For - example, suppose you want to handle two different classes of clients. Using the option space definition shown in the previous example, you can send different option values to different clients based on the vendor-class-identifier @@ -1183,6 +1179,10 @@ AAUUTTHHOORR + + + + 18 diff --git a/common/discover.c b/common/discover.c index acb780a2e..e481e61c9 100644 --- a/common/discover.c +++ b/common/discover.c @@ -22,7 +22,7 @@ #ifndef lint static char copyright[] = -"$Id: discover.c,v 1.20 2000/01/26 14:55:33 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: discover.c,v 1.21 2000/01/28 20:30:31 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -47,7 +47,7 @@ omapi_object_type_t *dhcp_type_interface; void discover_interfaces (state) int state; { - struct interface_info *tmp; + struct interface_info *tmp, *ip; struct interface_info *last, *next; char buf [8192]; struct ifconf ic; @@ -161,6 +161,29 @@ void discover_interfaces (state) interfaces = tmp; } + /* See if we can find the client from dummy_interfaces */ + last = 0; + for (ip = dummy_interfaces; ip; ip = ip -> next) { + if (!strcmp (ip -> name, tmp -> name)) { + /* remove from dummy_interfaces */ + if (last) + last -> next = ip -> next; + else + dummy_interfaces = ip -> next; + /* copy "client" to tmp */ + if (ip -> client) { + tmp -> client = ip -> client; + tmp -> client -> interface = tmp; + } + /* free up the dummy_interface */ + if (ip -> ifp) + free (ip -> ifp); + dfree (ip, MDL); + break; + } + last = ip; + } + /* If we have the capability, extract link information and record it in a linked list. */ #ifdef HAVE_AF_LINK @@ -323,6 +346,27 @@ void discover_interfaces (state) tmp -> flags = ir; tmp -> next = interfaces; interfaces = tmp; + /* See if we can find the client from dummy_interfaces */ + last = 0; + for (ip = dummy_interfaces; ip; ip = ip -> next) { + if (!strcmp (ip -> name, tmp -> name)) { + /* remove from dummy_interfaces */ + if (last) + last -> next = ip -> next; + else + dummy_interfaces = ip -> next; + /* copy "client" to tmp */ + if (ip -> client) + tmp -> client = ip -> client; + /* free up the dummy_interface */ + if (ip -> ifp) + free (ip -> ifp); + dfree (ip, MDL); + ip = 0; + break; + } + last = ip; + } } fclose (proc_dev); } @@ -433,6 +477,9 @@ void discover_interfaces (state) last = (struct interface_info *)0; for (tmp = interfaces; tmp; tmp = next) { next = tmp -> next; + /* skip interfaces that are running already */ + if (tmp -> flags & INTERFACE_RUNNING) + continue; if ((tmp -> flags & INTERFACE_AUTOMATIC) && state == DISCOVER_REQUESTED) tmp -> flags &= ~(INTERFACE_AUTOMATIC | @@ -498,6 +545,9 @@ void discover_interfaces (state) /* Now register all the remaining interfaces as protocols. */ for (tmp = interfaces; tmp; tmp = tmp -> next) { + /* not if it's been registered before */ + if (tmp -> flags & INTERFACE_RUNNING) + continue; tmp -> refcnt = 1; tmp -> type = dhcp_type_interface; status = omapi_register_io_object ((omapi_object_t *)tmp, diff --git a/dhcpctl/Makefile.dist b/dhcpctl/Makefile.dist index 5305fe64e..92e557b82 100644 --- a/dhcpctl/Makefile.dist +++ b/dhcpctl/Makefile.dist @@ -27,12 +27,16 @@ DEBUG = -g INCLUDES = $(BINDINC) -I../includes CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) -all: libdhcpctl.a test $(CATMANPAGES) +all: libdhcpctl.a test cltest $(CATMANPAGES) test: test.o libdhcpctl.a ../omapip/libomapi.a $(CC) $(DEBUG) $(LFLAGS) -o test test.o libdhcpctl.a \ ../omapip/libomapi.a $(LIBS) +cltest: cltest.o libdhcpctl.a ../omapip/libomapi.a + $(CC) $(DEBUG) $(LFLAGS) -o cltest cltest.o libdhcpctl.a \ + ../omapip/libomapi.a $(LIBS) + libdhcpctl.a: $(OBJ) rm -f libdhcpctl.a ar cruv libdhcpctl.a $(OBJ) diff --git a/dhcpctl/cltest.c b/dhcpctl/cltest.c new file mode 100644 index 000000000..b6f1cde95 --- /dev/null +++ b/dhcpctl/cltest.c @@ -0,0 +1,85 @@ +/* cltest.c + + Example program that uses the dhcpctl library. */ + +#include +#include +#include +#include +#include +#include "dhcpctl.h" + +int main (int, char **); + +int main (argc, argv) + int argc; + char **argv; +{ + isc_result_t status, waitstatus; + dhcpctl_handle connection; + dhcpctl_handle host_handle, group_handle, interface_handle; + dhcpctl_data_string cid; + dhcpctl_data_string result, groupname, identifier; + int i; + + status = dhcpctl_initialize (); + if (status != ISC_R_SUCCESS) { + fprintf (stderr, "dhcpctl_initialize: %s\n", + isc_result_totext (status)); + exit (1); + } + + memset (&connection, 0, sizeof connection); + status = dhcpctl_connect (&connection, "127.0.0.1", 7911, + (dhcpctl_handle)0); + if (status != ISC_R_SUCCESS) { + fprintf (stderr, "dhcpctl_connect: %s\n", + isc_result_totext (status)); + exit (1); + } + + memset (&interface_handle, 0, sizeof interface_handle); + status = dhcpctl_new_object (&interface_handle, connection, "interface"); + if (status != ISC_R_SUCCESS) { + fprintf (stderr, "dhcpctl_new_object: %s\n", + isc_result_totext (status)); + exit (1); + } + + status = dhcpctl_set_string_value (interface_handle, argv[1], "name"); + if (status != ISC_R_SUCCESS) { + fprintf (stderr, "dhcpctl_set_value: %s\n", + isc_result_totext (status)); + exit (1); + } + + status = dhcpctl_open_object (interface_handle, connection, + DHCPCTL_CREATE | DHCPCTL_EXCL); + if (status != ISC_R_SUCCESS) { + fprintf (stderr, "dhcpctl_open_object: %s\n", + isc_result_totext (status)); + exit (1); + } + + status = dhcpctl_wait_for_completion (interface_handle, &waitstatus); + if (status != ISC_R_SUCCESS) { + fprintf (stderr, "dhcpctl_wait_for_completion: %s\n", + isc_result_totext (status)); + exit (1); + } + if (waitstatus != ISC_R_SUCCESS) { + fprintf (stderr, "interface object create: %s\n", + isc_result_totext (waitstatus)); + exit (1); + } + + memset (&result, 0, sizeof result); + status = dhcpctl_get_value (&result, interface_handle, "state"); + if (status != ISC_R_SUCCESS) { + fprintf (stderr, "dhcpctl_get_value: %s\n", + isc_result_totext (status)); + exit (1); + } + + exit (0); +} diff --git a/includes/dhcpd.h b/includes/dhcpd.h index 826a41f87..7d5feb968 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -689,6 +689,7 @@ struct interface_info { u_int32_t flags; /* Control flags... */ #define INTERFACE_REQUESTED 1 #define INTERFACE_AUTOMATIC 2 +#define INTERFACE_RUNNING 4 /* Only used by DHCP client code. */ struct client_state *client; @@ -1974,3 +1975,29 @@ isc_result_t dhcp_failover_update_peer (struct lease *, int); void failover_print PROTO ((char *, unsigned *, unsigned, const char *)); void update_partner PROTO ((struct lease *)); #endif /* FAILOVER_PROTOCOL */ + +/* client/omapi.c */ +void dhclient_db_objects_setup PROTO ((void)); +isc_result_t dhclient_interface_set_value (omapi_object_t *, + omapi_object_t *, + omapi_data_string_t *, + omapi_typed_data_t *); +isc_result_t dhclient_interface_get_value (omapi_object_t *, + omapi_object_t *, + omapi_data_string_t *, + omapi_value_t **); +isc_result_t dhclient_interface_destroy (omapi_object_t *, + const char *, int); +isc_result_t dhclient_interface_signal_handler (omapi_object_t *, + const char *, + va_list ap); +isc_result_t dhclient_interface_stuff_values (omapi_object_t *, + omapi_object_t *, + omapi_object_t *); +isc_result_t dhclient_interface_lookup (omapi_object_t **, + omapi_object_t *, + omapi_object_t *); +isc_result_t dhclient_interface_create (omapi_object_t **, + omapi_object_t *); +isc_result_t dhclient_interface_remove (omapi_object_t *, + omapi_object_t *); diff --git a/server/dhcpd.conf.cat5 b/server/dhcpd.conf.cat5 index e076b4cfa..cb619ae6b 100644 --- a/server/dhcpd.conf.cat5 +++ b/server/dhcpd.conf.cat5 @@ -558,7 +558,7 @@ dhcpd.conf(5) dhcpd.conf(5) ple of this is shown under the VENDOR ENCAPSULATED OPTIONS head later on in this document. -PPEERR--CCLLAASSSS AADDDDRREESSSS AASSSSIIGGNNMMEENNTT LLIIMMIITTSS +PPEERR--CCLLAASSSS LLIIMMIITTSS OONN DDYYNNAAMMIICC AADDDDRREESSSS AALLLLOOCCAATTIIOONN You may specify a limit to the number of clients in a class that can be assigned leases. The effect of this will be to make it difficult for a new client in a class @@ -630,32 +630,164 @@ dhcpd.conf(5) dhcpd.conf(5) ple is given only because it is a fairly straightforward one. -RREEFFEERREENNCCEE:: EEVVEENNTTSS - There are three kinds of events that can happen regarding - a lease, and it is possible to declare statements that - occur when any of these events happen. These events are - the commit event, when the server has made a commitment of - a certain lease to a client, the release event, when the - client has released the server from its commitment, and - the expiry event, when the commitment expires. +DDYYNNAAMMIICC DDNNSS UUPPDDAATTEESS + The DHCP server has the ability to dynamically update the + Domain Name System. Within the configuration files, you + can define how you want the Domain Name System to be + updated. These updates are RFC 2136 compliant so any DNS + server supporting RFC 2136 should be able to accept + updates from the DHCP server. The DHCP server will only + perform DNS updates if it has been built with DNS updates + enabled as described in the README file that comes with + the DHCP distribution. - Currently, only the commit event is fully supported. The - commit event occurs just before the DHCP server sends a - DHCPACK message to a DHCP client, or a BOOTREPLY message - to a BOOTP client. + The Dynamic DNS update scheme implemented in this version + of the ISC DHCP server is an interim implementation, which + does not implement any of the standard update methods that + have been discussed in the working group, but rather + implements some very basic, yet useful, update capabili­ + ties. - The release event is partially supported, but currently - will not occur if the server is restarted after the lease - is assigned. This will be fixed in the near future. + There are three parameters, which may vary according to + the scope, that control how DDNS updates will be done. + The first two are the _d_d_n_s_-_d_o_m_a_i_n_n_a_m_e and _d_d_n_s_-_r_e_v_-_d_o_m_a_i_n_­ + _n_a_m_e statements. The _d_d_n_s_-_d_o_m_a_i_n_n_a_m_e parameter sets the - The expiry event is not currently supported at all. This - will also be fixed in the reasonably near future. - To declare a set of statements to execute when an event + + 10 + + + + + +dhcpd.conf(5) dhcpd.conf(5) + + + domain name that will be appended to the client's hostname + to form a fully-qualified domain-name (FQDN). For exam­ + ple, if the client's hostname is "hutson" and the _d_d_n_s_- + _d_o_m_a_i_n_n_a_m_e is set to "sneedville.edu", then the client's + FQDN will be "hutson.sneedville.edu". + + The _d_d_n_s_-_r_e_v_-_d_o_m_a_i_n_n_a_m_e parameter sets the domain name + that will be appended to the client's reversed IP address + to produce a name for use in the client's PTR record. + Normally, you would set this to "in-addr.arpa", but this + is not required. + + A third parameter, _d_d_n_s_-_h_o_s_t_n_a_m_e can be used to specify + the hostname that will be used as the client's hostname. + If no ddns-hostname is specified in scope, then the server + will use a host-name option sent by the client. If the + client did not send a host-name option, then if there is a + host declaration that applies to the client, the name from + that declaration will be used. If none of these applies, + the server will not have a hostname for the client, and + will not be able to do a DDNS update. + +HHOOWW DDNNSS UUPPDDAATTEESS WWOORRKK + The client's FQDN, derived as we have described, is used + as the name on which an "A" record will be stored. The A + record will contain the IP address that the client was + assigned in its lease. If there is already an A record + with the same name in the DNS server, no update of either + the A or PTR records will occur - this prevents a client + from claiming that its hostname is the name of some net­ + work server. For example, if you have a fileserver + called "fs.sneedville.edu", and the client claims its + hostname is "fs", no DNS update will be done for that + client, and an error message will be logged. + + If the A record update succeeds, a PTR record update for + the assigned IP address will be done, pointing to the A + record. This update is unconditional - it will be done + even if another PTR record of the same name exists. + Since the IP address has been assigned to the DHCP server, + this should be safe. + + Please note that the current implementation assumes + clients only have a single network interface. A client + with two network interfaces will see unpredictable + behaviour. This is considered a bug, and will be fixed + in a later release. It may be helpful to enable the _o_n_e_- + _l_e_a_s_e_-_p_e_r_-_c_l_i_e_n_t parameter so that roaming clients do not + trigger this same behavior. + + The DHCP protocol normally involves a four-packet exchange + - first the client sends a DHCPDISCOVER message, then the + server sends a DHCPOFFER, then the client sends a DHCPRE­ + QUEST, then the server sends a DHCPACK. In the current + + + + 11 + - 10 + +dhcpd.conf(5) dhcpd.conf(5) + + + version of the server, the server will do a DNS update + after it has received the DHCPREQUEST, and before it has + sent the DHCPOFFER. It only sends the DNS update if it + has not sent one for the client's address before, in order + to minimize the impact on the DHCP server. + + When the client's lease expires, the DHCP server (if it is + operating at the time, or when next it operates) will + remove the client's A and PTR records from the DNS + database. If the client releases its lease by sending a + DHCPRELEASE message, the server will likewise remove the A + and PTR records. + +DDYYNNAAMMIICC DDNNSS UUPPDDAATTEE SSEECCUURRIITTYY + Support for TSIG and DNSSEC is not yet available. When + you set your DNS server up to allow updates from the DHCP + server, you may be exposing it to unauthorized updates. + To avoid this, the best you can do right now is to use IP + address-based packet filtering to prevent unauthorized + hosts from submitting update requests. + + The DNS server must be configured to allow updates for any + zone that the DHCP server will be updating. For example, + let us say that clients in the sneedville.edu domain will + be assigned addresses on the 10.10.17.0/24 subnet. In + that case, assuming you are using ISC BIND 8.2.1 or later, + you would need to have the following declarations in your + /etc/named.conf file: + + zone "sneedville.edu" { + type master; + file "sneedville.edu.db"; + allow-update { localhost; }; + }; + + zone "17.10.10.in-addr.arpa" { + type master; + file "10.10.17.db"; + allow-update { localhost; }; + }; + + This assumes that your DHCP server and your name server + will be running on the same computer - the "localhost" + name is taken in the DNS server as an alias for all of + that host's IP addresses, and updates from any of those + addresses will be accepted. + + You may wish to enable logging of DNS transactions on your + DNS server. To do so, you might write a logging statement + like the following: + + logging { + channel update_debug { + file "/var/log/update-debug.log"; + + + + 12 @@ -664,25 +796,44 @@ RREEFFEERREENNCCEE:: EEVVEENNTTSS dhcpd.conf(5) dhcpd.conf(5) - happens, you must use the oonn statement, followed by the - name of the event, followed by a series of statements to - execute when the event happens, enclosed in braces. For - example: - - on commit { - if dns-update ("a", - concat (option host-name, ".ssd.example.net"), - binary-to-ascii (10, 8, ".", leased-address), - lease-time) { - if dns-update ("ptr", concat(binary-to-ascii(10, 8, ".", - reverse(1, leased-address)), - ".in-addr.arpa"), - concat (option host-name, - ".ssd.example.net"), - lease-time) { - } - } - } + severity debug 3; + print-category yes; + print-severity yes; + print-time yes; + }; + channel security_info { + file "/var/log/named-auth.info"; + severity info; + print-category yes; + print-severity yes; + print-time yes; + }; + + category update { update_debug; }; + category security { security_info; }; + }; + + You must create the /var/log/named-auth.info and + /var/log/update-debug.log files before starting the name + server. For more information on configuring ISC BIND, + consult the documentation that accompanies it. + +RREEFFEERREENNCCEE:: EEVVEENNTTSS + There are three kinds of events that can happen regarding + a lease, and it is possible to declare statements that + occur when any of these events happen. These events are + the commit event, when the server has made a commitment of + a certain lease to a client, the release event, when the + client has released the server from its commitment, and + the expiry event, when the commitment expires. + + To declare a set of statements to execute when an event + happens, you must use the oonn statement, followed by the + name of the event, followed by a series of statements to + execute when the event happens, enclosed in braces. + Events are used to implement dynamic DNS updates, so you + should not define your own event handlers if you are using + the built-in dynamic DNS update mechanism. RREEFFEERREENNCCEE:: DDEECCLLAARRAATTIIOONNSS TThhee _s_h_a_r_e_d_-_n_e_t_w_o_r_k ssttaatteemmeenntt @@ -692,63 +843,64 @@ RREEFFEERREENNCCEE:: DDEECCLLAARRAATTIIOONNSS [ _d_e_c_l_a_r_a_t_i_o_n_s ] }} - The _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement is used to inform the DHCP + The _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement is used to inform the DHCP server that some IP subnets actually share the same physi­ - cal network. Any subnets in a shared network should be - declared within a _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement. Parameters - specified in the _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement will be used - when booting clients on those subnets unless parameters - provided at the subnet or host level override them. If - any subnet in a shared network has addresses available for - dynamic allocation, those addresses are collected into a - common pool for that shared network and assigned to - clients as needed. There is no way to distinguish on - which subnet of a shared network a client should boot. + cal network. Any subnets in a shared network should be + declared within a _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement. Parameters + specified in the _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement will be used + when booting clients on those subnets unless parameters + provided at the subnet or host level override them. If - _N_a_m_e should be the name of the shared network. This name - is used when printing debugging messages, so it should be - descriptive for the shared network. The name may have - the syntax of a valid domain name (although it will never - be used as such), or it may be any arbitrary name, - enclosed in quotes. - TThhee _s_u_b_n_e_t ssttaatteemmeenntt - ssuubbnneett _s_u_b_n_e_t_-_n_u_m_b_e_r nneettmmaasskk _n_e_t_m_a_s_k {{ - [ _p_a_r_a_m_e_t_e_r_s ] - [ _d_e_c_l_a_r_a_t_i_o_n_s ] - }} + 13 - 11 +dhcpd.conf(5) dhcpd.conf(5) + any subnet in a shared network has addresses available for + dynamic allocation, those addresses are collected into a + common pool for that shared network and assigned to + clients as needed. There is no way to distinguish on + which subnet of a shared network a client should boot. -dhcpd.conf(5) dhcpd.conf(5) + _N_a_m_e should be the name of the shared network. This name + is used when printing debugging messages, so it should be + descriptive for the shared network. The name may have + the syntax of a valid domain name (although it will never + be used as such), or it may be any arbitrary name, + enclosed in quotes. + TThhee _s_u_b_n_e_t ssttaatteemmeenntt - The _s_u_b_n_e_t statement is used to provide dhcpd with enough - information to tell whether or not an IP address is on - that subnet. It may also be used to provide subnet-spe­ - cific parameters and to specify what addresses may be - dynamically allocated to clients booting on that subnet. - Such addresses are specified using the _r_a_n_g_e declaration. + ssuubbnneett _s_u_b_n_e_t_-_n_u_m_b_e_r nneettmmaasskk _n_e_t_m_a_s_k {{ + [ _p_a_r_a_m_e_t_e_r_s ] + [ _d_e_c_l_a_r_a_t_i_o_n_s ] + }} + + The _s_u_b_n_e_t statement is used to provide dhcpd with enough + information to tell whether or not an IP address is on + that subnet. It may also be used to provide subnet-spe­ + cific parameters and to specify what addresses may be + dynamically allocated to clients booting on that subnet. + Such addresses are specified using the _r_a_n_g_e declaration. - The _s_u_b_n_e_t_-_n_u_m_b_e_r should be an IP address or domain name - which resolves to the subnet number of the subnet being + The _s_u_b_n_e_t_-_n_u_m_b_e_r should be an IP address or domain name + which resolves to the subnet number of the subnet being described. The _n_e_t_m_a_s_k should be an IP address or domain name which resolves to the subnet mask of the subnet being described. The subnet number, together with the netmask, - are sufficient to determine whether any given IP address + are sufficient to determine whether any given IP address is on the specified subnet. - Although a netmask must be given with every subnet decla­ + Although a netmask must be given with every subnet decla­ ration, it is recommended that if there is any variance in - subnet masks at a site, a subnet-mask option statement be - used in each subnet declaration to set the desired subnet + subnet masks at a site, a subnet-mask option statement be + used in each subnet declaration to set the desired subnet mask, since any subnet-mask option statement will override the subnet mask declared in the subnet statement. @@ -757,65 +909,65 @@ dhcpd.conf(5) dhcpd.conf(5) rraannggee [ ddyynnaammiicc--bboooottpp ] _l_o_w_-_a_d_d_r_e_s_s [ _h_i_g_h_-_a_d_d_r_e_s_s];; For any subnet on which addresses will be assigned dynami­ - cally, there must be at least one _r_a_n_g_e statement. The - range statement gives the lowest and highest IP addresses - in a range. All IP addresses in the range should be in + cally, there must be at least one _r_a_n_g_e statement. The + range statement gives the lowest and highest IP addresses + in a range. All IP addresses in the range should be in the subnet in which the _r_a_n_g_e statement is declared. The - _d_y_n_a_m_i_c_-_b_o_o_t_p flag may be specified if addresses in the - specified range may be dynamically assigned to BOOTP - clients as well as DHCP clients. When specifying a sin­ - gle address, _h_i_g_h_-_a_d_d_r_e_s_s can be omitted. + _d_y_n_a_m_i_c_-_b_o_o_t_p flag may be specified if addresses in the + specified range may be dynamically assigned to BOOTP + clients as well as DHCP clients. When specifying a - TThhee _h_o_s_t ssttaatteemmeenntt - hhoosstt _h_o_s_t_n_a_m_e { - [ _p_a_r_a_m_e_t_e_r_s ] - [ _d_e_c_l_a_r_a_t_i_o_n_s ] - }} - There must be at least one hhoosstt statement for every BOOTP - client that is to be served. hhoosstt statements may also be - specified for DHCP clients, although this is not required - unless booting is only enabled for known hosts. + 14 - If it is desirable to be able to boot a DHCP or BOOTP - client on more than one subnet with fixed addresses, more - than one address may be specified in the _f_i_x_e_d_-_a_d_d_r_e_s_s - parameter, or more than one hhoosstt statement may be speci­ - fied. - 12 +dhcpd.conf(5) dhcpd.conf(5) + single address, _h_i_g_h_-_a_d_d_r_e_s_s can be omitted. + TThhee _h_o_s_t ssttaatteemmeenntt + hhoosstt _h_o_s_t_n_a_m_e { + [ _p_a_r_a_m_e_t_e_r_s ] + [ _d_e_c_l_a_r_a_t_i_o_n_s ] + }} -dhcpd.conf(5) dhcpd.conf(5) + There must be at least one hhoosstt statement for every BOOTP + client that is to be served. hhoosstt statements may also be + specified for DHCP clients, although this is not required + unless booting is only enabled for known hosts. + If it is desirable to be able to boot a DHCP or BOOTP + client on more than one subnet with fixed addresses, more + than one address may be specified in the _f_i_x_e_d_-_a_d_d_r_e_s_s + parameter, or more than one hhoosstt statement may be speci­ + fied. - If client-specific boot parameters must change based on + If client-specific boot parameters must change based on the network to which the client is attached, then multiple hhoosstt statements should be used. - If a client is to be booted using a fixed address if it's + If a client is to be booted using a fixed address if it's possible, but should be allocated a dynamic address other­ - wise, then a hhoosstt statement must be specified without a + wise, then a hhoosstt statement must be specified without a ffiixxeedd--aaddddrreessss clause. _h_o_s_t_n_a_m_e should be a name identify­ - ing the host. If a _h_o_s_t_n_a_m_e option is not specified for + ing the host. If a _h_o_s_t_n_a_m_e option is not specified for the host, _h_o_s_t_n_a_m_e is used. - _H_o_s_t declarations are matched to actual DHCP or BOOTP + _H_o_s_t declarations are matched to actual DHCP or BOOTP clients by matching the dhcp-client-identifier option - specified in the _h_o_s_t declaration to the one supplied by + specified in the _h_o_s_t declaration to the one supplied by the client, or, if the _h_o_s_t declaration or the client does - not provide a dhcp-client-identifier option, by matching + not provide a dhcp-client-identifier option, by matching the _h_a_r_d_w_a_r_e parameter in the _h_o_s_t declaration to the net­ - work hardware address supplied by the client. BOOTP - clients do not normally provide a _d_h_c_p_-_c_l_i_e_n_t_-_i_d_e_n_t_i_f_i_e_r, - so the hardware address must be used for all clients that + work hardware address supplied by the client. BOOTP + clients do not normally provide a _d_h_c_p_-_c_l_i_e_n_t_-_i_d_e_n_t_i_f_i_e_r, + so the hardware address must be used for all clients that may boot using the BOOTP protocol. TThhee _g_r_o_u_p ssttaatteemmeenntt @@ -825,50 +977,50 @@ dhcpd.conf(5) dhcpd.conf(5) [ _d_e_c_l_a_r_a_t_i_o_n_s ] }} - The group statement is used simply to apply one or more + The group statement is used simply to apply one or more parameters to a group of declarations. It can be used to - group hosts, shared networks, subnets, or even other + group hosts, shared networks, subnets, or even other groups. -RREEFFEERREENNCCEE:: AALLLLOOWW AANNDD DDEENNYY - The _a_l_l_o_w and _d_e_n_y statements can be used to control the - response of the DHCP server to various sorts of requests. - The allow and deny keywords actually have different mean­ - ings depending on the context. In a pool context, these - keywords can be used to set up access lists for address - allocation pools. In other contexts, the keywords simply - control general server behaviour with respect to clients - based on scope. In a non-pool context, the _i_g_n_o_r_e key­ - word can be used in place of the _d_e_n_y keyword to prevent - logging of denied requests. -AALLLLOOWW DDEENNYY AANNDD IIGGNNOORREE IINN SSCCOOPPEE - The following usages of allow and deny will work in any - scope, although it is not recommended that they be used in - pool declarations. - TThhee _u_n_k_n_o_w_n_-_c_l_i_e_n_t_s kkeeyywwoorrdd + 15 - 13 +dhcpd.conf(5) dhcpd.conf(5) +RREEFFEERREENNCCEE:: AALLLLOOWW AANNDD DDEENNYY + The _a_l_l_o_w and _d_e_n_y statements can be used to control the + response of the DHCP server to various sorts of requests. + The allow and deny keywords actually have different mean­ + ings depending on the context. In a pool context, these + keywords can be used to set up access lists for address + allocation pools. In other contexts, the keywords simply + control general server behaviour with respect to clients + based on scope. In a non-pool context, the _i_g_n_o_r_e key­ + word can be used in place of the _d_e_n_y keyword to prevent + logging of denied requests. -dhcpd.conf(5) dhcpd.conf(5) +AALLLLOOWW DDEENNYY AANNDD IIGGNNOORREE IINN SSCCOOPPEE + The following usages of allow and deny will work in any + scope, although it is not recommended that they be used in + pool declarations. + TThhee _u_n_k_n_o_w_n_-_c_l_i_e_n_t_s kkeeyywwoorrdd aallllooww uunnkknnoowwnn--cclliieennttss;; ddeennyy uunnkknnoowwnn--cclliieennttss;; iiggnnoorree uunnkknnoowwnn--cclliieennttss;; - The uunnkknnoowwnn--cclliieennttss flag is used to tell dhcpd whether or - not to dynamically assign addresses to unknown clients. - Dynamic address assignment to unknown clients is aalllloowwed + The uunnkknnoowwnn--cclliieennttss flag is used to tell dhcpd whether or + not to dynamically assign addresses to unknown clients. + Dynamic address assignment to unknown clients is aalllloowwed by default. TThhee _b_o_o_t_p kkeeyywwoorrdd @@ -877,8 +1029,8 @@ dhcpd.conf(5) dhcpd.conf(5) ddeennyy bboooottpp;; iiggnnoorree bboooottpp;; - The bboooottpp flag is used to tell dhcpd whether or not to - respond to bootp queries. Bootp queries are aalllloowwed by + The bboooottpp flag is used to tell dhcpd whether or not to + respond to bootp queries. Bootp queries are aalllloowwed by default. TThhee _b_o_o_t_i_n_g kkeeyywwoorrdd @@ -887,182 +1039,185 @@ dhcpd.conf(5) dhcpd.conf(5) ddeennyy bboooottiinngg;; iiggnnoorree bboooottiinngg;; - The bboooottiinngg flag is used to tell dhcpd whether or not to + The bboooottiinngg flag is used to tell dhcpd whether or not to respond to queries from a particular client. This keyword - only has meaning when it appears in a host declaration. - By default, booting is aalllloowwed, but if it is disabled for - a particular client, then that client will not be able to + only has meaning when it appears in a host declaration. + By default, booting is aalllloowwed, but if it is disabled for + a particular client, then that client will not be able to get and address from the DHCP server. TThhee _d_u_p_l_i_c_a_t_e_s kkeeyy­­ wwoorrdd aallllooww dduupplliiccaatteess;; - ddeennyy dduupplliiccaatteess;; - Host declarations can match client messages based on the - DHCP Client Identifer option or based on the client's net­ - work hardware type and MAC address. If the MAC address - is used, the host declaration will match any client with - that MAC address - even clients with different client - identifiers. This doesn't normally happen, but is possi­ - ble when one computer has more than one operating system - installed on it - for example, Microsoft Windows and - NetBSD or Linux. - The dduupplliiccaatteess flag tells the DHCP server that if a - request is received from a client that matches the MAC - address of a host declaration, any other leases matching - that MAC address should be discarded by the server, even - if the UID is not the same. This is a violation of the - DHCP protocol, but can prevent clients whose client iden­ - tifiers change regularly from holding many leases at the - same time. By default, duplicates are aalllloowwed. TThhee + 16 - 14 +dhcpd.conf(5) dhcpd.conf(5) -dhcpd.conf(5) dhcpd.conf(5) + ddeennyy dduupplliiccaatteess;; + Host declarations can match client messages based on the + DHCP Client Identifer option or based on the client's net­ + work hardware type and MAC address. If the MAC address + is used, the host declaration will match any client with + that MAC address - even clients with different client + identifiers. This doesn't normally happen, but is possi­ + ble when one computer has more than one operating system + installed on it - for example, Microsoft Windows and + NetBSD or Linux. + The dduupplliiccaatteess flag tells the DHCP server that if a + request is received from a client that matches the MAC + address of a host declaration, any other leases matching + that MAC address should be discarded by the server, even + if the UID is not the same. This is a violation of the + DHCP protocol, but can prevent clients whose client iden­ + tifiers change regularly from holding many leases at the + same time. By default, duplicates are aalllloowwed. TThhee _d_e_c_l_i_n_e_s kkeeyywwoorrdd aallllooww ddeecclliinneess;; ddeennyy ddeecclliinneess;; iiggnnoorree ddeecclliinneess;; - The DHCPDECLINE message is used by DHCP clients to indi­ - cate that the lease the server has offered is not valid. - When the server receives a DHCPDECLINE for a particular - address, it normally abandons that address, assuming that - some unauthorized system is using it. Unfortunately, a + The DHCPDECLINE message is used by DHCP clients to indi­ + cate that the lease the server has offered is not valid. + When the server receives a DHCPDECLINE for a particular + address, it normally abandons that address, assuming that + some unauthorized system is using it. Unfortunately, a malicious or buggy client can, using DHCPDECLINE messages, - completely exhaust the DHCP server's allocation pool. + completely exhaust the DHCP server's allocation pool. The server will reclaim these leases, but while the client - is running through the pool, it may cause serious thrash­ - ing in the DNS, and it will also cause the DHCP server to + is running through the pool, it may cause serious thrash­ + ing in the DNS, and it will also cause the DHCP server to forget old DHCP client address allocations. - The ddeecclliinneess flag tells the DHCP server whether or not to - honor DHCPDECLINE messages. If it is set to ddeennyy or - iiggnnoorree in a particular scope, the DHCP server will not + The ddeecclliinneess flag tells the DHCP server whether or not to + honor DHCPDECLINE messages. If it is set to ddeennyy or + iiggnnoorree in a particular scope, the DHCP server will not respond to DHCPDECLINE messages. AALLLLOOWW AANNDD DDEENNYY WWIITTHHIINN PPOOOOLL DDEECCLLAARRAATTIIOONNSS The uses of the allow and deny keyword shown in the previ­ - ous section work pretty much the same way whether the - client is sending a DHCPDISCOVER or a DHCPREQUEST message - - an address will be allocated to the client (either the - old address it's requesting, or a new address) and then + ous section work pretty much the same way whether the + client is sending a DHCPDISCOVER or a DHCPREQUEST message + - an address will be allocated to the client (either the + old address it's requesting, or a new address) and then that address will be tested to see if it's okay to let the client have it. If the client requested it, and it's not okay, the server will send a DHCPNAK message. Otherwise, - the server will simply not respond to the client. If it + the server will simply not respond to the client. If it is okay to give the address to the client, the server will - send a DHCPACK message. - The primary motivation behind pool declarations is to have - address allocation pools whose allocation policies are - different. A client may be denied access to one pool, - but allowed access to another pool on the same network - segment. In order for this to work, access control has - to be done during address allocation, not after address - allocation is done. - When a DHCPREQUEST message is processed, address alloca­ - tion simply consists of looking up the address the client - is requesting and seeing if it's still available for the - client. If it is, then the DHCP server checks both the - address pool permit lists and the relevant in-scope allow - and deny statements to see if it's okay to give the lease - to the client. In the case of a DHCPDISCOVER message, the - allocation process is done as described previously in the - ADDRESS ALLOCATION section. + 17 - 15 +dhcpd.conf(5) dhcpd.conf(5) + send a DHCPACK message. -dhcpd.conf(5) dhcpd.conf(5) + The primary motivation behind pool declarations is to have + address allocation pools whose allocation policies are + different. A client may be denied access to one pool, + but allowed access to another pool on the same network + segment. In order for this to work, access control has + to be done during address allocation, not after address + allocation is done. + When a DHCPREQUEST message is processed, address alloca­ + tion simply consists of looking up the address the client + is requesting and seeing if it's still available for the + client. If it is, then the DHCP server checks both the + address pool permit lists and the relevant in-scope allow + and deny statements to see if it's okay to give the lease + to the client. In the case of a DHCPDISCOVER message, the + allocation process is done as described previously in the + ADDRESS ALLOCATION section. - When declaring permit lists for address allocation pools, - the following syntaxes are recognized following the allow + When declaring permit lists for address allocation pools, + the following syntaxes are recognized following the allow or deny keyword: kknnoowwnn cclliieennttss;; - If specified, this statement either allows or prevents - allocation from this pool to any client that has a host - declaration (i.e., is known). + If specified, this statement either allows or prevents + allocation from this pool to any client that has a host + declaration (i.e., is known). A client is known if it has + a host declaration in _a_n_y scope, not just the current + scope. uunnkknnoowwnn cclliieennttss;; - If specified, this statement either allows or prevents - allocation from this pool to any client that has no host + If specified, this statement either allows or prevents + allocation from this pool to any client that has no host declaration (i.e., is not known). mmeemmbbeerrss ooff ""class"";; - If specified, this statement either allows or prevents - allocation from this pool to any client that is a member + If specified, this statement either allows or prevents + allocation from this pool to any client that is a member of the named class. ddyynnaammiicc bboooottpp cclliieennttss;; - If specified, this statement either allows or prevents + If specified, this statement either allows or prevents allocation from this pool to any bootp client. aauutthheennttiiccaatteedd cclliieennttss;; - If specified, this statement either allows or prevents - allocation from this pool to any client that has been + If specified, this statement either allows or prevents + allocation from this pool to any client that has been authenticated using the DHCP authentication protocol. - This is not yet supported. - uunnaauutthheennttiiccaatteedd cclliieennttss;; - If specified, this statement either allows or prevents - allocation from this pool to any client that has not been - authenticated using the DHCP authentication protocol. - This is not yet supported. - aallll cclliieennttss;; + 18 - If specified, this statement either allows or prevents - allocation from this pool to all clients. This can be - used when you want to write a pool declaration for some - reason, but hold it in reserve, or when you want to renum­ - ber your network quickly, and thus want the server to - force all clients that have been allocated addresses from - this pool to obtain new addresses immediately when they - next renew. -RREEFFEERREENNCCEE:: PPAARRAAMMEETTEERRSS - TThhee _l_e_a_s_e_-_f_i_l_e_-_n_a_m_e ssttaatteemmeenntt - 16 +dhcpd.conf(5) dhcpd.conf(5) + This is not yet supported. + uunnaauutthheennttiiccaatteedd cclliieennttss;; + If specified, this statement either allows or prevents + allocation from this pool to any client that has not been + authenticated using the DHCP authentication protocol. + This is not yet supported. -dhcpd.conf(5) dhcpd.conf(5) + aallll cclliieennttss;; + If specified, this statement either allows or prevents + allocation from this pool to all clients. This can be + used when you want to write a pool declaration for some + reason, but hold it in reserve, or when you want to renum­ + ber your network quickly, and thus want the server to + force all clients that have been allocated addresses from + this pool to obtain new addresses immediately when they + next renew. + +RREEFFEERREENNCCEE:: PPAARRAAMMEETTEERRSS + TThhee _l_e_a_s_e_-_f_i_l_e_-_n_a_m_e ssttaatteemmeenntt lleeaassee--ffiillee--nnaammee _n_a_m_e;; - _N_a_m_e should be the name of the DHCP server's lease file. + _N_a_m_e should be the name of the DHCP server's lease file. By default, this is /var/db/dhcpd.leases. This statement mmuusstt appear in the outer scope of the configuration file - if it appears in some other scope, it will have no effect. @@ -1071,11 +1226,11 @@ dhcpd.conf(5) dhcpd.conf(5) ppiidd--ffiillee--nnaammee _n_a_m_e;; - _N_a_m_e should be the name of the DHCP server's process ID - file. This is the file in which the DHCP server's pro­ - cess ID is stored when the server starts. By default, - this is /var/run/dhcpd.pid. Like the lease-file-name - statement, this statement must appear in the outer scope + _N_a_m_e should be the name of the DHCP server's process ID + file. This is the file in which the DHCP server's pro­ + cess ID is stored when the server starts. By default, + this is /var/run/dhcpd.pid. Like the lease-file-name + statement, this statement must appear in the outer scope of the configuration file. TThhee _d_e_f_a_u_l_t_-_l_e_a_s_e_-_t_i_m_e ssttaatteemmeenntt @@ -1090,74 +1245,87 @@ dhcpd.conf(5) dhcpd.conf(5) mmaaxx--lleeaassee--ttiimmee _t_i_m_e;; - _T_i_m_e should be the maximum length in seconds that will be - assigned to a lease. The only exception to this is that - Dynamic BOOTP lease lengths, which are not specified by + _T_i_m_e should be the maximum length in seconds that will be + + + + 19 + + + + + +dhcpd.conf(5) dhcpd.conf(5) + + + assigned to a lease. The only exception to this is that + Dynamic BOOTP lease lengths, which are not specified by the client, are not limited by this maximum. TThhee _m_i_n_-_l_e_a_s_e_-_t_i_m_e ssttaatteemmeenntt mmiinn--lleeaassee--ttiimmee _t_i_m_e;; - _T_i_m_e should be the minimum length in seconds that will be + _T_i_m_e should be the minimum length in seconds that will be assigned to a lease. TThhee _m_i_n_-_s_e_c_s ssttaatteemmeenntt mmiinn--sseeccss _s_e_c_o_n_d_s;; - _S_e_c_o_n_d_s should be the minimum number of seconds since a + _S_e_c_o_n_d_s should be the minimum number of seconds since a client began trying to acquire a new lease before the DHCP server will respond to its request. The number of seconds is based on what the client reports, and the maximum value - that the client can report is 255 seconds. Generally, - setting this to one will result in the DHCP server not - responding to the client's first request, but always + that the client can report is 255 seconds. Generally, + setting this to one will result in the DHCP server not + responding to the client's first request, but always responding to its second request. + This can be used to set up a secondary DHCP server which + never offers an address to a client until the primary + server has been given a chance to do so. If the primary + server is down, the client will bind to the secondary + server, but otherwise clients should always bind to the + primary. Note that this does not, by itself, permit a + primary server and a secondary server to share a pool of + dynamically-allocatable addresses. + TThhee _h_a_r_d_w_a_r_e ssttaatteemmeenntt - 17 + hhaarrddwwaarree _h_a_r_d_w_a_r_e_-_t_y_p_e _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s;; + + In order for a BOOTP client to be recognized, its network + hardware address must be declared using a _h_a_r_d_w_a_r_e clause + in the _h_o_s_t statement. _h_a_r_d_w_a_r_e_-_t_y_p_e must be the name of + a physical hardware interface type. Currently, only the + eetthheerrnneett and ttookkeenn--rriinngg types are recognized, although + support for a ffddddii hardware type (and others) would also + be desirable. The _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s should be a set of + hexadecimal octets (numbers from 0 through ff) seperated + by colons. The _h_a_r_d_w_a_r_e statement may also be used for + DHCP clients. + TThhee _f_i_l_e_n_a_m_e ssttaatteemmeenntt + ffiilleennaammee ""_f_i_l_e_n_a_m_e"";; + The _f_i_l_e_n_a_m_e statement can be used to specify the name of + the initial boot file which is to be loaded by a client. -dhcpd.conf(5) dhcpd.conf(5) + 20 - This can be used to set up a secondary DHCP server which - never offers an address to a client until the primary - server has been given a chance to do so. If the primary - server is down, the client will bind to the secondary - server, but otherwise clients should always bind to the - primary. Note that this does not, by itself, permit a - primary server and a secondary server to share a pool of - dynamically-allocatable addresses. - TThhee _h_a_r_d_w_a_r_e ssttaatteemmeenntt - hhaarrddwwaarree _h_a_r_d_w_a_r_e_-_t_y_p_e _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s;; - In order for a BOOTP client to be recognized, its network - hardware address must be declared using a _h_a_r_d_w_a_r_e clause - in the _h_o_s_t statement. _h_a_r_d_w_a_r_e_-_t_y_p_e must be the name of - a physical hardware interface type. Currently, only the - eetthheerrnneett and ttookkeenn--rriinngg types are recognized, although - support for a ffddddii hardware type (and others) would also - be desirable. The _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s should be a set of - hexadecimal octets (numbers from 0 through ff) seperated - by colons. The _h_a_r_d_w_a_r_e statement may also be used for - DHCP clients. - TThhee _f_i_l_e_n_a_m_e ssttaatteemmeenntt +dhcpd.conf(5) dhcpd.conf(5) - ffiilleennaammee ""_f_i_l_e_n_a_m_e"";; - The _f_i_l_e_n_a_m_e statement can be used to specify the name of - the initial boot file which is to be loaded by a client. The _f_i_l_e_n_a_m_e should be a filename recognizable to whatever - file transfer protocol the client can be expected to use + file transfer protocol the client can be expected to use to load the file. TThhee _s_e_r_v_e_r_-_n_a_m_e ssttaatteemmeenntt @@ -1172,36 +1340,25 @@ dhcpd.conf(5) dhcpd.conf(5) nneexxtt--sseerrvveerr _s_e_r_v_e_r_-_n_a_m_e;; - The _n_e_x_t_-_s_e_r_v_e_r statement is used to specify the host - address of the server from which the initial boot file - (specified in the _f_i_l_e_n_a_m_e statement) is to be loaded. - _S_e_r_v_e_r_-_n_a_m_e should be a numeric IP address or a domain - name. If no _n_e_x_t_-_s_e_r_v_e_r parameter applies to a given + The _n_e_x_t_-_s_e_r_v_e_r statement is used to specify the host + address of the server from which the initial boot file + (specified in the _f_i_l_e_n_a_m_e statement) is to be loaded. + _S_e_r_v_e_r_-_n_a_m_e should be a numeric IP address or a domain + name. If no _n_e_x_t_-_s_e_r_v_e_r parameter applies to a given client, the DHCP server's IP address is used. TThhee _f_i_x_e_d_-_a_d_d_r_e_s_s ssttaatteemmeenntt - - - 18 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - ffiixxeedd--aaddddrreessss _a_d_d_r_e_s_s [,, _a_d_d_r_e_s_s ... ];; - The _f_i_x_e_d_-_a_d_d_r_e_s_s statement is used to assign one or more - fixed IP addresses to a client. It should only appear in + The _f_i_x_e_d_-_a_d_d_r_e_s_s statement is used to assign one or more + fixed IP addresses to a client. It should only appear in a _h_o_s_t declaration. If more than one address is supplied, - then when the client boots, it will be assigned the - address which corresponds to the network on which it is - booting. If none of the addresses in the _f_i_x_e_d_-_a_d_d_r_e_s_s - statement are on the network on which the client is boot­ - ing, that client will not match the _h_o_s_t declaration con­ + then when the client boots, it will be assigned the + address which corresponds to the network on which it is + booting. If none of the addresses in the _f_i_x_e_d_-_a_d_d_r_e_s_s + statement are on the network on which the client is boot­ + ing, that client will not match the _h_o_s_t declaration con­ taining that _f_i_x_e_d_-_a_d_d_r_e_s_s statement. Each _a_d_d_r_e_s_s should be either an IP address or a domain name which resolves to one or more IP addresses. @@ -1210,54 +1367,54 @@ dhcpd.conf(5) dhcpd.conf(5) ddyynnaammiicc--bboooottpp--lleeaassee--ccuuttooffff _d_a_t_e;; - The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_c_u_t_o_f_f statement sets the ending + The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_c_u_t_o_f_f statement sets the ending time for all leases assigned dynamically to BOOTP clients. - Because BOOTP clients do not have any way of renewing - leases, and don't know that their leases could expire, by + Because BOOTP clients do not have any way of renewing + leases, and don't know that their leases could expire, by default dhcpd assignes infinite leases to all BOOTP clients. However, it may make sense in some situations to - set a cutoff date for all BOOTP leases - for example, the + set a cutoff date for all BOOTP leases - for example, the end of a school term, or the time at night when a facility is closed and all machines are required to be powered off. _D_a_t_e should be the date on which all assigned BOOTP leases - will end. The date is specified in the form: - W YYYY/MM/DD HH:MM:SS - W is the day of the week expressed as a number from zero - (Sunday) to six (Saturday). YYYY is the year, including - the century. MM is the month expressed as a number from 1 - to 12. DD is the day of the month, counting from 1. HH - is the hour, from zero to 23. MM is the minute and SS is - the second. The time is always in Greenwich Mean Time - (GMT), not local time. - TThhee _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_l_e_n_g_t_h ssttaatteemmeenntt + 21 - ddyynnaammiicc--bboooottpp--lleeaassee--lleennggtthh _l_e_n_g_t_h;; - The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_l_e_n_g_t_h statement is used to set - the length of leases dynamically assigned to BOOTP - clients. At some sites, it may be possible to assume - that a lease is no longer in use if its holder has not - used BOOTP or DHCP to get its address within a certain - time period. The period is specified in _l_e_n_g_t_h as a num­ - ber of seconds. If a client reboots using BOOTP during - the timeout period, the lease duration is reset to _l_e_n_g_t_h, - so a BOOTP client that boots frequently enough will never - 19 +dhcpd.conf(5) dhcpd.conf(5) + will end. The date is specified in the form: + W YYYY/MM/DD HH:MM:SS + W is the day of the week expressed as a number from zero + (Sunday) to six (Saturday). YYYY is the year, including + the century. MM is the month expressed as a number from 1 + to 12. DD is the day of the month, counting from 1. HH + is the hour, from zero to 23. MM is the minute and SS is + the second. The time is always in Greenwich Mean Time + (GMT), not local time. -dhcpd.conf(5) dhcpd.conf(5) + TThhee _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_l_e_n_g_t_h ssttaatteemmeenntt + ddyynnaammiicc--bboooottpp--lleeaassee--lleennggtthh _l_e_n_g_t_h;; + The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_l_e_n_g_t_h statement is used to set + the length of leases dynamically assigned to BOOTP + clients. At some sites, it may be possible to assume + that a lease is no longer in use if its holder has not + used BOOTP or DHCP to get its address within a certain + time period. The period is specified in _l_e_n_g_t_h as a num­ + ber of seconds. If a client reboots using BOOTP during + the timeout period, the lease duration is reset to _l_e_n_g_t_h, + so a BOOTP client that boots frequently enough will never lose its lease. Needless to say, this parameter should be adjusted with extreme caution. @@ -1265,21 +1422,21 @@ dhcpd.conf(5) dhcpd.conf(5) ggeett--lleeaassee--hhoossttnnaammeess _f_l_a_g;; - The _g_e_t_-_l_e_a_s_e_-_h_o_s_t_n_a_m_e_s statement is used to tell dhcpd + The _g_e_t_-_l_e_a_s_e_-_h_o_s_t_n_a_m_e_s statement is used to tell dhcpd whether or not to look up the domain name corresponding to - the IP address of each address in the lease pool and use - that address for the DHCP _h_o_s_t_n_a_m_e option. If _f_l_a_g is - true, then this lookup is done for all addresses in the - current scope. By default, or if _f_l_a_g is false, no + the IP address of each address in the lease pool and use + that address for the DHCP _h_o_s_t_n_a_m_e option. If _f_l_a_g is + true, then this lookup is done for all addresses in the + current scope. By default, or if _f_l_a_g is false, no lookups are done. TThhee _u_s_e_-_h_o_s_t_-_d_e_c_l_-_n_a_m_e_s ssttaatteemmeenntt uussee--hhoosstt--ddeeccll--nnaammeess _f_l_a_g;; - If the _u_s_e_-_h_o_s_t_-_d_e_c_l_-_n_a_m_e_s parameter is true in a given - scope, then for every host declaration within that scope, - the name provided for the host declaration will be sup­ + If the _u_s_e_-_h_o_s_t_-_d_e_c_l_-_n_a_m_e_s parameter is true in a given + scope, then for every host declaration within that scope, + the name provided for the host declaration will be sup­ plied to the client as its hostname. So, for example, group { @@ -1287,6 +1444,18 @@ dhcpd.conf(5) dhcpd.conf(5) host joe { hardware ethernet 08:00:2b:4c:29:32; + + + + 22 + + + + + +dhcpd.conf(5) dhcpd.conf(5) + + fixed-address joe.fugue.com; } } @@ -1299,7 +1468,7 @@ dhcpd.conf(5) dhcpd.conf(5) option host-name "joe"; } - An _o_p_t_i_o_n _h_o_s_t_-_n_a_m_e statement within a host declaration + An _o_p_t_i_o_n _h_o_s_t_-_n_a_m_e statement within a host declaration will override the use of the name in the host declaration. TThhee _a_u_t_h_o_r_i_t_a_t_i_v_e ssttaatteemmeenntt @@ -1308,93 +1477,81 @@ dhcpd.conf(5) dhcpd.conf(5) nnoott aauutthhoorriittaattiivvee;; - The DHCP server will normally assume that the configura­ + The DHCP server will normally assume that the configura­ tion information about a given network segment is known to be correct and is authoritative. So if a client requests - an IP address on a given network segment that the server - - - - 20 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - knows is not valid for that segment, the server will + an IP address on a given network segment that the server + knows is not valid for that segment, the server will respond with a DHCPNAK message, causing the client to for­ get its IP address and try to get a new one. - If a DHCP server is being configured by somebody who is - not the network administrator and who therefore does not + If a DHCP server is being configured by somebody who is + not the network administrator and who therefore does not wish to assert this level of authority, then the statement - "not authoritative" should be written in the appropriate + "not authoritative" should be written in the appropriate scope in the configuration file. - Usually, writing nnoott aauutthhoorriittaattiivvee;; at the top level of + Usually, writing nnoott aauutthhoorriittaattiivvee;; at the top level of the file should be sufficient. However, if a DHCP server - is to be set up so that it is aware of some networks for - which it is authoritative and some networks for which it + is to be set up so that it is aware of some networks for + which it is authoritative and some networks for which it is not, it may be more appropriate to declare authority on a per-network-segment basis. Note that the most specific scope for which the concept of - authority makes any sense is the physical network segment - - either a shared-network statement or a subnet statement - that is not contained within a shared-network statement. + authority makes any sense is the physical network segment + - either a shared-network statement or a subnet statement + that is not contained within a shared-network statement. It is not meaningful to specify that the server is author­ - itative for some subnets within a shared network, but not - authoritative for others, nor is it meaningful to specify - that the server is authoritative for some host declara­ + itative for some subnets within a shared network, but not + authoritative for others, nor is it meaningful to specify + that the server is authoritative for some host declara­ tions and not others. TThhee _a_l_w_a_y_s_-_r_e_p_l_y_-_r_f_c_1_0_4_8 ssttaatteemmeenntt - aallwwaayyss--rreeppllyy--rrffcc11004488 _f_l_a_g;; - Some BOOTP clients expect RFC1048-style responses, but do - not follow RFC1048 when sending their requests. You can - tell that a client is having this problem if it is not - getting the options you have configured for it and if you - see in the server log the message "(non-rfc1048)" printed - with each BOOTREQUEST that is logged. - If you want to send rfc1048 options to such a client, you - can set the aallwwaayyss--rreeppllyy--rrffcc11004488 option in that client's - host declaration, and the DHCP server will respond with an - RFC-1048-style vendor options field. This flag can be - set in any scope, and will affect all clients covered by - that scope. - TThhee _a_l_w_a_y_s_-_b_r_o_a_d_c_a_s_t ssttaatteemmeenntt + 23 - aallwwaayyss--bbrrooaaddccaasstt _f_l_a_g;; - The DHCP and BOOTP protocols both require DHCP and BOOTP - clients to set the broadcast bit in the flags field of the - BOOTP message header. Unfortunately, some DHCP and BOOTP - clients do not do this, and therefore may not receive - responses from the DHCP server. The DHCP server can be - 21 +dhcpd.conf(5) dhcpd.conf(5) + aallwwaayyss--rreeppllyy--rrffcc11004488 _f_l_a_g;; + Some BOOTP clients expect RFC1048-style responses, but do + not follow RFC1048 when sending their requests. You can + tell that a client is having this problem if it is not + getting the options you have configured for it and if you + see in the server log the message "(non-rfc1048)" printed + with each BOOTREQUEST that is logged. + If you want to send rfc1048 options to such a client, you + can set the aallwwaayyss--rreeppllyy--rrffcc11004488 option in that client's + host declaration, and the DHCP server will respond with an + RFC-1048-style vendor options field. This flag can be + set in any scope, and will affect all clients covered by + that scope. -dhcpd.conf(5) dhcpd.conf(5) + TThhee _a_l_w_a_y_s_-_b_r_o_a_d_c_a_s_t ssttaatteemmeenntt + aallwwaayyss--bbrrooaaddccaasstt _f_l_a_g;; - made to always broadcast its responses to clients by set­ - ting this flag to 'on' for the relevant scope. To avoid + The DHCP and BOOTP protocols both require DHCP and BOOTP + clients to set the broadcast bit in the flags field of the + BOOTP message header. Unfortunately, some DHCP and BOOTP + clients do not do this, and therefore may not receive + responses from the DHCP server. The DHCP server can be + made to always broadcast its responses to clients by set­ + ting this flag to 'on' for the relevant scope. To avoid creating excess broadcast traffic on your network, we rec­ - ommend that you restrict the use of this option to as few - clients as possible. For example, the Microsoft DHCP + ommend that you restrict the use of this option to as few + clients as possible. For example, the Microsoft DHCP client is known not to have this problem, as are the Open­ Transport and ISC DHCP clients. @@ -1403,13 +1560,13 @@ dhcpd.conf(5) dhcpd.conf(5) oonnee--lleeaassee--ppeerr--cclliieenntt _f_l_a_g;; If this flag is enabled, whenever a client sends a DHCPRE­ - QUEST for a particular lease, the server will automati­ - cally free any other leases the client holds. This pre­ - sumes that when the client sends a DHCPREQUEST, it has - forgotten any lease not mentioned in the DHCPREQUEST - - i.e., the client has only a single network interface _a_n_d - it does not remember leases it's holding on networks to - which it is not currently attached. Neither of these + QUEST for a particular lease, the server will automati­ + cally free any other leases the client holds. This pre­ + sumes that when the client sends a DHCPREQUEST, it has + forgotten any lease not mentioned in the DHCPREQUEST - + i.e., the client has only a single network interface _a_n_d + it does not remember leases it's holding on networks to + which it is not currently attached. Neither of these assumptions are guaranteed or provable, so we urge caution in the use of this statement. @@ -1417,57 +1574,67 @@ dhcpd.conf(5) dhcpd.conf(5) uussee--lleeaassee--aaddddrr--ffoorr--ddeeffaauulltt--rroouuttee _f_l_a_g;; - If the _u_s_e_-_l_e_a_s_e_-_a_d_d_r_-_f_o_r_-_d_e_f_a_u_l_t_-_r_o_u_t_e parameter is true - in a given scope, then instead of sending the value speci­ - fied in the routers option (or sending no value at all), - the IP address of the lease being assigned is sent to the - client. This supposedly causes Win95 machines to ARP for - all IP addresses, which can be helpful if your router is - configured for proxy ARP. + If the _u_s_e_-_l_e_a_s_e_-_a_d_d_r_-_f_o_r_-_d_e_f_a_u_l_t_-_r_o_u_t_e parameter is true + in a given scope, then instead of sending the value - TThhee _s_e_r_v_e_r_-_i_d_e_n_t_i_f_i_e_r ssttaatteemmeenntt - sseerrvveerr--iiddeennttiiffiieerr _h_o_s_t_n_a_m_e;; - The server-identifier statement can be used to define the - value that is sent in the DHCP Server Identifier option - for a given scope. The value specified mmuusstt be an IP - address for the DHCP server, and must be reachable by all - clients served by a particular scope. + 24 - The use of the server-identifier statement is not recom­ - mended - the only reason to use it is to force a value - other than the default value to be sent on occasions where - the default value would be incorrect. The default value - is the first IP address associated with the physical net­ - work interface on which the request arrived. - The usual case where the _s_e_r_v_e_r_-_i_d_e_n_t_i_f_i_e_r statement needs - to be sent is when a physical interface has more than one - 22 +dhcpd.conf(5) dhcpd.conf(5) + specified in the routers option (or sending no value at + all), the IP address of the lease being assigned is sent + to the client. This supposedly causes Win95 machines to + ARP for all IP addresses, which can be helpful if your + router is configured for proxy ARP. + TThhee _s_e_r_v_e_r_-_i_d_e_n_t_i_f_i_e_r ssttaatteemmeenntt + sseerrvveerr--iiddeennttiiffiieerr _h_o_s_t_n_a_m_e;; -dhcpd.conf(5) dhcpd.conf(5) + The server-identifier statement can be used to define the + value that is sent in the DHCP Server Identifier option + for a given scope. The value specified mmuusstt be an IP + address for the DHCP server, and must be reachable by all + clients served by a particular scope. + The use of the server-identifier statement is not recom­ + mended - the only reason to use it is to force a value + other than the default value to be sent on occasions where + the default value would be incorrect. The default value + is the first IP address associated with the physical net­ + work interface on which the request arrived. + The usual case where the _s_e_r_v_e_r_-_i_d_e_n_t_i_f_i_e_r statement needs + to be sent is when a physical interface has more than one IP address, and the one being sent by default isn't appro­ - priate for some or all clients served by that interface. - Another common case is when an alias is defined for the - purpose of having a consistent IP address for the DHCP - server, and it is desired that the clients use this IP + priate for some or all clients served by that interface. + Another common case is when an alias is defined for the + purpose of having a consistent IP address for the DHCP + server, and it is desired that the clients use this IP address when contacting the server. Supplying a value for the dhcp-server-identifier option is equivalent to using the server-identifier statement. + TThhee _d_d_n_s_-_u_p_d_a_t_e_s ssttaatteemmeenntt + + ddddnnss--uuppddaatteess _f_l_a_g;; + + The _d_d_n_s_-_u_p_d_a_t_e_s parameter controls whether or not the + server will attempt to do a ddns update when a lease is + confirmed. Set this to _o_f_f if the server should not + attempt to do updates within a certain scope. The _d_d_n_s_- + _u_p_d_a_t_e_s parameter is on by default. + RREEFFEERREENNCCEE:: OOPPTTIIOONN SSTTAATTEEMMEENNTTSS - DHCP option statements are documented in the ddhhccpp-- + DHCP option statements are documented in the ddhhccpp-- ooppttiioonnss((55)) manual page. SSEEEE AALLSSOO @@ -1475,9 +1642,21 @@ SSEEEE AALLSSOO AAUUTTHHOORR ddhhccppdd((88)) was written by Ted Lemon under a - contract with Vixie Labs. Funding for this project was + + + + 25 + + + + + +dhcpd.conf(5) dhcpd.conf(5) + + + contract with Vixie Labs. Funding for this project was provided by the Internet Software Consortium. Information - about the Internet Software Consortium can be found at + about the Internet Software Consortium can be found at hhttttpp::////wwwwww..iisscc..oorrgg//iisscc.. @@ -1513,6 +1692,25 @@ AAUUTTHHOORR - 23 + + + + + + + + + + + + + + + + + + + + 26