2 .\" Copyright (c) 1992-1996 Competitive Automation, Inc. Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
4 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the
5 .\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH DHCPAGENT 1M "Dec 11, 2015"
8 dhcpagent \- Dynamic Host Configuration Protocol (DHCP) client daemon
12 \fBdhcpagent\fR [\fB-a\fR] [ \fB-d\fR \fIn\fR] [\fB-f\fR] [\fB-v\fR]
17 \fBdhcpagent\fR implements the client half of the Dynamic Host Configuration
18 Protocol \fB(DHCP)\fR for machines running Solaris software.
21 The \fBdhcpagent\fR daemon obtains configuration parameters for the client
22 (local) machine's network interfaces from a \fBDHCP\fR server. These parameters
23 may include a lease on an \fBIP\fR address, which gives the client machine use
24 of the address for the period of the lease, which may be infinite. If the
25 client wishes to use the \fBIP\fR address for a period longer than the lease,
26 it must negotiate an extension using \fBDHCP\fR. For this reason,
27 \fBdhcpagent\fR must run as a daemon, terminating only when the client machine
31 For IPv4, the \fBdhcpagent\fR daemon is controlled through \fBifconfig\fR(1M)
32 in much the same way that the \fBinit\fR(1M) daemon is controlled by
33 \fBtelinit\fR(1M). \fBdhcpagent\fR can be invoked as a user process, albeit one
34 requiring root privileges, but this is not necessary, as \fBifconfig\fR(1M)
35 will start it automatically.
38 For IPv6, the \fBdhcpagent\fR daemon is invoked automatically by
39 \fBin.ndpd\fR(1M). It can also be controlled through \fBifconfig\fR(1M), if
43 When invoked, \fBdhcpagent\fR enters a passive state while it awaits
44 instructions from \fBifconfig\fR(1M) or \fBin.ndpd\fR(1M). When it receives a
45 command to configure an interface, it brings up the interface (if necessary)
46 and starts DHCP. Once DHCP is complete, \fBdhcpagent\fR can be queried for the
47 values of the various network parameters. In addition, if DHCP was used to
48 obtain a lease on an address for an interface, it configures the address for
49 use. When a lease is obtained, it is automatically renewed as necessary. If the
50 lease cannot be renewed, \fBdhcpagent\fR will unconfigure the address, but the
51 interface will be left up and \fBdhcpagent\fR will attempt to acquire a new
52 address lease. \fBdhcpagent\fR monitors system suspend/resume events and will
53 validate any non-permanent leases with the DHCP server upon resume. Similarly,
54 \fBdhcpagent\fR monitors link up/down events and will validate any
55 non-permanent leases with the DHCP server when the downed link is brought back
56 up. The lease validation mechanism will restart DHCP if the server indicates
57 that the existing lease is no longer valid. If the server cannot be contacted,
58 then the existing lease will continue. This behavior can be modified with the
59 \fBVERIFIED_LEASE_ONLY\fR parameter in the \fB/etc/default/dhcpagent\fR file.
60 See the description of this parameter below.
63 For IPv4, if the configured interface is found to be unplumbed, or to have a
64 different IP address, subnet mask, or broadcast address from those obtained
65 from DHCP, the interface is abandoned from DHCP control.
68 For IPv6, \fBdhcpagent\fR automatically plumbs and unplumbs logical interfaces
69 as necessary for the IPv6 addresses supplied by the server. The IPv6 prefix
70 length (netmask) is not set by the DHCPv6 protocol, but is instead set by
71 \fBin.ndpd\fR(1M) using prefix information obtained by Router Advertisements.
72 If any of the logical interfaces created by \fBdhcpagent\fR is unplumbed, or
73 configured with a different IP address, it will be abandoned from DHCP control.
74 If the link-local interface is unplumbed, then all addresses configured by DHCP
75 on that physical interface will be removed.
78 In addition to \fBDHCP\fR, \fBdhcpagent\fR also supports \fBBOOTP\fR (IPv4
79 only). See \fIRFC 951, Bootstrap Protocol\fR. Configuration parameters obtained
80 from a \fBBOOTP\fR server are treated identically to those received from a
81 \fBDHCP\fR server, except that the \fBIP\fR address received from a \fBBOOTP\fR
82 server always has an infinite lease.
85 \fBDHCP\fR also acts as a mechanism to configure other information needed by
86 the client, for example, the domain name and addresses of routers. Aside from
87 the IP address, and for IPv4 alone, the netmask, broadcast address, and default
88 router, the agent does not directly configure the workstation, but instead acts
89 as a database which may be interrogated by other programs, and in particular by
93 On clients with a single interface, this is quite straightforward. Clients with
94 multiple interfaces may present difficulties, as it is possible that some
95 information arriving on different interfaces may need to be merged, or may be
96 inconsistent. Furthermore, the configuration of the interfaces is asynchronous,
97 so requests may arrive while some or all of the interfaces are still
98 unconfigured. To handle these cases, one interface may be designated as
99 primary, which makes it the authoritative source for the values of \fBDHCP\fR
100 parameters in the case where no specific interface is requested. See
101 \fBdhcpinfo\fR(1) and \fBifconfig\fR(1M) for details.
104 For IPv4, the \fBdhcpagent\fR daemon can be configured to request a particular
105 host name. See the \fBREQUEST_HOSTNAME\fR description in the \fBFILES\fR
106 section. When first configuring a client to request a host name, you must
107 perform the following steps as root to ensure that the full DHCP negotiation
113 # rm /etc/dhcp/\fIinterface\fR.dhc
121 All DHCP packets sent by \fBdhcpagent\fR include a vendor class identifier (RFC
122 2132, option code 60; RFC 3315, option code 16). This identifier is the same as
123 the platform name returned by the \fBuname\fR \fB-i\fR command, except:
128 Any commas in the platform name are changed to periods.
134 If the name does not start with a stock symbol and a comma, it is automatically
135 prefixed with \fBSUNW\fR.
139 The \fBdhcpagent\fR daemon writes information and error messages in five
148 Critical messages indicate severe conditions that prevent proper operation.
158 Error messages are important, sometimes unrecoverable events due to resource
159 exhaustion and other unexpected failure of system calls; ignoring errors may
160 lead to degraded functionality.
170 Warnings indicate less severe problems, and in most cases, describe unusual or
171 incorrect datagrams received from servers, or requests for service that cannot
182 Informational messages provide key pieces of information that can be useful to
183 debugging a \fBDHCP\fR configuration at a site. Informational messages are
184 generally controlled by the \fB-v\fR option. However, certain critical pieces
185 of information, such as the IP address obtained, are always provided.
195 Debugging messages, which may be generated at two different levels of
196 verbosity, are chiefly of benefit to persons having access to source code, but
197 may be useful as well in debugging difficult DHCP configuration problems.
198 Debugging messages are only generated when using the \fB-d\fR option.
203 When \fBdhcpagent\fR is run without the \fB-f\fR option, all messages are sent
204 to the system logger \fBsyslog\fR(3C) at the appropriate matching priority and
205 with a facility identifier \fBLOG_DAEMON\fR. When \fBdhcpagent\fR is run with
206 the \fB-f\fR option, all messages are directed to standard error.
207 .SS "DHCP Events and User-Defined Actions"
209 If an executable (binary or script) is placed at \fB/etc/dhcp/eventhook\fR, the
210 \fBdhcpagent\fR daemon will automatically run that program when any of the
211 following events occur:
215 \fB\fBBOUND\fR and \fBBOUND6\fR\fR
219 These events occur during interface configuration. The event program is invoked
220 when \fBdhcpagent\fR receives the DHCPv4 ACK or DHCPv6 Reply message from the
221 DHCP server for the lease request of an address, indicating successful initial
222 configuration of the interface. (See also the \fBINFORM\fR and \fBINFORM6\fR
223 events, which occur when configuration parameters are obtained without address
230 \fB\fBEXTEND\fR and \fBEXTEND6\fR\fR
234 These events occur during lease extension. The event program is invoked just
235 after \fBdhcpagent\fR receives the DHCPv4 ACK or DHCPv6 Reply from the DHCP
236 server for the DHCPv4 REQUEST (renew) message or the DHCPv6 Renew or Rebind
239 Note that with DHCPv6, the server might choose to remove some addresses, add
240 new address leases, and ignore (allow to expire) still other addresses in a
241 given Reply message. The \fBEXTEND6\fR event occurs when a Reply is received
242 that leaves one or more address leases still valid, even if the Reply message
243 does not extend the lease for any address. The event program is invoked just
244 before any addresses are removed, but just after any new addresses are added.
245 Those to be removed will be marked with the \fBIFF_DEPRECATED\fR flag.
251 \fB\fBEXPIRE\fR and \fBEXPIRE6\fR\fR
255 These events occur during lease expiration. For DHCPv4, the event program is
256 invoked just before the leased address is removed from an interface. For
257 DHCPv6, the event program is invoked just before the last remaining leased
258 addresses are removed from the interface.
264 \fB\fBDROP\fR and \fBDROP6\fR\fR
268 These events occur during the period when an interface is dropped. The event
269 program is invoked just before the interface is removed from DHCP control. If
270 the interface has been abandoned due the user unplumbing the interface, then
271 this event will occur after the user's action has taken place. The interface
272 might not be present.
278 \fB\fBINFORM\fR and \fBINFORM6\fR\fR
282 These events occur when an interface acquires new or updated configuration
283 information from a DHCP server by means of the DHCPv4 \fBINFORM\fR or the
284 DHCPv6 Information-Request message. These messages are sent using an
285 \fBifconfig\fR(1M) \fBdhcp inform\fR command or when the DHCPv6 Router
286 Advertisement \fBO\fR (letter 0) bit is set and the \fBM\fR bit is not set.
287 Thus, these events occur when the DHCP client does not obtain an IP address
288 lease from the server, and instead obtains only configuration parameters.
298 This event occurs during lease expiration when one or more valid leases still
299 remain. The event program is invoked just before expired addresses are removed.
300 Those being removed will be marked with the \fBIFF_DEPRECATED\fR flag.
302 Note that this event is not associated with the receipt of the Reply message,
303 which occurs only when one or more valid leases remain, and occurs only with
304 DHCPv6. If all leases have expired, then the EXPIRE6 event occurs instead.
310 \fB\fBRELEASE\fR and \fBRELEASE6\fR\fR
314 This event occurs during the period when a leased address is released. The
315 event program is invoked just before \fBdhcpagent\fR relinquishes the address
316 on an interface and sends the DHCPv4 \fBRELEASE\fR or DHCPv6 Release packet to
322 The system does not provide a default event program. The file
323 \fB/etc/dhcp/eventhook\fR is expected to be owned by root and have a mode of
327 The event program will be passed two arguments, the interface name and the
328 event name, respectively. For DHCPv6, the interface name is the name of the
332 The event program can use the \fBdhcpinfo\fR(1) utility to fetch additional
333 information about the interface. While the event program is invoked on every
334 event defined above, it can ignore those events in which it is not interested.
335 The event program runs with the same privileges and environment as
336 \fBdhcpagent\fR itself, except that \fBstdin\fR, \fBstdout\fR, and \fBstderr\fR
337 are redirected to \fB/dev/null\fR. Note that this means that the event program
338 runs with root privileges.
341 If an invocation of the event program does not exit after 55 seconds, it is
342 sent a \fBSIGTERM\fR signal. If does not exit within the next three seconds, it
343 is terminated by a \fBSIGKILL\fR signal.
346 See EXAMPLES for an example event program.
349 The following options are supported:
357 Adopt a configured IPv4 interface. This option is for use with diskless
358 \fBDHCP\fR clients. In the case of diskless \fBDHCP\fR, \fBDHCP\fR has already
359 been performed on the network interface providing the operating system image
360 prior to running \fBdhcpagent\fR. This option instructs the agent to take over
361 control of the interface. It is intended primarily for use in boot scripts.
363 The effect of this option depends on whether the interface is being adopted.
365 If the interface is being adopted, the following conditions apply:
367 \fBdhcpagent\fR uses the client id specified in
368 \fB/chosen\fR:\fI<client_id>\fR, as published by the PROM or as specified on a
369 \fBboot\fR(1M) command line. If this value is not present, the client id is
370 undefined. The DHCP server then determines what to use as a client id. It is an
371 error condition if the interface is an Infiniband interface and the PROM value
374 If the interface is not being adopted:
376 \fBdhcpagent\fR uses the value stored in \fB/etc/default/dhcpagent\fR. If this
377 value is not present, the client id is undefined. If the interface is
378 Infiniband and there is no value in \fB/etc/default/dhcpagent\fR, a client id
379 is generated as described by the draft document on DHCP over Infiniband,
393 \fB\fB-d\fR \fIn\fR\fR
397 Set debug level to \fIn\fR. Two levels of debugging are currently available, 1
398 and 2; the latter is more verbose.
408 Run in the foreground instead of as a daemon process. When this option is used,
409 messages are sent to standard error instead of to \fBsyslog\fR(3C).
419 Provide verbose output useful for debugging site configuration problems.
424 \fBExample 1 \fRExample Event Program
427 The following script is stored in the file \fB/etc/dhcp/eventhook\fR, owned by
428 root with a mode of 755. It is invoked upon the occurrence of the events listed
437 echo "Interface name: " $1
442 echo "Address acquired from server "\e
443 `/sbin/dhcpinfo -i $1 ServerID`
446 echo "Addresses acquired from server " \e
447 `/sbin/dhcpinfo -v6 -i $1 ServerID`
450 echo "Lease extended for " \e
451 `sbin/dhcpinfo -i $1 LeaseTim`" seconds"
454 echo "New lease information obtained on $i"
456 "EXPIRE" | "DROP" | "RELEASE")
460 ) >/var/run/dhcp_eventhook_output 2>&1
467 Note the redirection of stdout and stderr to a file.
472 \fB\fB/etc/dhcp/\fIif\fR.dhc\fR\fR
476 \fB\fB/etc/dhcp/\fIif\fR.dh6\fR\fR
480 Contains the configuration for interface. The mere existence of this file does
481 not imply that the configuration is correct, since the lease might have
482 expired. On start-up, \fBdhcpagent\fR confirms the validity of the address
483 using REQUEST (for DHCPv4) or Confirm (DHCPv6).
489 \fB\fB/etc/dhcp/duid\fR\fR
493 \fB\fB/etc/dhcp/iaid\fR\fR
497 Contains persistent storage for DUID (DHCP Unique Identifier) and IAID
498 (Identity Association Identifier) values. The format of these files is
499 undocumented, and applications should not read from or write to them.
505 \fB\fB/etc/default/dhcpagent\fR\fR
509 Contains default values for tunable parameters. All values may be qualified
510 with the interface they apply to by prepending the interface name and a period
511 (".") to the interface parameter name. The parameters include: the interface
514 To configure IPv6 parameters, place the string \fB\&.v6\fR between the
515 interface name (if any) and the parameter name. For example, to set the global
516 IPv6 parameter request list, use \fB\&.v6.PARAM_REQUEST_LIST\fR. To set the
517 \fBCLIENT_ID\fR (\fBDUID\fR) on \fBhme0\fR, use \fBhme0.v6.CLIENT_ID\fR.
519 The parameters include:
523 \fB\fBVERIFIED_LEASE_ONLY\fR\fR
527 Indicates that a \fBRELEASE\fR rather than a \fBDROP\fR should be performed on
528 managed interfaces when the agent terminates. Release causes the client to
529 discard the lease, and the server to make the address available again. Drop
530 causes the client to record the lease in \fB/etc/dhcp/\fIinterface\fR.dhc\fR or
531 \fB/etc/dhcp/\fIinterface\fR.dh6\fR for later use. In addition, when the link
532 status changes to \fBup\fR or when the system is resumed after a suspend, the
533 client will verify the lease with the server. If the server is unreachable for
534 verification, then the old lease will be discarded (even if it has time
535 remaining) and a new one obtained.
537 Enabling this option is often desirable on mobile systems, such as laptops, to
538 allow the system to recover quickly from moves.
544 \fB\fBOFFER_WAIT\fR\fR
548 Indicates how long to wait between checking for valid \fBOFFER\fRs after
549 sending a \fBDISCOVER\fR. For DHCPv6, sets the time to wait between checking
550 for valid Advertisements after sending a Solicit.
556 \fB\fBCLIENT_ID\fR\fR
560 Indicates the value that should be used to uniquely identify the client to the
561 server. This value can take one of three basic forms:
565 \fIdecimal\fR,\fIdata\fR...
572 The first form is an RFC 3315 DUID. This is legal for both IPv4 DHCP and
573 DHCPv6. For IPv4, an RFC 4361 Client ID is constructed from this value. In this
574 first form, the format of \fIdata\fR... depends on the decimal value. The
575 following formats are defined for this first form:
579 \fB1,\fIhwtype\fR,\fItime\fR,\fIlla\fR\fR
583 Type 1, DUID-LLT. The \fIhwtype\fR value is an integer in the range 0-65535,
584 and indicates the type of hardware. The \fItime\fR value is the number of
585 seconds since midnight, January 1st, 2000 UTC, and can be omitted to use the
586 current system time. The \fIlla\fR value is either a colon-separated MAC
587 address or the name of a physical interface. If the name of an interface is
588 used, the \fIhwtype\fR value can be omitted. For example: \fB1,,,hme0\fR
594 \fB2,\fIenterprise\fR,\fIhex\fR...\fR
598 Type 2, DUID-EN. The \fIenterprise\fR value is an integer in the range
599 0-4294967295 and represents the SMI Enterprise number for an organization. The
600 \fIhex\fR string is an even-length sequence of hexadecimal digits.
606 \fB3,\fIhwtype\fR,\fIlla\fR\fR
610 Type 3, DUID-LL. This is the same as DUID-LLT (type 1), except that a time
621 Any other type value (0 or 4-65535) can be used with an even-length hexadecimal
625 The second and third forms of \fBCLIENT_ID\fR are legal for IPv4 only. These
626 both represent raw Client ID (without RFC 4361), in hex, or NVT ASCII string
627 format. Thus, "\fBSun\fR" and \fB0x53756E\fR are equivalent.
633 \fB\fBPARAM_REQUEST_LIST\fR\fR
637 Specifies a list of comma-separated integer values of options for which the
638 client would like values, or symbolic \fBSite\fR or \fBOption\fR option names.
639 Symbolic option names for IPv4 are resolved through \fB/etc/dhcp/inittab\fR.
640 Option names for IPv6 are resolved by means of \fB/etc/dhcp/inittab6\fR.
646 \fB\fBPARAM_IGNORE_LIST\fR\fR
650 Specifies a list of options (constructed in the same manner as
651 \fBPARAM_REQUEST_LIST\fR) that the DHCP client will ignore. Ignored options are
652 treated as though the server did not return the options specified. Ignored
653 options are not visible using \fBdhcpinfo\fR(1) or acted on by the client. This
654 parameter can be used, for example, to disable an unwanted client name or
661 \fB\fBREQUEST_HOSTNAME\fR\fR
665 Indicates the client requests the DHCP server to map the client's leased IPv4
666 address to the host name associated with the network interface that performs
667 DHCP on the client. The host name must be specified in the
668 \fB/etc/hostname.\fIinterface\fR\fR file for the relevant interface on a line
678 where \fIhostname\fR is the host name requested.
680 This option works with DHCPv4 only.
688 \fB\fB/etc/dhcp/eventhook\fR\fR
692 Location of a DHCP event program.
697 See \fBattributes\fR(5) for descriptions of the following attributes:
705 ATTRIBUTE TYPE ATTRIBUTE VALUE
707 Interface Stability Committed
712 \fBdhcpinfo\fR(1), \fBifconfig\fR(1M), \fBinit\fR(1M), \fBin.mpathd\fR(1M),
713 \fBin.ndpd\fR(1M), \fBsyslog\fR(3C), \fBattributes\fR(5), \fBdhcp\fR(5)
719 Croft, B. and Gilmore, J.,\fIBootstrap Protocol (BOOTP)\fRRFC 951, Network
720 Working Group, September 1985.
723 Droms, R., \fIDynamic Host Configuration Protocol\fR, RFC 2131, Network Working
727 Lemon, T. and B. Sommerfeld. \fIRFC 4361, Node-specific Client Identifiers for
728 Dynamic Host Configuration Protocol Version Four (DHCPv4)\fR. Nominum and Sun
729 Microsystems. February 2006.
732 Droms, R. \fIRFC 3315, Dynamic Host Configuration Protocol for IPv6
733 (DHCPv6)\fR. Cisco Systems. July 2003.
736 The \fBdhcpagent\fR daemon can be used on IPv4 logical interfaces, just as with
737 physical interfaces. When used on a logical interface, the daemon automatically
738 constructs a Client ID value based on the DUID and IAID values, according to
739 RFC 4361. The \fB/etc/default/dhcpagent\fR \fBCLIENT_ID\fR value, if any,
740 overrides this automatic identifier.
743 As with physical IPv4 interfaces, the \fB/etc/hostname.hme0:1\fR and
744 \fB/etc/dhcp.hme0:1\fR files must also be created in order for \fBhme0:1\fR to
745 be automatically plumbed and configured at boot. In addition, unlike physical
746 IPv4 interfaces, \fBdhcpagent\fR does not add or remove default routes
747 associated with logical interfaces.
750 DHCP can be performed on IPMP IP interfaces to acquire and maintain IPMP data
751 addresses. Because an IPMP IP interface has no hardware address, the daemon
752 automatically constructs a Client ID using the same approach described above
753 for IPv4 logical interfaces. In addition, the lack of a hardware address means
754 the daemon must set the "broadcast" flag in all \fBDISCOVER\fR and
755 \fBREQUEST\fR messages on IPMP IP interfaces. Some DHCP servers may refuse such
759 DHCP can be performed on IP interfaces that are part of an IPMP group (to
760 acquire and maintain test addresses). The daemon will automatically set the
761 \fBNOFAILOVER\fR and \fBDEPRECATED\fR flags on each test address. Additionally,
762 the daemon will not add or remove default routes in this case. Note that the
763 actual DHCP packet exchange may be performed over any active IP interface in
764 the IPMP group. It is strongly recommended that test addresses have infinite
765 leases. Otherwise, an extended network outage detectable only by probes may
766 cause test address leases to expire, causing \fBin.mpathd\fR(1M) to revert to
767 link-based failure detection and trigger an erroneous repair.
770 With DHCPv6, the link-local interface must be configured using
771 \fB/etc/hostname6.hme0\fR in order for DHCPv6 to run on \fBhme0\fR at boot
772 time. The logical interfaces for each address are plumbed by \fBdhcpagent\fR