What is a DHCP?
Every computer that is connected to a network and that uses TCP/IP, needs TCP/IP configurations, and since it's not practical and effective to be giving these out manually every time you start your computers in your network, DHCP servers exists. DHCP stands for Dynamic Host Control Protocol, and is a service that simply delivers TCP/IP configurations for computers in a network and "lends" them IP addresses.
Installing the DHCP server
First of all you have to of course install the server itself, and in Debian this can easily be done by using the apt-get command to download and install it from the Debian repository.
Code: Select all
apt-get install dhcp3-server
Configuring the DHCP server
Then you have to configure the DHCP server to fit your needs, you have to invoke the following command to edit the config file, also take your time to discover the other files that are located in the /etc/dhcp3 folder.
Code: Select all
nano /etc/dhcp3/dhcpd.conf
Code: Select all
ddns-update-style none;
ddns-updates off;
deny client-updates;
one-lease-per-client false;
allow bootp;
option T150 code 150 = string;
ddns-update-style none : ddns or Dynamic DNS is a method for clients to tell a DNS server to change it's configurations. This option can either be interim, none or ad-hoc. I recommend using none for starters.
ddns-updates off : same as above, simply shuts it off completely
deny client-updates : If this is set, a client can not update it's configuration. It will have to either drop the leasing of the IP address or wait until the leasing time goes out.
one-lease-per-client false : if this is set to false, a client can have more then one lease.
allow bootp : bootp is commonly used by nodes that doesn't have a harddrive to get a configuration, it basically means that your computer can get the configurations during startup.
And these at the bottom, in this example they are specifik for my network, so you will have to edit the file to fit your needs.
Code: Select all
subnet 10.0.0.0 netmask 255.255.255.0 {
interface eth1;
range 10.0.0.10 10.0.0.254;
default-lease-time 6000;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 10.0.0.255;
option routers 10.0.0.1;
option domain-name-servers 192.168.0.1;
option time-offset -3600;
}
subnet 10.0.0.0: The network id
netmask 255.255.255.0: The netmask for the network, netmasks are often used to split ip ranges in smaller networks, but this one is a default one (for the wrong IP class but, meh ^^)
interface eth1: The network interface the server till be listening on.
range 10.0.0.10 10.0.0.254: The IP range it will deliver.
default-lease-time 6000: the default time a lease is held, the default time a computer can borrow an IP before the server checks if it still wants it. You should set this to a higher number, to reduce errors and traffic.
max-lease-time 7200: maximum time it can borrow an IP.
The options below are the configurations that the DHCP server will send to the client requesting the configuration.
option subnet-mask 255.255.255.0: This one was explained before ^^
option broadcast-address 10.0.0.255: The address the computer will broadcast on. Broadcast is used for different things, for example when the client wants to find another clients name, or if it wants a DHCP server to respond when it doesn't have one, it will send out a broadcast on the network.
option routers 10.0.0.1: The default router/gateway. A router is a node that divides a network in two basically, this is almost always your "broadband router". A router has 2 IP's for your information, but I wont explain that here.
option domain-name-servers 192.168.0.1: If you have a DNS server on the network you can use this option. Notice that the IP is of a totally different class then the ones given out by the DHCP. This is because that is the IP of a second router on my home network, which is the primary one that I use.
option time-offset -3600: Explains itself, note that the time offset is set in seconds.
These are simply specific configurations for some of my computers, most of them should be easy to understand now since I just explained them above. But I will explain those that I didn't
Code: Select all
host Enma {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 10.0.0.2;
}
host Teresa {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 10.0.0.1;
option subnet-mask 255.255.255.0;
option broadcast-address 10.0.0.255;
option routers 10.0.0.1;
option domain-name-servers 192.168.0.1;
}
Well, the rest, I leave to you now. Have fun, I had ^^