machines configured through DHCP alone; there fore, services cannot be provided. However, DHCP can make assignments based on DNS entries when using subnet/hostname or subnet/hardware address identifiers.

NOTE

The problem of using DHCP to configure servers that make use of registered host- names is being addressed by Dynamic DNS which, when fully developed, will enable DHCP to register IP addresses with DNS. This will allow you, for example, to register a domain name (such as imalinuxuser.com) and be able to easily access that domain's web server without needing to use static IP addressing of a specific host. The largest hurdle to overcome is the security implication of enabling each host connecting to the system to update DNS. A few companies, such as DynDNS (http://www.dyndns.com/), are already offering Dynamic DNS services and have clients for Linux.

DHCP Software Installation

Installation of the DHCP client and server might be easiest during the initial install of Fedora, but you can also use yum later. This section describes configuring the dhclient and setting up and running the dhpcd daemon.

DHCP dhclient

As previously mentioned, using DHCP for an installed NIC is easily accomplished when installing Fedora on your host (read more about installation in Chapter 1, 'Installing Fedora'), and during the network step of installation, you can choose to have DHCP initiated at boot time. If you choose to do this (and choose to install the DHCP client package), the DHCP client, dhclient, sends a broadcast message to which the DHCP server replies with networking information for your host. That's it; you're finished.

If you choose to install from source, you will have to (as root) download and install the server packages that include dhclient. Unpack the source file, run ./configure from the root of the source directory, run make, and then run make install. This should put the DHCP client binaries where they will start at the correct time in the boot process.

You can however, fine-tune how dhclient works, and where and how it obtains or looks for DHCP information. You probably will not need to take this additional effort; but if you do, you can create and edit a file named dhclient.conf, and save it in the /etc directory with your settings. A few of the dhclient.conf options include the following:

timeout time ; — How long to wait before giving up trying (60 seconds is the default)

retry time ; — How long to wait before retrying (5 minutes is the default)

select-timeout time ; — How long to wait before selecting a DHCP offer (0 seconds is the default)

reboot time ; — How long to wait before trying to get a previously set IP (10 seconds is the default)

renew date ; — When to renew an IP lease, where date is in the form of <weekday><year>/<month>/<day><hour>:<minut e>:<second>, such as 4 2004/1/1 22:01:01 for Thursday, January 4, 2004 at 10:01 p.m.

See the dhclient.conf man page for more information on additional settings.

DHCP Server

Again, the easiest way to install the DHCP server on your computer is to include the RPMs at install time or to use yum if you have installed your machine without installing the DHCP server. If you are so inclined, you can go to the Internet Software Consortium (ISC) website and download and build the source code yourself (http://www.isc.org/).

If you decide to install from a source downloaded from the ISC website, the installation is straightforward. Just unpack your tar file, run ./configure from the root of the source directory, run make, and finally, if there are no errors, run make install. This puts all the files used by the DHCP daemon in the correct places. It's best to leave the source files in place until you are sure that DHCP is running correctly; otherwise, you can delete the source tree.

NOTE

For whichever installation method you choose, be sure that a file called /etc/dhcpd.leases is created. The file can be empty, but it does need to exist for dhcpd to start properly.

Using DHCP to Configure Network Hosts

Configuring your network with DHCP can look difficult, but is actually easy if your needs are simple. The server configuration can take a bit more work if your network is more complex and depending on how much you want DHCP to do.

DHCP Server Configuration

Configuring the server takes some thought and a little bit of work. Luckily, the work involves editing only a single configuration file, /etc/dhcpd.conf. To start the server at boot time, use the service command or the GUI-based system-config-services.

The /etc/dhcpd.conf file contains all the information needed to run dhcpd. Fedora includes a sample dhcpd.conf in /usr/share/doc/dhcp*/dhcpd.conf.sample. The DHCP server source files also contain a sample dhcpd.conf file.

The /etc/dhcpd.conf file can be looked at as a three-part file. The first part contains configurations for DHCP itself. The configurations include

Setting the domain nameoption domain-name 'example.org'.

Setting DNS serversoption domain-name-servers ns1.example.org, ns2.example.org (IP addresses can be substituted).

Setting the default and maximum lease timesdefault-lease-time 3600 and max-lease-time 14400.

Other settings in the first part include whether the server is the primary (authoritative) server and what type of logging DHCP should use. These settings are considered defaults and can be overridden by the subnet and host portion of the configuration in more complex situations.

NOTE

The dhcpd.conf file requires semicolons (;) after each command statement. If your configuration file has errors or runs improperly, check for this.

The next part of the dhcpd.conf deals with the different subnets that your DHCP server serves; this section is quite straightforward. Each subnet is defined separately and can look like this:

subnet 10.5.5.0 netmask 255.255.255.224 {

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату