Install and Configure DNS Server and DHCP Server on Debian 9 "Stretch"

in utopian-io •  7 years ago 

introduce :

DNS (Domain Name System) Server is a server application that serves to translate a domain address into ip address and or vice versa, this application is very useful to not need to remember the ip address number, just the domain name only. While DHCP (Dynamic Host Control Protocol) Server is a server application that serves to provide IP address to the client dynamically, so the client no longer need to set the IP Address manually. The assumption has been available Debian 9 Computer that has been configured IP Address, and also available Repository Ready to use. The following will be discussed one by one way of installation and configuration

capture-20171224-185923.png
an example, we will create a domain serverdebian.com with IP 192.168.10.1. To install DNS Server, use the following command:

apt install bind9

and this is the next step
nano /etc/named.conf.local
add the following line (please adjusted)

zone “serverdebian.com”{

            type master;

            file “/etc/bind/db.domain”;

};
capture-20171224-190704.png
Save and exit, then copy /etc/bind/db.local

cp /etc/bind/db.local /etc/bind/db.domain

Edit /etc/bind/db.domain
nano /etc/bind/db.domain
Change localhost word to domain name, then change also 127.0.0.1 into server IP address, then add NS Record (if needed), adjust it to be as follows:

capture-20171224-191425.png
Save and exit, then Edit File named.conf.options, but this is Optional only so that the domain resolving request can be forwarded to another DNS Server (Internet), the way is as follows :
nano /etc/bind/named.conf.options
Uncomment the forwarders line and the contents of the DNS Server with the desired DNS Server Address.

capture-20171224-191845.png
Save and exit, then restart service bind9 by:

systemctl restart bind9
Change DNS Server settings, point to IP Address 192.168.10.1
capture-20171224-192202.png
Save and exit (no need to restart networking), then check whether the configuration is successful or not by trying pinging to the domain address created

capture-20171224-192503.png
Settings in Client by adding DNS Server IP Address that is 192.168.10.1

capture-20171224-192651.png

Checks from Client (Windows), can use nslookup or pinging
capture-20171224-192904.png

capture-20171224-193136.png
To install and configure a DHCP Server, follow these steps:
apt install isc-dhcp-server
the next step, determine which Interface will be used for DHCP Server, assuming there are 2 Interface that is enp0s3 and enp0s8. enp0s3 is connected to the Internet, and enp0s8 is connected to the local network (client), so enp0s8 is used for DHCP Server. Here's the settings

nano /etc/default/isc-dhcp-server
on INTERFACESv4 = "", changed to INTERFACESv4 = "enp0s8"
capture-20171224-193710.png
Save and Exit, then for the main settings the way is as follows

nano /etc/dhcp/dhcpd.conf
Find the "# A slightly different ..." line below and adjust the configuration below

capture-20171224-194118.png
Save and Exit, then restart the DHCP Server service:

systemctl restart isc-dhcp-server

Check on the client, by changing the IP Address setting to Automatic. If the Client has obtained the IP Address, the configuration has been successful.

capture-20171224-194408.png
done.



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

I will create this IP address and thank you very much for giving an idea about this IP address. good job....

U are well come

this server pic i know :)

thank you for visiting

Your contribution cannot be approved yet because it is attached to the wrong repository. Please edit your contribution and fix the repository to https://github.com/Debian/apt to reapply for approval.

You may edit your post here, as shown below:

You can contact us on Discord.
[utopian-moderator]

Your contribution cannot be approved because it does not follow the Utopian Rules.

You can contact us on Discord.
[utopian-moderator]