dns服务器

listen 53  {any}   --->any 任和人都可以访问
       localhost

$TTL 1D   生存时间
@  ---> 域名     IN SOA   ----> 把 @ 授权给 IN SOA

        NS --> nameserver


dns(@)  IN A localhost
dns,(,-->直到遇见" , " 结束)


@/*    IN A ip

--------------------------------------------------------

           DNS服务器(域名解析)

安装包:
   bind-9.8.2-0.17.rc1.el6.x86_64.rpm
   bind-utils-9.8.2-0.17.rc1.el6.x86_64.rpm

rhel5
   bind-chroot-9.8.2-0.17.rc1.el6.x86_64.rpm
   caching-nameserver-version.i386.rpm


配置:/etc/named.conf
     /etc/named.rfc1912.zones
端口:53
启动服务
     service named restart

配置流程
1.vim /etc/named.conf
   listen-on port 53 { any; };
   allow-query     { any; };

2.vim /etc/named.rfc1912.zones
   zone "uplooking.com" IN {
           type master;
               file "uplooking.com.zone";
   };

3.cd /var/named/
   touch uplooking.com.zone
   chown :named uplooking.com.zone
   chmod 640 uplooking.com.zone

$TTL 1D
@       IN SOA dns.uplooking.com.       root ( 20140124 1D 1H 1W 3H )
       IN NS dns.uplooking.com.
dns     IN A  192.168.1.254
www     IN A  192.168.1.254

       IN MX 5 mail.uplooking.com.
mail    IN A  192.168.1.250

@       IN A  192.168.1.254  不用写域名就可以访问
*    IN A  192.168.1.254

www     IN A  192.168.1.254 轮寻地址 减少负载(小集群)
www     IN A  192.168.1.253
www     IN A  192.168.1.252

wwww    IN A  192.168.1.254   防止用户在输入错误的时候
ww    IN A  192.168.1.254





4.启动服务
service named restart


测试
设定DNS
setup

vim /etc/resolv.conf
nameserver 192.168.1.254

host www.uplooking.com

firefox www.uplooking.com





反向解析
1.vim /etc/named.conf
listen-on port 53 { any; };
allow-query     { any; };

2.vim /etc/named.rfc1912.zones
zone "1.168.192.in-addr.arpa" IN {
       type master;
       file "192.168.1.0.arpa";
}

3.
touch /var/named/192.168.1.0.arpa
chmod 640 /var/named/192.168.1.0.arpa
chown :named /var/named/192.168.1.0.arpa

$TTL 1D
@       IN SOA  dns.robin.com.  root ( 20140124 1D 1H 1W 3H)
       IN NS   dns.robin.com.
254     IN PTR  dns.robin.com.
254     IN PTR  www.robin.com.
250     IN PTR  mail.robin.com.

4.service  named restart


测试
host 192.168.1.254
host 192.168.1.250



格式转换
unix2dos 文件

字符编码转换
iconv -f gb18030 -t utf-8 /root/桌面/tt.txt  -o new.file





















安装包:
   bind-9.8.2-0.17.rc1.el6.x86_64.rpm
   bind-utils-9.8.2-0.17.rc1.el6.x86_64.rpm

rhel5
   bind-chroot-9.8.2-0.17.rc1.el6.x86_64.rpm
   caching-nameserver-version.i386.rpm


配置:/etc/named.conf
     /etc/named.rfc1912.zones
端口:53
启动服务
     service named restart

配置流程
1.vim /etc/named.conf
   listen-on port 53 { any; };
   allow-query     { any; };

2.vim /etc/named.rfc1912.zones
zone "uplooking.com" IN {
       type master;
       file "uplooking.com.zone";
};

3.cd /var/named/
   touch uplooking.com.zone
   chown :named uplooking.com.zone
   chmod 640 uplooking.com.zone

$TTL 1D
@       IN SOA dns.uplooking.com.       root ( 20140124 1D 1H 1W 3H )
       IN NS dns.uplooking.com.
dns     IN A  192.168.1.254
www     IN A  192.168.1.254

4.启动服务
   service named restart


测试
设定DNS
   setup

vim /etc/resolv.conf
   nameserver 192.168.1.254

host www.uplooking.com

firefox www.uplooking.com


主备服务器
   duo ge ip   ip;ip;


你可能感兴趣的:(dns,DNS服务器)