尚观第13天学习 dns原理及配置
客户端:
[root@dba1 ~]# vim /etc/resolv.conf 指定dns服务器是谁
dns解析过程
客户端:访问ftp.uplooking.com
先查找本地文件hosts
没有再去查找指定的dns服务器(缓存dns服务器)202.106.0.20 202.106.46.151
找不到的话,就去找根dns服务器,再一层层往下查找
#vim /etc/host.conf
order hosts,bind
安装:
#yum install bind bind-utils bind-chroot caching-nameserver -y
baseurl=ftp://192.168.100.250/rhel5u8/Server/
配置:
正向解析:A记录
主配置文件:
#cd /var/named/chroot/etc/
#vim named.conf
options
{
directory "/var/named";
};
zone "uplooking.com"
{
type master;
file "uplooking.com.zone";
};
# chown named.named named.conf
区域配置文件:
# cd /var/named/chroot/var/named/
#vim uplooking.com.zone
$TTL 86400
@ SOA dns.uplooking.com. root.uplooking.com. (
201210201
3H
15M
1W
1D )
NS dns.uplooking.com.
dns.uplooking.com. IN A 192.168.100.250
www.uplooking.com. IN A 192.168.100.8
ftp.uplooking.com. IN A 192.168.100.9
mail.uplooking.com. IN A 192.168.100.254
# chown named.named uplooking.com.zone
反向解析:PTR记录
主配置文件添加:
zone "100.168.192.in-addr.arpa"
{
type master;
file "100.168.192.arpa";
};
区域配置文件:
$TTL 86400
@ SOA dns.uplooking.com. root.uplooking.com. (
201210201
3H
15M
1W
1D )
NS dns.uplooking.com.
8 IN PTR dns.uplooking.com.
9 IN PTR ftp.uplooking.com.
198 IN PTR mail.163.com.
泛域名解析:在正向解析区域配置文件里添加
*.uplooking.com. IN A 192.168.100.253
[root@dba1 named]# host -t a fjdk.uplooking.com
fjdk.uplooking.com has address 192.168.100.253
别名:
www IN A 192.168.100.8
ftp IN CNAME www.uplooking.com.
mail IN CNAME www.uplooking.com.
[root@dba1 named]# host -t a mail.uplooking.com
mail.uplooking.com is an alias for www.uplooking.com.
www.uplooking.com has address 192.168.100.8
负载均衡:
www IN A 192.168.100.9
www IN A 192.168.100.10
www IN A 192.168.100.11
MX记录:
uplooking.com. IN MX 10 mail.uplooking.com.
uplooking.com. IN MX 11 mail1.uplooking.com.
[root@dba1 named]# host -t mx uplooking.com
uplooking.com mail is handled by 11 mail1.uplooking.com.
uplooking.com mail is handled by 10 mail.uplooking.com.
本身没有dns区域配置文件,只缓存dns服务器
#vim named.conf
{
forward only;
forwarders
{
192.168.100.250;
192.168.100.61;
};
};
客户端测试:
[root@localhost ~]# cat /etc/resolv.conf
search localdomain
nameserver 192.168.224.128
本身有dns区域配置文件,加上forward之后就是转发服务器
转发器配置:
在options里面添加下面几行:
recursion yes; 打开递归转发功能
forward first;
forwarders
{
192.168.100.88;
192.168.100.99;
};