[Previous] [Contents] [Index] [Next]

dhcp.client

TCP/IP host configuration utility

Syntax:


Note: You must be root to run this utility.

dhcp.client [-bdnr] [-h hostname]  
            [-I num] [-i interface]
            [-P port] [-p port]
            [-s host] [-t num] [-u] &

Options:

-b
Request the DHCP server to sent its response packets only to the client where appropriate (default is to request the server to broadcast).
-d
Write debugging info to the system log.
-h hostname
Hostname of client (default is supplied by the server if the hostname is available).
-I num
The number of times to poll waiting for interface to be available (default is 5). Polling is done every 2 seconds.

You can use this option to make dhcp.client wait until the interface it's to use is available. This is useful in a boot environment when you might not know when the driver is running and registered with the TCPIP stack. The exit status is 2 if no interface is found.

-i interface
Name of the interface to configure (e.g. en1,en2,...) (default is the first interface found).
-n
Don't modify the resolv.conf file when data for the file is received from the server.
-P port
DHCP server port (default is dhcp port or port 67).
-p port
DHCP client port (default is dhcpc port or port 68).
Note: -P port has been changed from port 68 to port 67.

-r
Add .node_number to /etc/resolv.conf filename (default is off).
-s host
Accept packets from this server only; ignore responses from other servers.
-t num
Attempt to reach the server num times before giving up and terminating (the default is forever). Each attempt lasts 1 minute.

You're likely to use this option in combination with the -u option so that dhcp.client times out after a specified number of attempts.

-u
Don't move dhcp.client to the background until the interface is configured.

This option is useful for spawning dhcp.client. The process doesn't move to the background until it has contacted a server and applied a TCP/IP configuration. The exit status is 3 if no server responds.

Description:

The dhcp.client obtains the TCP/IP configuration parameters dynamically from a DHCP (Dynamic Host Configuration Protocol) server, then automatically configures your TCP/IP host. You don't have to provide an IP address or any configuration parameters, or run any configuration utilities.


Note: The TCP/IP stack must be started before the dhcp.client.

The minimum commands to run under QNX 4 are:

Tcpip 'hostname' &
dhcp.client &
if_up enx

Note: Localhost is automatically configured when the TCP/IP stack is started and can't be configured manually if dhcp.client is being used. This can affect the broadcast behavior of the stack if you're attempting to use the 255.255.255.255 address.

The dhcp.client configures the first unconfigured interface found (this includes an interface configured to 0.0.0.0). If the -i option is used, the interface specified is configured even if it was configured previously.

This utility obtains and implements the following information from the DHCP server:

The domain and nameserver are written to /etc/resolv.conf (see the -r option) unless -n is specified.

/etc/dhcp/dhcp-up

If this script exists, it's run after a DHCP server had been contacted and a configuration has been applied. Environment variables that contain the configuration that was obtained and applied from the server, are passed to the script. The environment definitions are:

BROADCAST
The client broadcast address that was obtained from the server (e.g. BROADCAST=10.255.255.255).
GATEWAY
The gateway that the client is to use (e.g. GATEWAY=10.0.0.2).
HOSTNAME
The hostname of the client (e.g. HOSTNAME=node1).
INTERFACE
The interface that was configured (e.g. INTERFACE=en0).
IPADDRESS
The client IP address that was obtained from the server (e.g. IPADDRESS=10.0.0.1).
LEASEEXPIRES
The time at which the lease expires (e.g. LEASEEXPIRES=Mon Oct 31 16:46:10 2000).
LEASEOBTAINED
The time at which the lease was obtained (e.g. LEASEOBTAINED=Mon Oct 30 16:46:10 2000).
NAMESERVER1,
NAMESERVER2
The nameserver that the client is to use (e.g. NAMESERVER1=10.0.0.4).
NETMASK
The client netmask that was obtained from the server (e.g. NETMASK=255.0.0.0).
SERVER
The server's IP address (e.g. SERVER=10.0.0.3).

The following options are available, but not applied by the dhcp.client process:

FILENAME
The filename supplied in the server response (e.g. FILENAME=/bootimg).

Any other options are defined as environment variables OPTIONx, where x is the option number. If the option is known, dhcp.client tries to format it as readable information. If the option isn't known, dhcp.client displays each octet as hexadecimal (e.g. OPTION200= F1 AA 56 42).

Currently, dhcp.client is aware of options 1 to 61.

Files:

/etc/dhcp/dhcp.lock
Temporary lock file. If you're using dhcp.client on more than one interface, it's recommended that you create the /etc/dhcp directory. When the directory exists, a temporary lock file, /etc/dhcp/dhcp.lock, is created by the client modifying the interface. This prevents two clients from modifying  /etc/resolv.conf concurrently.

Exit status:

0
Success.
1
An error occurred.
2
No interface was found.
3
No server responded.

Errors:

Errors that occur during configuration are reported to system log.

See also:

Tcpip

RFC 2131


[Previous] [Contents] [Index] [Next]