注意路径问题
1. 安装DNS所要的软件包.
查看是否安装bind软件,在终端中输入
[root@localhost root]# rpm -qa|grep bind
redhat-config-bind-1.9.0-13
bind-9.2.1-16
bind-utils-9.2.1-16
ypbind-1.11-4
若出现以上的文字则表示安装成功,若没有出现以上东西插入正确的光盘,进行安装.或者通过下载源代码进行安装。
2. 设定好IP地址与DNS
在终端中输入netconfig,回车,在第一行中输入IP,172.18.121.35.第二行输入子网掩码255.255.255.0第三行输入网关地址:172.18.121.1,最后一行输入DNS 172.18.121.35.再确定.再在终端中输入下面的命令
[root@localhost root]#service network reload
[root@localhost root]#service network restart
通过ifconfig查看IP信息
3. 配置DNS
配置DNS正向搜索,配置文件如下:
[root@localhost root]#cp /var/named/localhost.zone /var/named/zljlinux.com
先复制本机DNS的一个配置文件,进行修改,修改的部分是粗线表示
[root@localhost root]# vi /var/named/zljlinux.com
$TTL 86400
$ORIGIN zljlinux.com.
@ 1D IN SOA zljlinux.com. root.zljlinux.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS @
1D IN MX 5 mail.zljlinux.com.
www 1D IN A 172.18.121.35
mail 1D IN A 172.18.121.35
ftp 1D IN A 172.18.121.35
pop3 IN CNAME mail.zljlinux.com.
smtp IN CNAME mail.zljlinux.com.
保存退出,先按ESC ,再:wq.
配置DNS正向搜索,配置文件如下:
[root@localhost root]#cp /var/named/named.local /var/named/172.18.121.rev
先复制本机DNS的一个配置文件,进行修改,修改的部分是粗线表示
[root@localhost root]# vi /var/named/172.18.121.rev
$TTL 86400
@ IN SOA zljlinux.com. root.zljlinux.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS zljlinux.com.
35 IN PTR
35 IN PTR mail.zljlinux.com.
35 IN PTR ftp.zljlinux.com.
配置本机DNS的一个主文件,安装好后它有一个,修改它,修改的部分是粗线表示
[root@localhost root]# vi /etc/named.conf
// generated by named-bootconf.pl
options {
directory "/var/named";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};
//
// a caching only nameserver config
//
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "zljlinux.com"IN{
type master;
file "zljlinux.com";
};
zone "121.18.172.in-addr.arpa"IN{
type master;
file "172.18.121.rev";
};
include "/etc/rndc.key";
"/etc/named.conf" [已转换] 45L, 894C
配置本机的域名转换程序的顺序
[root@localhost root]# vi /etc/host.conf
order bind,hosts
multi off
trim zljlinux.com
[root@localhost root]# vi /etc/resolv.conf
nameserver 172.18.121.35
nameserver 218.196.42.2
namedsever 218.196.42.2
domain zljlinux.com
search zljlinux.com
option nochecknames rotate
4. 启动named服务.
[root@localhost root]#service named start
5. 检查配置是否成功
[root@localhost root]# nslookup
Note: nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead. Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
>
Server: 172.18.121.35
Address: 172.18.121.35#53
Name:
Address: 172.18.121.35
> 172.18.121.35
Server: 172.18.121.35
Address: 172.18.121.35#53
35.121.18.172.in-addr.arpa name = ftp.zljlinux.com.
35.121.18.172.in-addr.arpa name =
35.121.18.172.in-addr.arpa name = mail.zljlinux.com.
>
ctrl +D退出
若出现上面的情况的文字表示已经配置成功.
6. 其实在配置的过程中,查看自己是否配置正确可以通过named –g 进行查看你的配置文件到底错在那个地方,再进行修改.
阅读(1068) | 评论(0) | 转发(0) |