概述
DNS服务器基础架设步骤
--------------------------------------------------
1) 保证网络畅通性
[root@localhost ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:98:04:05
inet addr:192.168.2.251 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe98:405/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:228 (228.0 b) TX bytes:7368 (7.1 KiB)
Interrupt:59 Base address:0x2024
[root@localhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 eth0
2) 安装DNS服务器所需RPM包
[root@localhost ~]# umount /dev/cdrom
umount: /dev/cdrom: not mounted
[root@localhost ~]# mount /dev/cdrom /media/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~]# cd /media/Server/
[root@localhost Server]# rpm -ivh bind-*.rpm caching-nameserver-9.3.6-4.P1.el5_4.2.i386.rpm --nodeps --force
3) 根据需求配置DNS服务器主配置文件/var/named/chroot/etc/named.conf
[root@localhost etc]# vi /var/named/chroot/etc/named.conf
options {
directory "/var/named";
};
zone "benet.com" IN {
type master;
file "benet.com.zone";
};
zone "2.168.192.in-addr.arpa" IN {
type master;
file "192.168.2.arpa";
};
4) 创建正反向数据文件
[root@localhost etc]# cd /var/named/chroot/var/named/
[root@localhost named]# touch benet.com.zone 192.168.2.arpa
[root@localhost named]# vi benet.com.zone //创建正向数据文件
$TTL 1D
@ IN SOA benet.com. admin.benet.com. (
2013011501
3H
15M
1W
1D
)
@ IN NS ns1.benet.com.
IN MX 10 mail.benet.com.
ns1 IN A 192.168.2.251
mail IN A 192.168.2.166
www IN A 192.168.2.177
ftp IN CNAME www
-----------------------------------------------------------------
[root@localhost named]# cp benet.com.zone 192.168.2.arpa
cp:是否覆盖“192.168.2.arpa”? y
[root@localhost named]# vi 192.168.2.arpa //创建反向数据文件
$TTL 1D
@ IN SOA benet.com. admin.benet.com. (
2013011501
3H
15M
1W
1D
)
@ IN NS ns1.benet.com.
IN MX 10 mail.benet.com.
251 IN PTR ns1.benet.com.
166 IN PTR mail.benet.com.
177 IN PTR www.benet.com.
177 IN PTR ftp.benet.com.
---------------------------------------------------------
5) 重启DNS服务,使配置生效
[root@localhost named]# service named restart
停止 named: [确定]
启动 named: [确定]
6) 测试 nslookup
[root@localhost named]# vi /etc/resolv.conf
nameserver 192.168.2.251
[root@localhost named]# nslookup
> www.benet.com
Server: 192.168.2.251
Address: 192.168.2.251#53
Name: www.benet.com
Address: 192.168.2.177
> mail.benet.com
Server: 192.168.2.251
Address: 192.168.2.251#53
Name: mail.benet.com
Address: 192.168.2.166
> 192.168.2.251
Server: 192.168.2.251
Address: 192.168.2.251#53
251.2.168.192.in-addr.arpa name = ns1.benet.com.
> 192.168.2.166
Server: 192.168.2.251
Address: 192.168.2.251#53
166.2.168.192.in-addr.arpa name = mail.benet.com.
>
-----------------------------------------------------------
转载于:https://blog.51cto.com/jishuweiwang/1387067
最后
以上就是明亮花瓣为你收集整理的简单DNS服务器架设的全部内容,希望文章能够帮你解决简单DNS服务器架设所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复