Made to Measure : Apache Web Server Customization
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!
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
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?
Of course, I have my usual three good reasons.
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.
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.
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.
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.
Made to Measure : Apache Web Server Customization
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 #5 What's in a name? - Domain Name Server on Linux