How to Setup DNS ( Bind ) Server on CentOS, RHEL 6
来源:互联网 发布:mac os x 10.10.5 iso 编辑:程序博客网 时间:2024/05/12 07:57
How to Setup DNS ( Bind ) Server on CentOS, RHEL 6
April 2, 2013Linux Tutorials 9 CommentsThe DNS ( Domain Name System ) is a distributed system, used for transalate domain names to IP and vice a versa.
For example when we type domain name in browser url like “http://www.tecadmin.net”, Our computer sends a request to DNS and get an ip address of domain. Below steps are to configure dns server on centos 6 or RHEL 6 systems.
Network Setup used in Tutorial:
1. DNS Server IP: 192.168.1.90
2. DNS Server Name: ns1.tecadmin.net, ns2.tecadmin.net
3. Domain Name: demotecadmin.net
4. Domain IP to point: 192.168.1.91
Step 1: Install Bind Packages
Bind packages are available under default yum repositories. To install packages simple execute below command.
# yum install bind bind-chroot
Step 2: Edit Configuration Files
There are two types of configuration files in DNS servers.
1. DNS main configuration file: /var/named/chroot/etc/named.conf
2. Zone configuration files: This is nnother type of configuration file are called zone file. Which is individually created for all domains. named.conf keeps an entry for all zone files.
2.1. Configure named.conf
Firstly edit bind main configuration file and update content as below.
# vim /var/named/chroot/etc/named.conf
Content of named.conf:
// /var/named/chroot/etc/named.confoptions { listen-on port 53 { 127.0.0.1; 192.168.1.0/24; 0.0.0.0/0; }; listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; allow-query { localhost; 192.168.1.0/24; 0.0.0.0/0; }; recursion yes; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; /* Path to ISC DLV key */ bindkeys-file "/etc/named.iscdlv.key"; managed-keys-directory "/var/named/dynamic";};logging { channel default_debug { file "data/named.run"; severity dynamic; };};zone "." IN { type hint; file "named.ca";};zone "demotecadmin.net" IN { type master; file "/var/named/demotecadmin.net.db";};include "/etc/named.rfc1912.zones";include "/etc/named.root.key";
2.2. Create Zone File
After creating bind main configuration file, create a zone file for you domain as per configuration, for exampledemotecadmin.net.db in this article.
# vim /var/named/chroot/var/named/demotecadmin.net.db
Content of zone file:
; Zone file for demotecadmin.net$TTL 14400@ 86400 IN SOA ns1.tecadmin.net. webmaster.tecadmin.net. ( 3013040200 ; serial, todays date+todays 86400 ; refresh, seconds 7200 ; retry, seconds 3600000 ; expire, seconds 86400 ; minimum, seconds )demotecadmin.net. 86400 IN NS ns1.tecadmin.net.demotecadmin.net. 86400 IN NS ns2.tecadmin.net.demotecadmin.net. IN A 192.168.1.91demotecadmin.net. IN MX 0 demotecadmin.net.mail IN CNAME demotecadmin.net.www IN CNAME demotecadmin.net.
If you are having more domain, its required to create zone files for each domain individually.
2.3. Add More Domains..
To add more domains in dns, create zone files individually for all domain as above. After that add any entry for all zones in named.conf like below. Changedemotecadmin.net with your domain name.
zone "demotecadmin.net" IN { type master; file "/var/named/demotecadmin.net.db";};
Step 3: Start Bind Service
Start named (bind) service using below command.
# /etc/init.d/named restart
Enable auto start on system boot.
# chkconfig named on
Step 4: Finally Test Your DNS Setup
Send query to your dns server directly using below command.
Syntax: nslookup <domainname> <dns server name/ip>
# nslookup demotecadmin.net 192.168.1.90
Sample Output:
Server: 192.168.1.90Address: 192.168.1.90#53Name: demotecadmin.netAddress: 192.168.1.91
Above output is showing that dns server has successfully resolved domain demotecadmin.net.
- How to Setup DNS ( Bind ) Server on CentOS, RHEL 6
- How to Setup a TFTP Server Under CentOS/RHEL 6
- How to Install Tomcat 7.0.68 Server on CentOS/RHEL 7/6/5
- How to setup multimedia on CentOS
- How to setup Wiki on CentOS
- How to Setup network on centos 7
- How To Configure BIND as a Private Network DNS Server on Ubuntu 14.04
- How to install MySQL Server 5.6 on CentOS 7 / RHEL 7
- How to setup VPN server (PPTP on CentOS, RedHat and Ubuntu)
- How to Install Apache OpenOffice on RHEL/CentOS
- How to fix yum errors on CentOS, RHEL or Fedora
- How to disable PackageKit on CentOS, Fedora or RHEL
- How to Install PHP 7 on CentOS/RHEL 7.1 & 6.7
- How to Setup OpenERP (Odoo) on CentOS 7.x
- How to Install Ruby 2.1.1 on CentOS & RHEL 6 using RVM
- How to Install Subversion (SVN) 1.8.15 on CentOS/RHEL 7/6/5
- How to Install PostgreSQL 9.5 on CentOS/RHEL 7/6/5 and Fedora 23/22
- [pm] How to setup svn server on windows
- 信息洪流(1004. Message Flood)
- C/C++ sort函数的用法
- 【POJ1062】昂贵的聘礼 最短路 题目描述还有数据都坑爹
- http://movie.douban.com/doulist/14155490/
- MSDN XPath
- How to Setup DNS ( Bind ) Server on CentOS, RHEL 6
- 直方图计算代码
- CentOS 桌面版安装配置(以CentOS 7为例)
- Cocos2d-X中的动作展示《二》
- 快速排序
- Revenge of Segment Tree (hdu 5086)
- 一道关于fork()的面试题
- Extended Asm - Assembler Instructions with C Expression Operands
- 对contiki原理的一些理解