How to set up a dhcp server on Ubuntu Server 12.10

Today I will show you how to set up and configure a dhcp server on Ubuntu Server 12.10.

If you have not already installed the required packages when installing Ubuntu then you will need to install isc-dhcp-server.  At your command prompt type:

sudo apt-get install isc-dhcp-server


As far as configuration goes there are two main files, these being /etc/default/isc-dhcp-server and /etc/dhcp/dhcpd.conf.  At your command prompt type:

sudo nano /etc/default/isc-dhcp-server

I am using nano but you can use whichever text editor takes your fancy.

Locate the line INTERFACES=”” and replace with INTERFACES=”eth0” where eth0 is the name of the network interface you want the server to lease addresses on.

Save the file and exit.

Now at your prompt type:

sudo nano /etc/dhcp/dhcpd.conf again using your favourite text editor instead of nano.

Add the following two sections of text into the file:

——————————————————————————————————————————–

option domain-name “comtech.com”;

default-lease-time 600;

max-lease-time 7200;

——————————————————————————————————————————–

and

——————————————————————————————————————————–

subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.150 10.0.0.253;
option routers 10.0.0.2;
option subnet-mask 255.255.255.0;

option broadcast-address 10.0.0.254;
option domain-name-servers 10.0.0.1, 10.0.0.2;

option ntp-servers 10.0.0.1;
option netbios-name-servers 10.0.0.1;
option netbios-node-type 8;
}

——————————————————————————————————————————–

I will need to explain some of the items you have entered.

The option domain-name parameter is your dns zone name.  For example I have set mine to “comtech.com”

Range should be the range of ip addresses that you want the server to give out to clients.

Now we need to restart the dhcp service so at your command prompt type:

sudo service isc-dhcp-server restart

If you get an error stating the job failed to start go back and check the configuration files as you will have entered something incorrectly.  Pay particular attention to the ”” comments when specifying your network interface.  If your service started ok then your server is configured correctly.

It is always best to double check so at your prompt type:

sudo netstat -uap

and locate dhcpd as this will show that the dhcpd deamon is working.

About the Author

Hi I am Chris Wakefield the owner of ComTech IT Support. I provide Windows and Linux based IT Support, laptop repairs and computer repairs to both business and personal clients in and around Stirling.

For a list of what I can offer you why not visit my website www.comtech247.net where you will find a list of my services, testimonials, blog and much more.

 

This entry was posted in Blog and tagged dhcp server, how to, ubuntu 12.10. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

50,701 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>