aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/README.udhcpc
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/README.udhcpc')
-rw-r--r--networking/udhcp/README.udhcpc139
1 files changed, 139 insertions, 0 deletions
diff --git a/networking/udhcp/README.udhcpc b/networking/udhcp/README.udhcpc
new file mode 100644
index 000000000..3591605e3
--- /dev/null
+++ b/networking/udhcp/README.udhcpc
@@ -0,0 +1,139 @@
1udhcp 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
13-c, --clientid=CLIENTID Client identifier
14-H, --hostname=HOSTNAME Client hostname
15-h, Alias for -H
16-f, --foreground Do not fork after getting lease
17-b, --background Fork to background if lease cannot be
18 immediately negotiated.
19-i, --interface=INTERFACE Interface to use (default: eth0)
20-n, --now Exit with failure if lease cannot be
21 immediately negotiated.
22-p, --pidfile=file Store process ID of daemon in file
23-q, --quit Quit after obtaining lease
24-r, --request=IP IP address to request (default: none)
25-s, --script=file Run file at dhcp events (default:
26 /usr/share/udhcpc/default.script)
27-v, --version Display version
28
29
30If the requested IP address cannot be obtained, the client accepts the
31address that the server offers.
32
33
34udhcp client scripts
35-------------------
36
37When an event occurs, udhcpc calls the action script. The script by
38default is /usr/share/udhcpc/default.script but this can be changed via
39the command line arguments. The three possible arguments to the script
40are:
41
42 deconfig: This argument is used when udhcpc starts, and
43 when a leases is lost. The script should put the interface in an
44 up, but deconfigured state, ie: ifconfig $interface 0.0.0.0.
45
46 bound: This argument is used when udhcpc moves from an
47 unbound, to a bound state. All of the paramaters are set in
48 enviromental variables, The script should configure the interface,
49 and set any other relavent parameters (default gateway, dns server,
50 etc).
51
52 renew: This argument is used when a DHCP lease is renewed. All of
53 the paramaters are set in enviromental variables. This argument is
54 used when the interface is already configured, so the IP address,
55 will not change, however, the other DHCP paramaters, such as the
56 default gateway, subnet mask, and dns server may change.
57
58 nak: This argument is used with udhcpc receives a NAK message.
59 The script with the deconfig argument will be called directly
60 afterwards, so no changes to the network interface are neccessary.
61 This hook is provided for purely informational purposes (the
62 message option may contain a reason for the NAK).
63
64The paramaters for enviromental variables are as follows:
65
66 $HOME - The set $HOME env or "/"
67 $PATH - the set $PATH env or "/bin:/usr/bin:/sbin:/usr/sbin"
68 $1 - What action the script should perform
69 interface - The interface this was obtained on
70 ip - The obtained IP
71 siaddr - The bootp next server option
72 sname - The bootp server name option
73 boot_file - The bootp boot file option
74 subnet - The assigend subnet mask
75 timezone - Offset in seconds from UTC
76 router - A list of routers
77 timesvr - A list of time servers
78 namesvr - A list of IEN 116 name servers
79 dns - A list of DNS server
80 logsvr - A list of MIT-LCS UDP log servers
81 cookiesvr - A list of RFC 865 cookie servers
82 lprsvr - A list of LPR servers
83 hostname - The assigned hostname
84 bootsize - The length in 512 octect blocks of the bootfile
85 domain - The domain name of the network
86 swapsvr - The IP address of the client's swap server
87 rootpath - The path name of the client's root disk
88 ipttl - The TTL to use for this network
89 mtu - The MTU to use for this network
90 broadcast - The broadcast address for this network
91 ntpsrv - A list of NTP servers
92 wins - A list of WINS servers
93 lease - The lease time, in seconds
94 dhcptype - DHCP message type (safely ignored)
95 serverid - The IP of the server
96 message - Reason for a DHCPNAK
97 tftp - The TFTP server name
98 bootfile - The bootfile name
99
100additional options are easily added in options.c.
101
102
103note on udhcpc's random seed
104---------------------------
105
106udhcpc will seed its random number generator (used for generating xid's)
107by reading /dev/urandom. If you have a lot of embedded systems on the same
108network, with no entropy, you can either seed /dev/urandom by a method of
109your own, or doing the following on startup:
110
111ifconfig eth0 > /dev/urandom
112
113in order to seed /dev/urandom with some data (mac address) unique to your
114system. If reading /dev/urandom fails, udhcpc will fall back to its old
115behavior of seeding with time(0).
116
117
118signals accepted by udhcpc
119-------------------------
120
121udhcpc also responds to SIGUSR1 and SIGUSR2. SIGUSR1 will force a renew state,
122and SIGUSR2 will force a release of the current lease, and cause udhcpc to
123go into an inactive state (until it is killed, or receives a SIGUSR1). You do
124not need to sleep between sending signals, as signals received are processed
125sequencially in the order they are received.
126
127
128compile time options
129-------------------
130
131options.c contains a set of dhcp options for the client:
132
133 name[10]: The name of the option as it will appear in scripts
134
135 flags: The type of option, as well as if it will be requested
136 by the client (OPTION_REQ)
137
138 code: The DHCP code for this option
139