udhcpc − very small DHCP client
udhcpc [OPTION]...
The udhcp client negotiates a lease with the DHCP server and executes a script when it is obtained or lost.
−c CLIENTID, −−clientid=CLIENTID
Send the client identifier CLIENTID.
-f, −−foreground
Do not fork after obtaining a lease.
−H HOSTNAME, −−hostname=HOSTNAME
Send the client hostname HOSTNAME.
−h HOSTNAME
Alias for -H HOSTNAME.
−i INTERFACE, −−interface=INTERFACE
Configure INTERFACE.
-n, −−now
Exit with failure if a lease cannot be obtained.
−p FILE, −−pidfile=FILE
Write the process ID of the daemon to FILE.
-q, −−quit
Exit after obtaining a lease.
−r ADDRESS, −−request=ADDRESS
Request IP address ADDRESS.
−s FILE, −−script=FILE
Use script FILE.
-v, −−version
Display version.
When an event occurs, udhcpc executes a script. There are four possible arguments to this script:
deconfig
deconfig is used when udhcpc starts, and when a lease is lost. The script should put the interface in an up, but deconfigured, state.
bound |
bound is used when udhcpc moves from an unbound to a bound state. The script should configure the interface and set any other relevant parameters (e.g., default gateway, dns server, etc.). |
||
renew |
renew is used when udhcpc when a lease is renewed. The interface is already configured, so the IP address will not change. Other parameters (e.g., default gateway, subnet mask, dns server) may. |
||
nak |
nak is used when udhcpc receieves a NAK packet from the server. The enviromental variable $message will contain the reason for the NAK message if the server included one. Processing this message is optional, as the script will also be called with deconfig if need be. |
Parameters are passed to the script via the following environment variables:
HOME |
The inherited HOME, or "/" if it is unset. |
||
PATH |
The inherited PATH, or "/bin:/usr/bin:/sbin:/usr/sbin" if it is unset. |
interface
The interface.
ip |
The client IP address. |
|||
siaddr |
The BOOTP next server option. |
|||
sname |
The BOOTP server name option. |
boot_file
The BOOTP boot file option.
subnet |
The subnet mask. |
timezone
The timezone offset from UTC in seconds.
router |
The list of routers. |
timesvr
The list of time servers.
namesvr
The list of IEN 116 name servers.
dns |
The list of DNS servers. |
|||
logsvr |
The list of MIT-LCS UDP log servers. |
cookiesvr
The list of RFC 865 cookie servers.
lprsvr |
The list of LPR servers. |
hostname
The host name.
bootsize
The length in 512-octet blocks of the bootfile.
domain |
The domain name of the network. |
swapsvr
The client’s swap server.
rootpath
The path of the client’s root dist.
ipttl |
The TTL. |
|||
mtu |
The MTU. |
broadcast
The broadcast address.
ntpsrv |
The list of NTP servers. |
|||
wins |
The list of WINS servers. |
|||
lease |
The lease time in seconds. |
dhcptype
The DHCP message type (safely ignored).
serverid
The server IP address.
message
Reason for a DHCPNAK.
tftp |
The TFTP server name. |
bootfile
The bootfile name.
/etc/udhcpc/default.script
Script run when leases are obtained or lost.
udhcpc responds to the following signals:
SIGUSR1
This signal causes udhcpc to renew the current lease or, if it does not have one, obtain a new lease.
SIGUSR2
This signal caused udhcpc to release the current lease.