RHEL5——DNS服务器的搭建
DNS服务器的搭建
DNS(Domain Name System,域名系统),因特网上作为域名和IP地址相互映射的一个分布式数据库,能够使用户更方便的访问互联网,而不用去记住能够被机器直接读取的IP数串。通过主机名,最终得到该主机名对应的IP地址的过程叫做域名解析(或主机名解析)。DNS协议运行在UDP协议之上,使用端口号53。
配置步骤:
1)配置服务器的IP地址
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 BOOTPROTO=none HWADDR=00:0C:29:38:85:C0 ONBOOT=yes IPADDR=192.168.1.254 NETMASK=255.255.255.0
2)安装DNS所需软件包
# yum -y installbind bind-chroot caching-nameserver
3)修改DNS服务器主配置文件
# cpnamed.caching-nameserver.conf named.conf –p #拷贝模板 # cat/var/named/chroot/etc/named.conf
// // named.caching-nameserver.conf // // Provided by Red Hat caching-nameserver package to configure the // ISC BIND named(8) DNS server as a caching only nameserver // (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configurationfiles. // // DO NOT EDIT THIS FILE - use system-config-bind or an editor // to create named.conf - edits to this file will be lost on // caching-nameserver package upgrade. // options { listen-on port 53 { any;}; #修改为监听所有IP // listen-on-v6 port 53 {::1; }; #如用不到IPV6注释此行即可 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 beused carefully because they disable port // randomization // query-source port 53; // query-source-v6 port53; 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.rfc1912.zones"; };
4)检测配置文件语法
# named-checkconf named.conf
5) 修改区域文件
添加以下两个区域: zone"ssxiaoguai.com" IN { #域名 type master; file "ssxiaoguai.zone"; #数据库文件名 }; zone"1.168.192.in-addr.arpa" IN { #DNS服务器IP地址192.168.1.254 type master; file "ssxiaoguai.zero"; #数据库文件名 };
6)检测区域文件语法
# named-checkconfnamed.rfc1912.zones
7) 编写数据库文件
# pwd /var/named/chroot/var/named # cp -p named.local ssxiaoguai.zone # cat ssxiaoguai.zone #正向解析文件
$TTL 86400 @ IN SOA ssxiaoguai.com.root.ssxiaoguai.com. ( 2014070501 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400) ; Minimum IN NS dns1.ssxiaoguai.com. dns1 IN A 192.168.1.254 www IN A 192.168.1.253 bbs IN A 192.168.1.252 ftp IN A 192.168.1.251
# catssxiaoguai.zero
$TTL 86400 @ IN SOA ssxiaoguai.com.root.ssxiaoguai.com. ( 2014070501 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400) ; Minimum IN NS dns1.ssxiaoguai.com. 254 IN PTR dns1.ssxiaoguai.com. 253 IN PTR www.ssxiaoguai.com. 252 IN PTR bbs.ssxiaoguai.com. 251 IN PTR ftp.ssxiaoguai.com.
8)检测数据库文件语法
#named-checkzone ssxiaoguai.com ssxiaoguai.zone zone ssxiaoguai.com/IN:loaded serial 2014070501 OK #named-checkzone ssxiaoguai.com ssxiaoguai.zero zone ssxiaoguai.com/IN:loaded serial 2014070502 OK
9)启动DNS服务
#service named start 启动 named: [确定]
10)设置为开机自启
#chkconfig named on
11)测试DNS正向解析
12)测试DNS反向解析
本文出自 “松松小乖” 博客,请务必保留此出处http://ssxiaoguai.blog.51cto.com/5376644/1436057
RHEL5——DNS服务器的搭建,布布扣,bubuko.com
原文地址:http://ssxiaoguai.blog.51cto.com/5376644/1436057