MAN page from Mandriva 2010 dhcp-client-4.1.1-6mdv2010.1.i586.rpm
Section: Maintenance Commands (8)Index
dhclient - Dynamic Host Configuration Protocol Client
The Internet Systems Consortium DHCP Client, dhclient, provides ameans for configuring one or more network interfaces using the DynamicHost Configuration Protocol, BOOTP protocol, or if these protocolsfail, by statically assigning an address.
The DHCP protocol allows a host to contact a central server whichmaintains a list of IP addresses which may be assigned on one or moresubnets. A DHCP client may request an address from this pool, andthen use it on a temporary basis for communication on network. TheDHCP protocol also provides a mechanism whereby a client can learnimportant details about the network to which it is attached, such asthe location of a default router, the location of a name server, andso on.
If given the -4 command line argument (default), dhclient will use theDHCPv4 protocol to obtain an IPv4 address and configuration parameters.
If given the -6 command line argument, dhclient will use the DHCPv6protocol to obtain whatever IPv6 addresses are available along withconfiguration parameters. But with-Sit uses Information-request to get only (i.e., without address)stateless configuration parameters.
The default DHCPv6 behavior is modified too with-Twhich asks for IPv6 temporary addresses, one set per-Tflag.-Penables the IPv6 prefix delegation.As temporary addresses or prefix delegation disables the normaladdress query,-Nrestores it. Note it is not recommended to mix queries of different typestogether, or even to share the lease file between them.
If given the --version command line argument, dhclient will print itsversion number and exit.
On startup, dhclient reads thedhclient.conffor configuration instructions. It then gets a list of all thenetwork interfaces that are configured in the current system. Foreach interface, it attempts to configure the interface using the DHCPprotocol.
In order to keep track of leases across system reboots and serverrestarts, dhclient keeps a list of leases it has been assigned in thedhclient.leases(5) file. On startup, after reading the dhclient.conffile, dhclient reads the dhclient.leases file to refresh its memoryabout what leases it has been assigned.
When a new lease is acquired, it is appended to the end of thedhclient.leases file. In order to prevent the file from becomingarbitrarily large, from time to time dhclient creates a newdhclient.leases file from its in-core lease database. The old versionof the dhclient.leases file is retained under the namedhclient.leases~until the next time dhclient rewrites the database.
Old leases are kept around in case the DHCP server is unavailable whendhclient is first invoked (generally during the initial system bootprocess). In that event, old leases from the dhclient.leases filewhich have not yet expired are tested, and if they are determined tobe valid, they are used until either they expire or the DHCP serverbecomes available.
A mobile host which may sometimes need to access a network on which noDHCP server exists may be preloaded with a lease for a fixedaddress on that network. When all attempts to contact a DHCP serverhave failed, dhclient will try to validate the static lease, and if itsucceeds, will use that lease until it is restarted.
A mobile host may also travel to some networks on which DHCP is notavailable but BOOTP is. In that case, it may be advantageous toarrange with the network administrator for an entry on the BOOTPdatabase, so that the host can boot quickly on that network ratherthan cycling through the list of old leases.
The names of the network interfaces that dhclient should attempt toconfigure may be specified on the command line. If no interface namesare specified on the command line dhclient will normally identify allnetwork interfaces, eliminating non-broadcast interfaces ifpossible, and attempt to configure each interface.
It is also possible to specify interfaces by name in thedhclient.conf(5)file. If interfaces are specified in this way, then the client willonly configure interfaces that are either specified in theconfiguration file or on the command line, and will ignore all otherinterfaces.
If the DHCP client should listen and transmit on a port other than thestandard (port 68), the-pflag may used. It should be followed by the udp port number thatdhclient should use. This is mostly useful for debugging purposes.If a different port is specified for the client to listen on andtransmit on, the client will also use a different destination port -one less than the specified port.
The DHCP client normally transmits any protocol messages it sendsbefore acquiring an IP address to, 255.255.255.255, the IP limitedbroadcast address. For debugging purposes, it may be useful to havethe server transmit these messages to some other address. This canbe specified with the -sflag, followed by the IP address or domain name of the destination.This feature is not supported by DHCPv6.
For testing purposes, the giaddr field of all packets that the clientsends can be set using the-gflag, followed by the IP address to send. This is only useful for testing,and should not be expected to work in any consistent or useful way.
The DHCP client will normally run in the foreground until it hasconfigured an interface, and then will revert to running in thebackground. To run force dhclient to always run as a foregroundprocess, the-dflag should be specified. This is useful when running the clientunder a debugger, or when running it out of inittab on System Vsystems.
The dhclient daemon creates its own environment when executing thedhclient-script to do the grunt work of interface configuration.To define extra environment variables and their values, use the-eflag, followed by the environment variable name and value assignment,just as one would assign a variable in a shell. Eg:-eIF_METRIC=1
The client normally prints no output during its startup sequence. Itcan be made to emit verbose messages displaying the startup sequence eventsuntil it has acquired an address by supplying the-vcommand line argument. In either case, the client logs messages usingthesyslog (3)facility. A-qcommand line argument is provided for backwards compatibility, but sincedhclient is quiet by default, it has no effect.
The client normally doesn't release the current lease as it is notrequired by the DHCP protocol. Some cable ISPs require their clientsto notify the server if they wish to release an assigned IP address.The-rflag explicitly releases the current lease, and once the lease has beenreleased, the client exits.
The-xflag tells any currently running client to exit gracefully withoutreleasing leases first.
If the client is killed by a signal (for example at shutdown or reboot)it won't execute thedhclient-script (8)at exit. However if you shut the client down gracefully with-ror-xit will executedhclient-script (8)at shutdown with the specific reason for calling the script set.
The-1flag will cause dhclient to try once to get a lease. If it fails, dhclientexits with exit code two. In DHCPv6 the-1flag sets the max duration of the initial exchange totimeout(fromdhclient.conf,default sixty seconds).
The DHCP client normally gets its configuration information fromETCDIR/dhclient.conf,its lease database fromDBDIR/dhclient.leases,stores its process ID in a file calledRUNDIR/dhclient.pid,and configures the network interface usingCLIENTBINDIR/dhclient-scriptTo specify different names and/or locations for these files, use the-cf,-lf,-pfand-sfflags, respectively, followed by the name of the file. This can beparticularly useful if, for example,DBDIRorRUNDIRhas not yet been mounted when the DHCP client is started.
The DHCP client normally exits if it isn't able to identify anynetwork interfaces to configure. On laptop computers and othercomputers with hot-swappable I/O buses, it is possible that abroadcast interface may be added after system startup. The-wflag can be used to cause the client not to exit when it doesn't findany such interfaces. Theomshell (1)program can then be used to notify the client when a network interfacehas been added or removed, so that the client can attempt to configure an IPaddress on that interface.
The DHCP client can be directed not to attempt to configure any interfacesusing the-nflag. This is most likely to be useful in combination with the-wflag.
The client can also be instructed to become a daemon immediately, ratherthan waiting until it has acquired an IP address. This can be done bysupplying the-nwflag.
The syntax of the dhclient.conf
(5) file is discussed separately.
The DHCP client provides some ability to control it while it isrunning, without stopping it. This capability is provided using OMAPI,an API for manipulating remote objects. OMAPI clients connect to theclient using TCP/IP, authenticate, and can then examine the client'scurrent status and make changes to it.
Rather than implementing the underlying OMAPI protocol directly, userprograms should use the dhcpctl API or OMAPI itself. Dhcpctl is awrapper that handles some of the housekeeping chores that OMAPI doesnot do automatically. Dhcpctl and OMAPI are documented in dhcpctl(3)and omapi(3). Most things you'd want to do with the client canbe done directly using the omshell(1) command, rather thanhaving to write a special program.
THE CONTROL OBJECT
The control object allows you to shut the client down, releasing allleases that it holds and deleting any DNS records it may have added.It also allows you to pause the client - this unconfigures anyinterfaces the client is using. You can then restart it, whichcauses it to reconfigure those interfaces. You would normally pausethe client prior to going into hibernation or sleep on a laptopcomputer. You would then resume it after the power comes back.This allows PC cards to be shut down while the computer is hibernatingor sleeping, and then reinitialized to their previous state once thecomputer comes out of hibernation or sleep.
The control object has one attribute - the state attribute. To shutthe client down, set its state attribute to 2. It will automaticallydo a DHCPRELEASE. To pause it, set its state attribute to 3. Toresume it, set its state attribute to 4.
FILESCLIENTBINDIR/dhclient-script,ETCDIR/dhclient.conf, DBDIR/dhclient.leases, RUNDIR/dhclient.pid,DBDIR/dhclient.leases~.
has been written for Internet Systems Consortiumby Ted Lemon in cooperation with VixieEnterprises. To learn more about Internet Systems Consortium,seehttps://www.isc.org
To learn more about VixieEnterprises, seehttp://www.vix.com.
This client was substantially modified and enhanced by Elliot Pogerfor use on Linux while he was working on the MosquitoNet project atStanford.
The current version owes much to Elliot's Linux enhancements, butwas substantially reorganized and partially rewritten by Ted Lemonso as to use the same networking framework that the Internet SystemsConsortium DHCP server uses. Much system-specific configuration codewas moved into a shell script so that as support for more operatingsystems is added, it will not be necessary to port and maintainsystem-specific configuration code to these operating systems - instead,the shell script can invoke the native tools to accomplish the samepurpose.
- COMMAND LINE
- THE CONTROL OBJECT
- SEE ALSO
This document was created byman2html,using the manual pages.