Related Items  

Linux and Windows Support  

make-it-great-again

Login or Register  

If you wish to contribute an article, please login or register.

Installing DHCP Server on Linux

PrintE-mail

Q. I would like to install a DHCP server.

1. Should I pick Windows or Linux

2. What are the install steps?

A. To answer 1st question - its up to you. There's no clear advantage to using one or the other. If you are running a router on Linux - then you should probably install Linux-based. If you have an Exchange or file-server running on Windows or you're just more comfortable with a gui based interface - then Windows is the way to go. This article will cover Linux install of the DHCP server (Windows will be covered some other time).

The installation process itself is quite simple (assuming you have one of the known distributions. For the sake of the example we'll use Ubuntu): at a terminal prompt, enter the following command to install DHCP server:

sudo apt-get install dhcp3-server

Once installed, to configure it you would have to make changes to /etc/dhcp3/dhcpd.conf

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.150 192.168.1.240;
option domain-name-servers 192.168.1.100;
option domain-name "canadem";
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
option netbios-name-servers 192.168.1.100;
default-lease-time 600;
max-lease-time 7200;
}

This will give a client an IP address range from 192.168.1.150 to 192.168.1.240. IPs will be leased for 600 seconds if the client doesn't ask for a specific time frame. The maximum allowed lease of 7200 seconds. The server will also "advise" the client that it should use 255.255.255.0 as its subnet mask, 192.168.1.255 as its broadcast address. 192.168.1.1 is the router. 192.168.1.100 is the DNS server. WINS server for your Windows clients is 192.168.1.100 (windows server in this case).

The last thing to do (assuming you've installed this on a router, with 2 network cards) is to bind your config to a network card (modify /etc/default/dhcp3-server)

# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/dhcp3-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1"

Otherwise you'll get an error like this in your logs:

Not configured to listen on any interfaces!

Start/Restart the DHCP server:

sudo /etc/init.d/dhcp3-server start

You can also specify a fixed IP, based on the MAC address. (This is very handy if you want to use remote access in your network, or just simply manage access). This can be done in the config file, /etc/dhcp3/dhcpd.conf:

host fantasia { 
hardware ethernet 08:00:02:24:c1:a3;
fixed-address 192.168.1.120;
}

Note: make sure you are using an IP outside of the DHCP range (in our case, .120 is outside of .150-.240)

Add your comment

Your name:
Subject:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:
yvComment v.1.24.0
   
Copyright © 1999 - 2017 Virtual Helpme | Trusted IT Services | Original Template: Allrounder
-->