Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Related items

Made to Measure : Apache Web Server Customization

Apache at your Web Service

Jump Start your Intranet Web Sites - Setting up Virtual Hosts on Apache

Linux #6 Stairway to Heaven? - Setting up your Linux Server as an Internet Gateway!

Linux with RPM

Linux #5 What's in a name? - Domain Name Server on Linux

Linux #3 "You teach best...."

Linux#2 Net Connection

Linux#1 A Red Hat to cover your a-- (oops!) head.

Linux #4 "Setting up DHCP is not P2C2E"

You are here: irt.org | Articles | Linux & Apache | Linux #4 "Setting up DHCP is not P2C2E" [ previous next ]

Published on: Satuday 14th November 1998 By: Tarique Sani

Introduction

P2C2E - Process Too Complicated To Explain, for once I know the exact origin of this acronym it is from the (in)famous British writer Salman Rushdie's lesser known books "Haroun and the sea of stories".

DHCP - Dynamic Host Configuration Protocol lets you automatically assign an IP address to a machine on your network from a range of IP addresses. Well what is so great about it and why should you use it?

Why Use DHCP?

Of course, I have my usual three good reasons.

  1. You don't have to manually configure your machines on the network with a static IP address, which I am told is a tough job.
  2. With mobile computing in vogue people on your network can log in from any point without having to reconfigure their machines.
  3. Theoretically you can have a larger number of machines on your network as the machines which are not running will not hog the IP addresses

Configuring DHCP

The best thing is that all you need to do is edit a few lines in a few files, the most complex of these is dhcpd.conf in the /etc directory. Believe me this file contains all the information that the daemon (a techie word for a special type of program) needs. Let us examine this file:

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.250;
default-lease-time 86400;
max-lease-time 259200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option domain-name-servers 192.168.1.1;
option domain-name "yourdomain.com";
}

Lets look at these lines a bit more closely.

  1. The first line specifies the (sub)network that the DHCP server is to manage or maintain. Within this network, we have to configure different parameters (written within the curly braces).
  2. The next line contains the range from which the server picks up IP addresses to allocate. The starting and ending IP addresses are entered here.
  3. Line 3 contains the default lease time. A lease is the amount of time that a particular machine can hold an IP address before having to renew the lease with the server. The value is given in number of seconds, so 86400 stands for one day.
  4. The next line, max-lease-time, specifies the maximum amount of time that a machine can hold on to a specific IP address.

Then come other options that will also be transmitted to the machine. These include the subnet mask, the router, the domain name server, and the domain name.

Once this is done, you need to create a file called dhcpd.leases, also in the /etc/ directory, which will contain information about which IP address has been allocated to which machine. Since all this will be done by the server, all you need to do is create a 0 byte file with the command, touch /etc/dhcpd.leases.

The next step requires you to add a broadcast route. Do this by appending the line /sbin/route add –host 255.255.255.255 dev eth0 to /etc/rc.d/rc.local.

Finally, make sure DHCP is started at bootup. You can do this by running Setup, choosing ntsysv, and enabling dhcpd. Restart the machine, by giving the command sync, followed by reboot.

Your DHCP server will be up and running after the machine starts up. Any machine that logs on the network will receive an IP address and all other parameters automatically. If it's a Win 95 client, you can check all the settings by running winipcfg in the Run dialog box.

Adding Static Address Computers

There may be cases when you need to assign a particular machine the same IP address always. You can either hardwire the information in the computer or add the following lines to the dhcpd.conf file.

host bossnode {
hardware ethernet 00:80:C8:85:B5:D2;
fixed-address 192.168.1.1;
option host-name "bossnode";
}

This specifies the ethernet address, which will be unique, the IP address that will always be allocated to that machine, and a host name.

Last word

That's it for now, Yes I remember that I had promised to write about setting up DNS in this article but setting up DNS is indeed a bit of P2C2E and I am still debating how best to simplify it. I promise that the next piece will surely be on DNS.

Related items

Made to Measure : Apache Web Server Customization

Apache at your Web Service

Jump Start your Intranet Web Sites - Setting up Virtual Hosts on Apache

Linux #6 Stairway to Heaven? - Setting up your Linux Server as an Internet Gateway!

Linux with RPM

Linux #5 What's in a name? - Domain Name Server on Linux

Linux #3 "You teach best...."

Linux#2 Net Connection

Linux#1 A Red Hat to cover your a-- (oops!) head.

©2018 Martin Webb