Learn about Linux DNS service setup for Beginners

Source: Internet
Author: User
Tags dnssec

To configure the DNS approximate steps:


1. Configure the IP address, and DNS points to itself.


2. Turn off the firewall and turn off SELinux.


3. Mount and install the bind package


4. Copy the configuration file


5. Configuring named.conf Primary Files


6. Configure forward and backward files


7. Configure the Forward file


8. Configuring Reverse Files


9. Restart the service


10. Testing Services




Body






1. Configure the IP address, and DNS points to itself.


[Email protected] ~]# Vim/etc/sysconfig/network-scripts/ifcfg-eth0

Configuration file:


Device=eth0


hwaddr=00:0c:29:95:7d:8e


Type=ethernet


uuid=de320e6a-e587-4419-bd9e-17d7c7833f9f


Onboot=yes


Nm_controlled=yes


Bootproto=static


ipaddr=192.168.10.10


netmask=255.255.255.0


Ipv6init=no


Userctl=no


dns1=192.168.10.10



: Wq


Save and exit


2. Turn off the firewall and turn off SELinux.

[[Email protected] ~]# service iptables stop


Iptables: Set the chain to policy accept:filter [OK]


Iptables: Clear Firewall rule: [OK]


Iptables: Uninstalling module: [OK]


[Email protected] ~]# Setenforce 0


[Email protected] ~]#



3. Mount and install the bind package


[Email protected] ~]# mkdir/test


[Email protected] ~]# mount/dev/sr0/test


Mount:block Device/dev/sr0 is write-protected, mounting read-only


[Email protected] ~]# cd/test/packages/


[Email protected] packages]# RPM-IVH bind-9.8.2-0.17.rc1.el6_4.6.i686.rpm bind-chroot-9.8.2-0.17.rc1.el6_4.6. i686.rpm cachefilesd-0.10.2-1.el6.i686.rpm


Warning:bind-9.8.2-0.17.rc1.el6_4.6.i686.rpm:header V3 rsa/sha1 Signature, key ID C105b9de:nokey


Preparing ... ########################################### [100%]


1:bind ########################################### [33%]


2:bind-chroot ########################################### [67%]


3:CACHEFILESD ########################################### [100%]


[Email protected] packages]#




Main three configuration files


bind-9.8.2-0.17.rc1.el6_4.6.i686.rpm


bind-chroot-9.8.2-0.17.rc1.el6_4.6.i686.rpm


cachefilesd-0.10.2-1.el6.i686.rpm



4. Copy the configuration file


[Email protected] packages]# cp-rp/usr/share/doc/bind-9.8.2/sample/*/var/named/chroot/










5. Configuring named.conf Primary Files



[Email protected] ~]# cd/var/named/chroot/etc/


[Email protected] etc]# vim named.conf


Set the line number with the "Set nu" command.


Then delete all the text after 110 lines.


Options


{


Directory "/var/named"; "Working" directory


Dump-file "Data/cache_dump.db";


Statistics-file "Data/named_stats.txt";


Memstatistics-file "Data/named_mem_stats.txt";


Listen-on Port: (any;};


LISTEN-ON-V6 Port: (any;};


allow-query {any;}; Change localhost to any


Allow-query-cache {any;};


recursion Yes;


Dnssec-enable Yes;


Dnssec-validation Yes;


Dnssec-lookaside Auto; Delete all comments


};



Logging//This profile is modified to delete the remaining important configuration


{


Channel Default_debug {


File "Data/named.run";


Severity dynamic;


};


};



View "Localhost_resolver"


{


match-clients {any;}; The Mark Red is mainly to be changed


recursion Yes;


Zone "." in {


Type hint;


File "/var/named/named.ca";


};












6. Configure forward and backward files


[Email protected] etc]# vim Named.rfc1912.zones



Zone "test.com" in {


Type master;


File "Named.localhost";


allow-update {none;};


}; Leave these two configurations, the other all deleted


Zone "10.168.192.in-addr.arpa" in {


Type master;


File "Named.loopback";


allow-update {none;};


};










7. Configure the Forward file


[Email protected] etc]# cd/var/named/chroot/var/named/


[Email protected] named]# vim Named.localhost



$TTL 1D


@ in SOA dns.test.com. Root. (


0; Serial


1D; Refresh


1H; Retry


1W; Expire


3H); Minimum


In NS dns.test.com. Don't forget the decimal point


DNS in A 192.168.10.10


www in A 192.168.10.10


FTP in A 192.168.10.10



Save exit











8. Configuring Reverse Files


[Email protected] named]# vim Named.loopback


$TTL 1D


@ in SOA dns.test.com. Root. (


0; Serial


1D; Refresh


1H; Retry


1W; Expire


3H); Minimum


In NS dns.test.com.


Ten in PTR dns.test.com.


Ten in PTR www.test.com.


Ten in PTR ftp.test.com.









9. Restart the service


[Email protected] named]# service network restart


Shutting down interface eth0: Device status: 3 (Disconnected)


Determine


Close Loopback interface: [OK]


Eject loopback interface: [OK]


Popup interface eth0: Active connection Status: activated


Active connection path:/ORG/FREEDESKTOP/NETWORKMANAGER/ACTIVECONNECTION/2


Determine


[Email protected] named]# service named restart


Stop named:[OK]


generating/etc/rndc.key:[OK]


Start named:[OK]


[Email protected] named]#










10. Testing



[email protected] named]# nslookup 192.168.10.10


server:192.168.10.10


address:192.168.10.10#53



10.10.168.192.in-addr.arpa name = dns.test.com.


10.10.168.192.in-addr.arpa name = www.test.com.


10.10.168.192.in-addr.arpa name = ftp.test.com.




The analysis proves that we are successful.





This article from the "11465309" blog, reproduced please contact the author!

Learn about Linux DNS service setup for Beginners

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.