msgbartop
Adam Palmer MBCS CITP, Linux, PHP Programmer, MySQL Developer, Embedded Hardware, Security Consultant
Did my blog help you? Please link to me!
  dns test
 
RSS Feed
msgbarbottom

15 Sep 09 Linux DHCP Server

DHCP is an acronym for Dynamic Host Configuration Protocol. It allows a host to broadcast a request for it’s IP settings. Hopefully, a DHCP server like the one we’ll be configuring will respond. Running tcpdump shows a dhcp request looks like:

17:26:02.003956 00:00:00:00:00:00 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0×0800), length 342: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request, length 300

Configuration is easy, to start with, just run ‘apt-get install dhcpd’
Then just create your /etc/dhcpd.conf.

# These are the most basic settings required
# This assumes that you want your list of IP addresses handed out to be completely random.
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name “mydomain.org”;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
range 192.168.1.150 192.168.1.200;
}
#In the above example, we are handing out addresses on the 192.168.1.0/24 range, between 192.168.1.10-100 and 150-200.
#If you want to specify WINS server information to your Windows clients, you can now add:
option netbios-name-servers 192.168.1.1;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
# If this is set, it will NACK responses from other DHCPDs
authoritative;

# Here you can specify a certain MAC (Hardware) address being given a fixed IP address:
host mymachine {
hardware ethernet 00:11:22:33:44:55;
fixed-address 192.168.1.123;
}

The above are the basic options that you’ll use. Once configured, run:

/usr/sbin/dhcpd

You should notice DHCP running in the process (ps) list. Any problems, check syslog. Alternatively run dhcpd in the foreground in debug mode with /usr/sbin/dhcpd -d -f

Tags: , , , , , ,



Leave a Comment