Using the pump DHCP Client

pump is available on Red Hat systems, and supports both BootP and DHCP. Red Hat Linux 7.2 runs the pump command from the /sbin/ifup script only when dhcpcd is not found. This is an either/or proposition. You use either dhcpcd or pump; you do not use both. An interface that is configured by dhcpcd cannot be managed by pump. If your system uses dhcpcd, and most do, you can skip this section.

The pump command is very simple: pump -i eth0 configures interface eth0 with the information received from the DHCP server. Although pump normally runs from a startup script, it is possible to manually enter the command in order to check the status, release the address lease, or renew the lease. The possible pump command-line options are listed in Table 8.1.

Table 8.1: pump Command-Line Options

Command Option

Purpose

—config-file=path

Specifies the path to the pump configuration file. The default is /etc/pump.conf.

—help

Displays a help message for the pump command.

—hostname=hostname

Defines the hostname the client sends to the server.

—interface=device

Identifies the device being configured.

--kill

Kills the pump daemon.

—lease=hours

Requests a specific lease time in hours.

—leasesecs=seconds

Requests a specific lease time in seconds.

—lookup-hostname

Causes pump to look up the hostname via DNS.

—no-dns

Prevents pump from overwriting the /etc/resolv.conf file.

—no-gateway

Prevents pump from setting the client's default gateway.

—release

Releases the address assigned to the interface.

—renew

Requests a lease renewal.

—status

Displays the interface status.

—usage

Displays the syntax of the pump command.

—win-client-id

Formats the client identifier to be compatible with a Windows server.

Using the options in Table 8.1, you could query the status of an interface configured by pump by entering pump -i eth0 —status.

The pump.conf file is not required for an average configuration. pump.conf is used to customize the behavior of the pump program. The following directives can be used in the pump.conf file:

device name Identifies a network interface, such as eth0. This line is followed by a series of directives enclosed in curly braces ({}) that apply only to the network device identified by name.

domainsearch search-list Defines the DNS search list for this client. The search list received from the server is ignored, and this list is used.

nonisdomain Tells pump not to set a NIS domain—even if one is provided by the server, and no valid NIS domain is defined on the client. Normally, pump sets the NIS domain using the value supplied by the server if the client does not already have a valid NIS domain.

nogateway Tells pump not to set a default gateway for the client.

retries count Defines the number of times that pump should retry when negotiations with the server fail.

timeout seconds Defines the number of seconds that pump should wait for the negotiations with the server to conclude.

script filename Identifies a script that pump should run when a new address lease is obtained, when an address lease is successfully renewed, and when the interface is brought down. When a new address lease is obtained, pump runs the script, passing it the keyword up, the interface name, and the new IP address. When an address lease is successfully renewed, pump runs the script; and passes it the keyword renewal, the interface name, and the IP address. When the interface is brought down, pump releases the address lease, and runs the script, passing the script the keyword down and the interface name.

A simple pump.conf file is shown in Listing 8.4.

Listing 8.4: A Sample pump.conf File

$ cat /etc/pump.conf

# Set the timeout to 60 seconds timeout 60

# Do not use a route through eth1 as the default device eth1 { nogateway

The pump.conf file is a simple ASCII text file. Comments are indicated by the hash mark (#). Global parameters can be set for the entire system. In Listing 8.4, timeout is set as a global parameter. In this case, it tells pump to wait 60 seconds before timing out the DHCP negotiations. Parameters can also be set for individual devices. In Listing 8.4, the device statement identifies the second Ethernet interface. The curly braces that follow the device statement enclose directives that apply only to the second Ethernet interface eth1. The nogateway directive tells pump not to reset the client's default gateway, based on DHCP information that arrives through the eth1 interface. Perhaps eth0 is the primary interface, and you want to ensure that a default route learned from eth1 does not overwrite the default route that goes through eth0.

Both pump and dhcpcd have enough flexibility for any average system. If you have neither of these tools on your system, or you need to create a highly complex custom configuration, you can use dhclient, which is the DHCP client package provided with the dhcpd distribution.

Was this article helpful?

0 0

Post a comment