Previous Section
 < Day Day Up > 
Next Section


Fixed Addresses

Instead of using a pool of possible IP addresses for your hosts, you may want to give each one a specific addresses. Using the DHCP server still gives you control over which address will be assigned to a given host. However, to assign an address to a particular host, you need to know the hardware address for that host's network interface card (NIC). In effect, you have to inform the DHCP server that it has to associate a particular network connection device with a specified IP address. To do that, the DHCP server needs to know which network device you are referring to. You can identify a network device by its hardware address, known as its MAC address. To find out a client's hardware address, you log in to the client and use the ifconfig command to find out information about your network devices. To list all network devices, use the -a option. If you know your network device name, you can use that. The next example will list all information about the first Ethernet device, eth0:

ifconfig eth0

This will list information on all the client's network connection devices. The entry (usually the first) with the term HWaddr will display the MAC address. Once you have the MAC address, you can use it on the DHCP server to assign a specific IP address to that device.

In the dhcpd.conf file, you use a host declaration to set up a fixed address for a client. Within the host declaration, you place a hardware option in which you list the type of network connection device and its MAC address. Then you use the fixed-address parameter to specify the IP address to be assigned to that device. In the following example, the client's network device with a MAC address of 08:00:2b:4c:29:32 is given the IP address 192.168.0.2:

host rabbit {
             option host-name "rabbit.mytrek.com"
             hardware ethernet 08:00:2b:4c:29:32;
             fixed-address 192.168.0.2;
             }

You can also have the DHCP server perform a DNS lookup to obtain the host's IP address. This has the advantage of letting you manage IP addresses in only one place, the DNS server. Of course, this requires that the DNS server be operating so that the DHCP server can determine the IP address. For example, a proxy server connection (which can provide direct Web access) needs just an IP address, not a DNS hostname, to operate. If the DNS server were down, the preceding example would still assign an IP address to the host, whereas the following example would not:

host rabbit {
             option host-name "rabbit.mytrek.com"
             hardware ethernet 08:00:2b:4c:29:32;
             fixed-address rabbit.mytrek.com;
             }

You can also use the host declaration to define network information for a diskless workstation or terminal. In this case, you add a filename parameter specifying the boot file to use for that workstation or terminal. Here the terminal called myterm obtains boot information from the server turtle.mytrek.com.

host myterm {
             option host-name "myterm.mytrek.com"
             filename "/boot/vmlinuz";
             hardware ethernet 08:00:2b:4c:29:32;
             server-name "turtle.mytrek.com";
             }

The implementation of a very simple DHCP server for fixed addresses is shown in the sample dhcpd.conf file that follows. In the second host declaration, the DHCP will perform a DNS lookup to obtain the IP address of rabbit.mytrek.com.

/etc/dhcpd.conf
Start example
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "mytrek.com ";
option domain-name-servers 192.168.1.1;
   
subnet 192.168.1.0 netmask 255.255.255.0 {
host turtle {
            option host-name "turtle.mytrek.com"
            hardware ethernet 08:00:2b:4c:29:32;
            fixed-address 192.168.0.1;
            }
host rabbit {
           option host-name "rabbit.mytrek.com"
           hardware ethernet 00:80:AD:30:17:2A;
           fixed-address rabbit.mytrek.com;
           }
host lizard {
           option host-name "lizard.mytrek.com"
           hardware ethernet 00:70:2b:4b:29:14;
           fixed-address 192.168.0.3;
           }
}
End example

A host declaration can also be placed within the subnet declaration to provide information about particular hosts in that subnet.

A common candidate for a fixed address is the DNS server for a network. Usually, you would want the DNS server located at the same IP address, so that it can be directly accessed. The DHCP server can then provide this IP address to its clients.

Table 35-1: DHCP Declarations, Parameters, and Options

Entries

Description

Declarations

 

shared-network name

Used to indicate if some subnets share the same physical network

subnet subnet-number netmask

References an entire subnet of addresses

range [ dynamic-bootp ] low-address
[ high-address ];

Provides the highest and lowest dynamically allocated IP addresses

host hostname

References a particular host

group

Lets you label a group of parameters and declarations and then use the label to apply them to subnets and hosts

allow unknown-clients; deny unknown-clients;

Does not dynamically assign addresses to unknown clients

allow bootp; deny bootp;

Determines whether to respond to bootp queries

allow booting; deny booting;

Determines whether to respond to client queries

Parameters

 

default-lease-time time;

Length in seconds assigned to a lease

max-lease-time time;

Maximum length of lease

hardware hardware-type hardware-address;

Network hardware type (Ethernet or token ring) and address

filename "filename";

Name of the initial boot file

server-name "name";

Name of the server from which a client is booting

next-server server-name;

Server that loads the initial boot file specified in the filename

fixed-address address [, address ... ];

Assigns a fixed address to a client

get-lease-hostnames flag;

Determines whether to look up and use IP addresses of clients

authoritative; not authoritative;

Denies invalid address requests

server-identifier hostname;

Specifies the server

Options

 

option subnet-mask ip-address;

Client's subnet mask

option routers ip-address [, ip-address... ];

List of router IP addresses on client's subnet

option domain-name-servers ip-address [, ip-address... ];

List of domain name servers used by the client

option log-servers ip-address
[, ip-address... ];

List of log servers used by the client

option host-name string;

Client's hostname

option domain-name string;

Client's domain name

option broadcast-address ip-address;

Client's broadcast address

option nis-domain string;

Client's Network Information Service domain

option nis-servers ip-address
[, ip-address... ];

NIS servers the client can use

option smtp-server ip-address
[, ip-address... ];

List of SMTP servers used by the client

option pop-server ip-address
[, ip-address... ];

List of POP servers used by the client

option nntp-server ip-address
[, ip-address... ];

List of NNTP servers used by the client

option www-server ip-address
[, ip-address... ];

List of Web servers used by the client



Previous Section
 < Day Day Up > 
Next Section
This HTML Help has been published using the chm2web software.