Debian As DNS and DHCP Server

DNS and DHCP Server Setup – Debian

1358155333_configure-debianDebian Operating System (OS) is free and open source OS (download). It have been around for a while now almost two decade (initial release on 1993). It’s currently at its 6th version also know as  “Squeeze”. This OS is very stable as so many of its derivatives OS are flowering and gaining more popularity. One of the example would be “Ubuntu” (download).

1. To setup Debian as DNS server, first we need to update our application database

apt-get update & apt-get upgrade

 Now I will install aptitude application. This is a advance version of apt-get and has much more function.

apt-get install aptitude

After this, we need to install bind9. This will act as DNS server.

aptitude install bind9 bind9utils

Again, we need to edit name.conf.option to assign DNS.

nano /etc/bind/named.conf.options

options {
directory “/var/cache/bind”;

// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113

// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0’s placeholder.

forwarders {
// Google Public DNS
//8.8.8.8;
//8.8.4.4;

// OpenDNS
208.67.222.222;
208.67.220.220;

//New ip

};
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};

Make that option look like this. I am using OpenDns. It gives you more option to configure your network like blocking adware and other domain (Only downside is that you should have static ip or if you have dynamic ip then you have to install opendns ip updater software for more info go here)

OR you can use Google DNS, remove forward slash and put that infront of 208.67.222.222, 208.67.220.220.

Just to be sure which DNS is fast you can use. For Mac & Windows user : Namebench (download). This application can identify which DNS is faster for you and you can use that DNS ip in this configure file. Just add that ip below New ip.

NoticeNote: This is very basic DNS settings, you can also assign more advance DNS settings like assigning zones but I am not going to detail in here. For more info go to (link)

2. Setting up DHCP server, we need to install isc-dhcp-server

aptitude install isc-dhcp-server

Now we need to configure its setting

nano /etc/dhcp/dhcpd.conf
# option definitions common to all supported networks…
option domain-name “[your server domain name]“;
option domain-name-servers [your server ip];
default-lease-time 6000;
max-lease-time 7200;
allow unknown-clients;
# DHCP server to understand the network topology.
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200; #Range of client’s IP addresses: 100 to 200
option routers [Your router ip]; #usually its 192.168.0.1 or 192.168.1.1
filename “pxelinux.0”;
next-server [Your Server ip];
option subnet-mask 255.255.255.0;
}

After that give a domain name and server ip. Also you can see that I have given my ip range starting from 100 and ending 200.  You can change that according to your need.

Restart dhcp server

/etc/init.d/isc-dhcp-server restart

You server will start assigning ip once client request it. I think one more thing that you need to do is, you need to change your router settings and change it to forward ip to dhcp server but every router.

NoticeNote: Any thing between [..] should be replace including [ ].
End of DNS and DHCP Server Setup – Debian
Advertisements

2 thoughts on “Debian As DNS and DHCP Server

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s