Showing posts with label dhcp. Show all posts
Showing posts with label dhcp. Show all posts

Thursday, September 29, 2011

DHCP server configuration on Linux.

This page is about configuring a dhcp3-server on a Debian system. You can install the service library with following command;

sudo atp-get install dhcp3-server

When you install dhcp3-server service, you will see dhcp3 directory in folder /etc. That directory contains dhcp3-server configuration file dhcpd.conf. My dhcp3-server service configuration file seems like this;

ddns-update-style none;
option domain-name "sample-dom.sample-com";
option domain-name-servers,;

default-lease-time 600;
max-lease-time 7200;

subnet netmask {
option subnet-mask;
option broadcast-address;
option routers;

host printer {
hardware ethernet 00:26:73:04:08:3f;

host printer1 {
hardware ethernet 00:00:f0:a6:ef:5b;

host AccessPoint_Symbol {
hardware ethernet 00:A0:F8:A7:77:88;

log-facility local7;

First 3 lines are abo ut dn s settings. You can set the domain in domain-name line and you can set dns servers on domai-name-servers line. You can also set multiple dns servers in a single line. If a client gets an ip address and never opens it for 7200 seconds, all information will be deleted for that client. So this date is called expiration date. subnet netmask part defines a scope between "{" and "}" characters. Scope properties are located between parentheses. For example, I want service to distribute ips only from the range of and I don't want the service to distribute ips from the range of and I also want to use this range to special purposes. And then, there are other options needed. subnet-mask, broadcast address and router address. Router address is usually called default gateway.

Host part is used for reservation. printer, printer1 and AccessPoint_Sympol parts are name of the reservations. You have to define a MAC address in a hardware ethernet line and you have to define some reserved ip addresses in fixed-address line. if you use "authoritative" line (you can delete it), all of the clients will record themself to dns server. The last line is just for defining the logging level.

Finally, you will need to start the service. You can use /etc/init.d/dhcp3-server shell script with start, stop, restart, force-reload or status options. If you execute that script without any parameter, it cats the possible options defined below:

Usage: /etc/init.d/dhcp3-server {start|stop|restart|force-reload|status}