当前位置: 技术问答>linux和unix
redhat7如何配dns,第一个回答全给
来源: 互联网 发布时间:2014-12-21
本文导语: rt | 1、/etc/hosts 10.79.0.110 mail.mail.com.cn mail 127.0.0.1 localhost.localdomain localhost 2、/etc/host.conf order hosts,bind multi on 3、/etc/hosts.allow out ALL : 127.0.0.1 4、/etc/hosts.deny #ALL: ALL ...
rt
|
1、/etc/hosts
10.79.0.110 mail.mail.com.cn mail
127.0.0.1 localhost.localdomain localhost
2、/etc/host.conf
order hosts,bind
multi on
3、/etc/hosts.allow
out
ALL : 127.0.0.1
4、/etc/hosts.deny
#ALL: ALL
5、/etc/named.boot
;
; a caching only nameserver config
;
directory /var/named
cache . named.ca
primary mail.com.cn named.mail
primary 0.0.127.in-addr.arpa named.local
primary 0.79.10.in-addr.arpa named.110
forwarders { 10.79.1.1 };上一级dns
6、/etc/named.conf
// generated by named-bootconf.pl
options {
directory "/var/named";
// query-source address * port 53;
pid-file "named.pid";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "mail.com.cn" IN {
type master;
file "named.mail";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
};
zone "0.79.10.in-addr.arpa" IN {
notify no;
type master;
file "named.110";
};
forwarders { 10.79.1.1 };上一级dns
8、/var/named/named.ca (该文件名对应于/etc/named.conf里的文件名)
9、/var/named/named.110 (该文件名对应于/etc/named.conf里的文件名)
$TTL 86400
@ IN SOA @ root.mail.com.cn. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN NS mail.mail.com.cn.
110 PTR mail.mail.com.cn.
110 PTR http://www.mail.com.cn./
10、/var/named/named.local (该文件名对应于/etc/named.conf里的文件名)
$TTL 86400
@ IN SOA @ root.localhost (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN NS localhost.
;@ IN A 127.0.0.1
1 IN PTR localhost.
11、/var/named/named.mail (该文件名对应于/etc/named.conf里的文件名)
$TTL 86400
@ IN SOA mail.mail.com.cn. root.mail.com.cn. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN NS mail.mail.com.cn.
@ IN NS http://www.mail.com.cn./
@ IN MX 1 mail.mail.com.cn.
@ IN MX 2 http://www.mail.com.cn./
localhost IN A 127.0.0.1
mail IN A 10.79.0.110
;ftp A 10.79.0.110
www IN A 10.79.0.110
@ IN A 10.79.0.110
;
;www CNAME http://www.mail.com.cn./
;mail CNAME mail.mail.com.cn.
;ftp CNAME ftp.mail.com.cn.
;dns CNAME dns.mail.com.cn.
; 1 IN PTR localhost.
二、dns的启动和测试
有三种方式来启动:
1、/etc/named start
2、/etc/ndc start
3、/usr/sbin/turboservice
测试用nslookup看能否启动:
[root@mail /etc]# nslookup
Default Server: mail.mail.com.cn
Address: 10.79.0.110
> 10.79.0.110
Server: mail.mail.com.cn
Address: 10.79.0.110
Name: mail.mail. com.cn
Address: 10.79.0.110
> mail.mail.com.cn
Server: mail.mail.com.cn
Address: 10.79.0.110
Name: mail.mail.com.cn
Address: 10.79.0.110
至此,dns正向和反向解析均已正常,配置成功!
10.79.0.110 mail.mail.com.cn mail
127.0.0.1 localhost.localdomain localhost
2、/etc/host.conf
order hosts,bind
multi on
3、/etc/hosts.allow
out
ALL : 127.0.0.1
4、/etc/hosts.deny
#ALL: ALL
5、/etc/named.boot
;
; a caching only nameserver config
;
directory /var/named
cache . named.ca
primary mail.com.cn named.mail
primary 0.0.127.in-addr.arpa named.local
primary 0.79.10.in-addr.arpa named.110
forwarders { 10.79.1.1 };上一级dns
6、/etc/named.conf
// generated by named-bootconf.pl
options {
directory "/var/named";
// query-source address * port 53;
pid-file "named.pid";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "mail.com.cn" IN {
type master;
file "named.mail";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
};
zone "0.79.10.in-addr.arpa" IN {
notify no;
type master;
file "named.110";
};
forwarders { 10.79.1.1 };上一级dns
8、/var/named/named.ca (该文件名对应于/etc/named.conf里的文件名)
9、/var/named/named.110 (该文件名对应于/etc/named.conf里的文件名)
$TTL 86400
@ IN SOA @ root.mail.com.cn. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN NS mail.mail.com.cn.
110 PTR mail.mail.com.cn.
110 PTR http://www.mail.com.cn./
10、/var/named/named.local (该文件名对应于/etc/named.conf里的文件名)
$TTL 86400
@ IN SOA @ root.localhost (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN NS localhost.
;@ IN A 127.0.0.1
1 IN PTR localhost.
11、/var/named/named.mail (该文件名对应于/etc/named.conf里的文件名)
$TTL 86400
@ IN SOA mail.mail.com.cn. root.mail.com.cn. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN NS mail.mail.com.cn.
@ IN NS http://www.mail.com.cn./
@ IN MX 1 mail.mail.com.cn.
@ IN MX 2 http://www.mail.com.cn./
localhost IN A 127.0.0.1
mail IN A 10.79.0.110
;ftp A 10.79.0.110
www IN A 10.79.0.110
@ IN A 10.79.0.110
;
;www CNAME http://www.mail.com.cn./
;mail CNAME mail.mail.com.cn.
;ftp CNAME ftp.mail.com.cn.
;dns CNAME dns.mail.com.cn.
; 1 IN PTR localhost.
二、dns的启动和测试
有三种方式来启动:
1、/etc/named start
2、/etc/ndc start
3、/usr/sbin/turboservice
测试用nslookup看能否启动:
[root@mail /etc]# nslookup
Default Server: mail.mail.com.cn
Address: 10.79.0.110
> 10.79.0.110
Server: mail.mail.com.cn
Address: 10.79.0.110
Name: mail.mail. com.cn
Address: 10.79.0.110
> mail.mail.com.cn
Server: mail.mail.com.cn
Address: 10.79.0.110
Name: mail.mail.com.cn
Address: 10.79.0.110
至此,dns正向和反向解析均已正常,配置成功!