After I needed a DNS server DNS server, I decided the best idea would probably be to write this howto myself…. So, here it is:
Step 1. Install bind9:
apt-get install bind9
Step 2: Configure the main Bind files. Usually, if you install Bind from the source code, you will have to edit the file named.conf. However, Debian provides you with a pre-configured Bind, so we will edit another file:
vim /etc/bind/named.conf.local
This is where we will insert our zones. By the way, a zone is a domain name that is referenced in the DNS server Insert this in the named.conf.local file:
#Replace debian-tutorials.com with your own domain name. zone “debian-tutorials.com” { type master; file “/etc/bind/zones/debian-tutorials.com.db”; };
# Replace 2.4.168.192 with your network address in reverse notation – in this example my network address is 192.168.4.2 zone “2.4.168.192.in-addr.arpa” { type master; file “/etc/bind/zones/rev.2.4.168.192.in-addr.arpa”; };
Step 3. Now let’s edit the options file:
vim /etc/bind/named.conf.options
We need to modify the forwarder. This is the DNS server to which your own DNS will forward the requests he cannot process.
# Replace the address below with the address of your provider’s DNS server
forwarders { 192.168.4.3; };
Step 4. Now we will add the zone definition files:
mkdir -p /etc/bind/zones vim /etc/bind/zones/debian-tutorials.com.db
The zone definition file is where we will put all the addresses that our DNS server will know. You can take the following example:
debian-tutorials.com. IN SOA ns1.debian-tutorials.com. admin.debian-tutorials.com. ( #Do NOT modify the following lines! 2006081401 28800 3600 604800 38400 )
#Edit the following line as necessary: debian-tutorials.com. IN NS ns1.debian-tutorials.com. debian-tutorials.com. IN MX 10 mta.debian-tutorials.com.
#Replace the IP address with the right IP addresses. www IN A 192.168.5.2 mta IN A 192.168.5.3 ns1 IN A 192.168.5.1
Step 5. Now create the reverse DNS zone file:
vim /etc/bind/zones/rev.2.4.168.192.in-addr.arpa
Copy/paste the following text and modify as needed:
@ IN SOA ns1.debian-tutorials.com. admin.debian-tutorials.com. ( 2006081401; 28800; 604800; 604800; 86400 )
IN NS ns1.debian-tutorials.com. 1 IN PTR debian-tutorials.com
Step 6. Restart bind9:
/etc/init.d/bind9 restart
Enjoy this. And don’t forget to comment if something it’s wrong or you want to improve it.
Sumber : http://www.debian-tutorials.com |