Configuring the DHCP Server

 < Day Day Up > 



On Red Hat systems, you can stop and start the DHCP server using the dhcpd command in the /etc/rc.d/init.d directory. Use the redhat-config-services tool or the service command with the start, restart, and stop options. The following example starts the DHCP server. Use the stop option to shut it down, and restart will restart it.

service dhcpd start 

Dynamically allocated IP addresses will be assigned for a given time, known as leases. When a lease expires, it can be extended or a new one generated. Current leases are listed in the dhcpd.leases file located in the /var/lib/dhcp directory. A lease entry will specify the IP address and the start and end times of the lease along with the client's hostname.

On Red Hat, DHCP server arguments and options can be specified in the /etc/sysconfig/dhcpd file. Network device arguments specify which network device the DHCP server should run on. You can also specify options like the configuration file to use or the port to listen on. Network device arguments are needed should you have two or more network interfaces on your system but want the DHCP server to operate on only selected connections. Such arguments are listed in the /etc/sysconf/dhcpd file using the DHCPARGS setting. The following example says to run the DHSP server only on the Ethernet network device eth0:

DHPCARGS=eth0

This kind of configuration is useful for gateway systems that are connected both to a local network and a larger network like the Internet through different network devices. On the Internet connection, you may want to run the DCHP client to receive an IP address from an ISP, and on the local network connection, you would want to run the DHCP server to assign IP addresses to local hosts.

The configuration file for the DHCP server is /etc/dhcpd.conf, where you specify parameters and declarations that define how different DHCP clients on your network are accessed by the DHCP server, along with options that define information passed to the clients by the DHCP server. These parameters, declarations, and options can be defined globally for certain subnetworks, or for specific hosts. Global parameters, declarations, and options apply to all clients, unless overridden by corresponding declarations and options in subnet or host declarations. Technically, all entries in a dhcpd.conf file are statements that can be either declarations or parameters. All statements end with a semicolon. Options are specified in options parameter statements. Parameters differ from declarations in that they define if and how to perform tasks, such as how long a lease is allocated. Declarations describe network features such as the range of addresses to allocate or the networks that are accessible. See Table 35-1 at the end of this chapter for a listing of commonly used declarations and options.

Declarations provide information for the DHCP server or designate actions it is to perform. For example, the range declaration is used to specify the range of IP addresses to be dynamically allocated to hosts:

range 192.168.0.5 192.168.0.128;

With parameters, you can specify how the server is to treat clients. For example, the default-lease-time declaration sets the number of seconds a lease is assigned to a client. The filename declaration specifies the boot file to be used by the client. The server-name declaration informs the client of the host from which it is booting. The fixed-address declaration can be used to assign a static IP address to a client. See the Man page for dhcpd.conf for a complete listing.

Options provide information to clients that they may need to access network services, such as the domain name of the network, the domain name servers that clients use, or the broadcast address. See the Man page for dhcp-options for a complete listing. This information is provided by option parameters as shown here:

option broadcast-address 192.168.0.255; option domain-name-servers 192.168.0.1, 192.168.0.4; option domain-name "mytrek.com";

Your dhcpd.conf file will usually begin with declarations, parameters, and options that you define for your network serviced by the DHCP server. The following example provides router (gateway), netmask, domain name, and DNS server information to clients. Additional parameters define the default and maximum lease times for dynamically allocated IP addresses.

option routers 192.168.0.1; option subnet-mask 255.255.255.0; option domain-name "mytrek.com "; option domain-name-servers 192.168.0.1; default-lease-time 21600; max-lease-time 43200;

With the subnet, host, and group declarations, you can reference clients in a specific network, particular clients, or different groupings of clients across networks. Within these declarations, you can enter parameters, declarations, or options that will apply only to those clients. Scoped declarations, parameters, and options are enclosed in braces. For example, to define a declaration for a particular host, you use the host declaration as shown here:

host rabbit {         declarations, parameters, or options;         }

You can collect different subnet, global, and host declaration into groups using the group declaration. In this case, the global declarations are applied only to those subnets and hosts declared within the group.



 < Day Day Up > 



Red Hat(c) The Complete Reference
Red Hat Enterprise Linux & Fedora Edition (DVD): The Complete Reference
ISBN: 0072230754
EAN: 2147483647
Year: 2004
Pages: 328

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net