文档课题:Linux服务器配置DNS解析.
操作IP:192.168.0.145 主机名:dns 系统:OEL 5.5 64位
1、安装bind包
[root@dns ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@dns ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 8.5G 2.2G 5.9G 27% /
/dev/sda1 996M 40M 905M 5% /boot
tmpfs 500M 0 500M 0% /dev/shm
/dev/hdc 3.4G 3.4G 0 100% /mnt
[root@dns ~]# cd /mnt/Server/
[root@dns Server]# ls -ltr | grep bind-
-rw-r--r-- 2 root root 5524446 Jan 22 2009 system-config-bind-4.0.3-4.0.1.el5.noarch.rpm
-rw-r--r-- 2 root root 38233 Jul 11 2009 ypbind-1.19-12.el5.x86_64.rpm
-rw-r--r-- 2 root root 2931119 Jan 21 2010 bind-devel-9.3.6-4.P1.el5_4.2.i386.rpm
-rw-r--r-- 2 root root 457406 Jan 21 2010 bind-libbind-devel-9.3.6-4.P1.el5_4.2.i386.rpm
-rw-r--r-- 2 root root 888593 Jan 21 2010 bind-libs-9.3.6-4.P1.el5_4.2.i386.rpm
-rw-r--r-- 2 root root 1015531 Jan 21 2010 bind-9.3.6-4.P1.el5_4.2.x86_64.rpm
-rw-r--r-- 2 root root 45360 Jan 21 2010 bind-chroot-9.3.6-4.P1.el5_4.2.x86_64.rpm
-rw-r--r-- 2 root root 2958514 Jan 21 2010 bind-devel-9.3.6-4.P1.el5_4.2.x86_64.rpm
-rw-r--r-- 2 root root 460510 Jan 21 2010 bind-libbind-devel-9.3.6-4.P1.el5_4.2.x86_64.rpm
-rw-r--r-- 2 root root 918974 Jan 21 2010 bind-libs-9.3.6-4.P1.el5_4.2.x86_64.rpm
-rw-r--r-- 2 root root 240067 Jan 21 2010 bind-sdb-9.3.6-4.P1.el5_4.2.x86_64.rpm
-rw-r--r-- 2 root root 179617 Jan 21 2010 bind-utils-9.3.6-4.P1.el5_4.2.x86_64.rpm
-rw-r--r-- 2 root root 10157 Apr 1 2010 samba3x-winbind-devel-3.3.8-0.51.el5.i386.rpm
-rw-r--r-- 2 root root 3286685 Apr 1 2010 samba3x-winbind-3.3.8-0.51.el5.i386.rpm
-rw-r--r-- 2 root root 10142 Apr 1 2010 samba3x-winbind-devel-3.3.8-0.51.el5.x86_64.rpm
-rw-r--r-- 2 root root 3420569 Apr 1 2010 samba3x-winbind-3.3.8-0.51.el5.x86_64.rpm
[root@dns Server]# ll | grep caching-nameserver-9.3.6-4.P1.el5_4.2.x86_64.rpm
-rw-r--r-- 2 root root 62251 Jan 21 2010 caching-nameserver-9.3.6-4.P1.el5_4.2.x86_64.rpm
安装bind三个包
[root@dns Server]# rpm -ivh bind-9.3.6-4.P1.el5_4.2.x86_64.rpm
[root@dns Server]# rpm -ivh bind-chroot-9.3.6-4.P1.el5_4.2.x86_64.rpm
[root@dns Server]# rpm -ivh caching-nameserver-9.3.6-4.P1.el5_4.2.x86_64.rpm
2、配置主区域
[root@dns ~]# cd /var/named/chroot/etc
[root@dns etc]# cp -p named.caching-nameserver.conf named.conf
[root@dns etc]# cp -p named.rfc1912.zones named.zones
[root@dns etc]# vim named.conf
......
options {
listen-on port 53 { any; };
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";
// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;
allow-query { any; };
allow-query-cache { any; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.zones";
};
说明:红色高亮为修改部分.
[root@dns etc]# vi named.zones
......
zone "leo.com" IN {
type master;
file "leo.com.zone";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "0.168.192.local";
allow-update { none; };
};
说明:红色高亮为修改部分.
3、处理正反解析文件
[root@dns etc]# cd /var/named/chroot/var/named
[root@dns named]# cp -p named.zero leo.com.zone
[root@dns named]# cp -p named.local 0.168.192.local
3.1、修改正向解析文件
[root@dns named]# vi leo.com.zone
$TTL 86400
@ IN SOA dns.leo.com. root.leo.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS dns.leo.com.
scan IN A 192.168.0.195
scan IN A 192.168.0.196
scan IN A 192.168.0.197
说明:红色高亮为修改部分.
3.2、修改反向解析文件
[root@dns named]# vi 0.168.192.local
$TTL 86400
@ IN SOA dns.leo.com. root.leo.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns.leo.com.
195 IN PTR scan.leo.com.
196 IN PTR scan.leo.com.
197 IN PTR scan.leo.com.
说明:红色高亮为修改部分.
3.3、修改DNS文件
[root@dns ~]# vi /etc/resolv.conf
nameserver 192.168.0.145
search leo.com
3.4、重启named进程
[root@dns named]# service named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@dns named]# chkconfig named on
4、验证DNS解析情况
[root@dns named]# netstat -tnlp | grep 53
tcp 0 0 192.168.0.145:53 0.0.0.0:* LISTEN 15694/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 15694/named
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 15694/named
tcp 0 0 ::1:53 :::* LISTEN 15694/named
tcp 0 0 ::1:953 :::* LISTEN 15694/named
[root@dns named]# nslookup scan.leo.com
Server: 192.168.0.145
Address: 192.168.0.145#53
Name: scan.leo.com
Address: 192.168.0.197
Name: scan.leo.com
Address: 192.168.0.195
Name: scan.leo.com
Address: 192.168.0.196
[root@dns named]# nslookup 192.168.0.197
Server: 192.168.0.145
Address: 192.168.0.145#53
197.0.168.192.in-addr.arpa name = scan.leo.com.
说明:以上实现DNS正反向解析.
Linux服务器配置DNS解析
原创Liujun_Deng 博主文章分类:Linux系统 ©著作权
©著作权归作者所有:来自51CTO博客作者Liujun_Deng的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:Linux服务器互信配置
下一篇:ORACLE数据库高水位线
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章