blob: 0417ff2ab7c15234de34139cde16d121cb496ae8 [file] [log] [blame]
Russ Dillf5ecd432002-10-31 19:21:27 +00001udhcp client (udhcpc)
2--------------------
3
4The udhcp client negotiates a lease with the DHCP server and notifies
5a set of scripts when a leases is obtained or lost.
6
7
8command line options
9-------------------
10
11The command line options for the udhcp client are:
12
Paul Fox28de9512005-09-22 18:59:13 +000013-c, --clientid=CLIENTID Set client identifier. Type is first char.
14-C, --clientid-none Suppress default client identifier
15-V, --vendorclass=CLASSID Set vendor class identifier
Russ Dillf5ecd432002-10-31 19:21:27 +000016-H, --hostname=HOSTNAME Client hostname
Mike Frysingerd8248532004-12-06 14:59:45 +000017-h, Alias for -H
18-F, --fqdn=FQDN Client fully qualified domain name
Russ Dillf5ecd432002-10-31 19:21:27 +000019-f, --foreground Do not fork after getting lease
20-b, --background Fork to background if lease cannot be
21 immediately negotiated.
22-i, --interface=INTERFACE Interface to use (default: eth0)
23-n, --now Exit with failure if lease cannot be
24 immediately negotiated.
25-p, --pidfile=file Store process ID of daemon in file
26-q, --quit Quit after obtaining lease
27-r, --request=IP IP address to request (default: none)
28-s, --script=file Run file at dhcp events (default:
29 /usr/share/udhcpc/default.script)
30-v, --version Display version
31
32
33If the requested IP address cannot be obtained, the client accepts the
34address that the server offers.
35
36
37udhcp client scripts
38-------------------
39
Russ Dillae01fa92002-11-19 00:41:09 +000040When an event occurs, udhcpc calls the action script. udhcpc never does
41any configuration of the network interface itself, but instead relies on
Eric Andersenc7bda1c2004-03-15 08:29:22 +000042a set of scripts. The script by default is
Russ Dillae01fa92002-11-19 00:41:09 +000043/usr/share/udhcpc/default.script but this can be changed via the command
44line arguments. The three possible arguments to the script are:
Russ Dillf5ecd432002-10-31 19:21:27 +000045
46 deconfig: This argument is used when udhcpc starts, and
Russ Dillae01fa92002-11-19 00:41:09 +000047 when a leases is lost. The script must put the interface in an
Russ Dillf5ecd432002-10-31 19:21:27 +000048 up, but deconfigured state, ie: ifconfig $interface 0.0.0.0.
Eric Andersenc7bda1c2004-03-15 08:29:22 +000049
Russ Dillf5ecd432002-10-31 19:21:27 +000050 bound: This argument is used when udhcpc moves from an
51 unbound, to a bound state. All of the paramaters are set in
52 enviromental variables, The script should configure the interface,
Eric Andersenc7bda1c2004-03-15 08:29:22 +000053 and set any other relavent parameters (default gateway, dns server,
Russ Dillf5ecd432002-10-31 19:21:27 +000054 etc).
Eric Andersenc7bda1c2004-03-15 08:29:22 +000055
Russ Dillf5ecd432002-10-31 19:21:27 +000056 renew: This argument is used when a DHCP lease is renewed. All of
57 the paramaters are set in enviromental variables. This argument is
58 used when the interface is already configured, so the IP address,
59 will not change, however, the other DHCP paramaters, such as the
60 default gateway, subnet mask, and dns server may change.
61
62 nak: This argument is used with udhcpc receives a NAK message.
63 The script with the deconfig argument will be called directly
64 afterwards, so no changes to the network interface are neccessary.
65 This hook is provided for purely informational purposes (the
66 message option may contain a reason for the NAK).
67
68The paramaters for enviromental variables are as follows:
69
70 $HOME - The set $HOME env or "/"
71 $PATH - the set $PATH env or "/bin:/usr/bin:/sbin:/usr/sbin"
72 $1 - What action the script should perform
73 interface - The interface this was obtained on
74 ip - The obtained IP
Russ Dill1eb7a172002-12-11 21:12:45 +000075 mask - The number of bits in the netmask (ie: 24)
Russ Dillf5ecd432002-10-31 19:21:27 +000076 siaddr - The bootp next server option
77 sname - The bootp server name option
78 boot_file - The bootp boot file option
79 subnet - The assigend subnet mask
80 timezone - Offset in seconds from UTC
81 router - A list of routers
82 timesvr - A list of time servers
83 namesvr - A list of IEN 116 name servers
84 dns - A list of DNS server
85 logsvr - A list of MIT-LCS UDP log servers
86 cookiesvr - A list of RFC 865 cookie servers
87 lprsvr - A list of LPR servers
88 hostname - The assigned hostname
89 bootsize - The length in 512 octect blocks of the bootfile
90 domain - The domain name of the network
91 swapsvr - The IP address of the client's swap server
92 rootpath - The path name of the client's root disk
93 ipttl - The TTL to use for this network
94 mtu - The MTU to use for this network
95 broadcast - The broadcast address for this network
96 ntpsrv - A list of NTP servers
97 wins - A list of WINS servers
98 lease - The lease time, in seconds
99 dhcptype - DHCP message type (safely ignored)
100 serverid - The IP of the server
101 message - Reason for a DHCPNAK
102 tftp - The TFTP server name
103 bootfile - The bootfile name
104
105additional options are easily added in options.c.
106
107
108note on udhcpc's random seed
109---------------------------
110
111udhcpc will seed its random number generator (used for generating xid's)
112by reading /dev/urandom. If you have a lot of embedded systems on the same
113network, with no entropy, you can either seed /dev/urandom by a method of
114your own, or doing the following on startup:
115
116ifconfig eth0 > /dev/urandom
117
118in order to seed /dev/urandom with some data (mac address) unique to your
119system. If reading /dev/urandom fails, udhcpc will fall back to its old
120behavior of seeding with time(0).
121
122
123signals accepted by udhcpc
124-------------------------
125
126udhcpc also responds to SIGUSR1 and SIGUSR2. SIGUSR1 will force a renew state,
127and SIGUSR2 will force a release of the current lease, and cause udhcpc to
128go into an inactive state (until it is killed, or receives a SIGUSR1). You do
129not need to sleep between sending signals, as signals received are processed
130sequencially in the order they are received.
131
132
133compile time options
134-------------------
135
136options.c contains a set of dhcp options for the client:
137
138 name[10]: The name of the option as it will appear in scripts
Eric Andersenc7bda1c2004-03-15 08:29:22 +0000139
Russ Dillf5ecd432002-10-31 19:21:27 +0000140 flags: The type of option, as well as if it will be requested
141 by the client (OPTION_REQ)
142
143 code: The DHCP code for this option
144