bind 安装与简单配置文档
bind 安装配置文档
官方网站:http://www.bind.com/
源码软件包:Bind 是开源的软件,可以去其官方网站下载。http://www.bind.com/pub/bind9/
tar xzvf bind-9.6.0.tar.gz
cd bind-9.6.0
./configure –prefix=/usr/local
make
make install
在/usr/local/etc下新建named.conf
/*named.conf*/
options {
directory "/var/bind";
listen-on-v6 { none; }; // 禁止IPv6的功能
listen-on { 127.0.0.1; }; // 如果你有多个网卡,而你只想监听特定的一个网卡,就可以使用这个选项
pid-file "/var/run/named.pid"; // 设置 named 进程运行时记录PID号的文件
};
zone "." IN {
type hint;
file "named.cache";
};
zone "localhost" IN {
type master; // 区的类型设置为 master
file "localhost.zone"; // 区数据文件的位置
allow-update { none; }; // 不允许动态更新本区的数据
notify no; // 由于不允许动态更新,那么就不需要更新通知的功能
};
zone "127.in-addr.arpa" IN {
type master;
file "127.zone";
allow-update { none; };
notify no;
};
zone "iceyu.cn" IN {
type master;
file "iceyu.cn.zone";
allow-update { none; };
notify no;
};
/*end*/
zone "covics.com" IN {
type master;
file "covics.com.zone";
allow-update { none; };
notify no;
};
是新加上去的iceyu.cn域名的解析
然后在/var/bind这个下分别新建named.cache、localhost.zone、127.zone、covics.com.zone
=============
named.cache
=============
这个文件记录了所有根 dns 服务器的信息,是由 www.internic.net 维护的,一般好几年才变动一次。你可以到 ftp://ftp.rs.internic.net/domain/named.cache 去下载,这里就不列出来了。
=============
localhost.zone
=============
$TTL 1W
@ IN SOA ns.localhost. root.localhost. (
2004100501 ; Serial
28800 ; Refresh
14400 ; Retry
604800 ; Expire - 1 week
86400 ) ; Minimum
IN NS ns
localhost. IN A 127.0.0.1
=============
127.zone
=============
$ORIGIN 127.in-addr.arpa.
$TTL 1W
@ 1D IN SOA localhost. root.localhost. (
2004100501 ; Serial
3H ; Refresh
15M ; Retry
1W ; Expire
1D ) ; Minimum
1D IN NS localhost.
* 1D IN PTR localhost.
=============
covics.com.zone
=============
$TTL 86400
$ORIGIN covics.com.
@ IN SOA ns1.covics.com. root.covics.com. (
2005030302 28800 14400 3600000 86400 )
IN NS ns1.covics.com.
IN NS ns2.covics.com.
ns1 IN A 127.0.0.1
ns2 IN A 127.0.0.1
@ IN A 127.0.0.1
* IN A 127.0.0.1
这样就可以在本服务器解析covics.com
cd /usr/local/etc
./named -g
21-Feb-2009 10:01:11.684 starting BIND 9.6.0 -g
21-Feb-2009 10:01:11.685 built with '-prefix=/usr/local'
21-Feb-2009 10:01:11.685 using up to 4096 sockets
21-Feb-2009 10:01:11.701 loading configuration from '/usr/local/etc/named.conf'
21-Feb-2009 10:01:11.705 using default UDP/IPv4 port range: [1024, 65535]
21-Feb-2009 10:01:11.705 using default UDP/IPv6 port range: [1024, 65535]
21-Feb-2009 10:01:11.711 listening on IPv4 interface lo, 127.0.0.1#53
21-Feb-2009 10:01:11.722 automatic empty zone: 0.IN-ADDR.ARPA
21-Feb-2009 10:01:11.722 automatic empty zone: 254.169.IN-ADDR.ARPA
21-Feb-2009 10:01:11.723 automatic empty zone: 2.0.192.IN-ADDR.ARPA
21-Feb-2009 10:01:11.723 automatic empty zone: 255.255.255.255.IN-ADDR.ARPA
21-Feb-2009 10:01:11.723 automatic empty zone: 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
21-Feb-2009 10:01:11.724 automatic empty zone: 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
21-Feb-2009 10:01:11.727 automatic empty zone: D.F.IP6.ARPA
21-Feb-2009 10:01:11.727 automatic empty zone: 8.E.F.IP6.ARPA
21-Feb-2009 10:01:11.727 automatic empty zone: 9.E.F.IP6.ARPA
21-Feb-2009 10:01:11.727 automatic empty zone: A.E.F.IP6.ARPA
21-Feb-2009 10:01:11.727 automatic empty zone: B.E.F.IP6.ARPA
21-Feb-2009 10:01:11.737 none:0: open: /usr/local/etc/rndc.key: file not found
21-Feb-2009 10:01:11.738 couldn't add command channel 127.0.0.1#953: file not found
21-Feb-2009 10:01:11.738 none:0: open: /usr/local/etc/rndc.key: file not found
21-Feb-2009 10:01:11.738 couldn't add command channel ::1#953: file not found
21-Feb-2009 10:01:11.739 ignoring config file logging statement due to -g option
21-Feb-2009 10:01:11.744 127.zone:11: file does not end with newline
21-Feb-2009 10:01:11.746 zone 127.in-addr.arpa/IN: loaded serial 2004100501
21-Feb-2009 10:01:11.748 iceyu.cn.zone:10: file does not end with newline
21-Feb-2009 10:01:11.750 zone iceyu.cn/IN: loaded serial 2005030302
21-Feb-2009 10:01:11.751 localhost.zone:10: file does not end with newline
21-Feb-2009 10:01:11.752 zone localhost/IN: NS 'ns.localhost' has no address records (A or AAAA)
21-Feb-2009 10:01:11.753 zone localhost/IN: loaded serial 2004100501
21-Feb-2009 10:01:11.755 running
说明正确运行
ctrl+c
然后./named
在后台运行
官方网站:http://www.bind.com/
源码软件包:Bind 是开源的软件,可以去其官方网站下载。http://www.bind.com/pub/bind9/
tar xzvf bind-9.6.0.tar.gz
cd bind-9.6.0
./configure –prefix=/usr/local
make
make install
在/usr/local/etc下新建named.conf
/*named.conf*/
options {
directory "/var/bind";
listen-on-v6 { none; }; // 禁止IPv6的功能
listen-on { 127.0.0.1; }; // 如果你有多个网卡,而你只想监听特定的一个网卡,就可以使用这个选项
pid-file "/var/run/named.pid"; // 设置 named 进程运行时记录PID号的文件
};
zone "." IN {
type hint;
file "named.cache";
};
zone "localhost" IN {
type master; // 区的类型设置为 master
file "localhost.zone"; // 区数据文件的位置
allow-update { none; }; // 不允许动态更新本区的数据
notify no; // 由于不允许动态更新,那么就不需要更新通知的功能
};
zone "127.in-addr.arpa" IN {
type master;
file "127.zone";
allow-update { none; };
notify no;
};
zone "iceyu.cn" IN {
type master;
file "iceyu.cn.zone";
allow-update { none; };
notify no;
};
/*end*/
zone "covics.com" IN {
type master;
file "covics.com.zone";
allow-update { none; };
notify no;
};
是新加上去的iceyu.cn域名的解析
然后在/var/bind这个下分别新建named.cache、localhost.zone、127.zone、covics.com.zone
=============
named.cache
=============
这个文件记录了所有根 dns 服务器的信息,是由 www.internic.net 维护的,一般好几年才变动一次。你可以到 ftp://ftp.rs.internic.net/domain/named.cache 去下载,这里就不列出来了。
=============
localhost.zone
=============
$TTL 1W
@ IN SOA ns.localhost. root.localhost. (
2004100501 ; Serial
28800 ; Refresh
14400 ; Retry
604800 ; Expire - 1 week
86400 ) ; Minimum
IN NS ns
localhost. IN A 127.0.0.1
=============
127.zone
=============
$ORIGIN 127.in-addr.arpa.
$TTL 1W
@ 1D IN SOA localhost. root.localhost. (
2004100501 ; Serial
3H ; Refresh
15M ; Retry
1W ; Expire
1D ) ; Minimum
1D IN NS localhost.
* 1D IN PTR localhost.
=============
covics.com.zone
=============
$TTL 86400
$ORIGIN covics.com.
@ IN SOA ns1.covics.com. root.covics.com. (
2005030302 28800 14400 3600000 86400 )
IN NS ns1.covics.com.
IN NS ns2.covics.com.
ns1 IN A 127.0.0.1
ns2 IN A 127.0.0.1
@ IN A 127.0.0.1
* IN A 127.0.0.1
这样就可以在本服务器解析covics.com
cd /usr/local/etc
./named -g
21-Feb-2009 10:01:11.684 starting BIND 9.6.0 -g
21-Feb-2009 10:01:11.685 built with '-prefix=/usr/local'
21-Feb-2009 10:01:11.685 using up to 4096 sockets
21-Feb-2009 10:01:11.701 loading configuration from '/usr/local/etc/named.conf'
21-Feb-2009 10:01:11.705 using default UDP/IPv4 port range: [1024, 65535]
21-Feb-2009 10:01:11.705 using default UDP/IPv6 port range: [1024, 65535]
21-Feb-2009 10:01:11.711 listening on IPv4 interface lo, 127.0.0.1#53
21-Feb-2009 10:01:11.722 automatic empty zone: 0.IN-ADDR.ARPA
21-Feb-2009 10:01:11.722 automatic empty zone: 254.169.IN-ADDR.ARPA
21-Feb-2009 10:01:11.723 automatic empty zone: 2.0.192.IN-ADDR.ARPA
21-Feb-2009 10:01:11.723 automatic empty zone: 255.255.255.255.IN-ADDR.ARPA
21-Feb-2009 10:01:11.723 automatic empty zone: 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
21-Feb-2009 10:01:11.724 automatic empty zone: 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
21-Feb-2009 10:01:11.727 automatic empty zone: D.F.IP6.ARPA
21-Feb-2009 10:01:11.727 automatic empty zone: 8.E.F.IP6.ARPA
21-Feb-2009 10:01:11.727 automatic empty zone: 9.E.F.IP6.ARPA
21-Feb-2009 10:01:11.727 automatic empty zone: A.E.F.IP6.ARPA
21-Feb-2009 10:01:11.727 automatic empty zone: B.E.F.IP6.ARPA
21-Feb-2009 10:01:11.737 none:0: open: /usr/local/etc/rndc.key: file not found
21-Feb-2009 10:01:11.738 couldn't add command channel 127.0.0.1#953: file not found
21-Feb-2009 10:01:11.738 none:0: open: /usr/local/etc/rndc.key: file not found
21-Feb-2009 10:01:11.738 couldn't add command channel ::1#953: file not found
21-Feb-2009 10:01:11.739 ignoring config file logging statement due to -g option
21-Feb-2009 10:01:11.744 127.zone:11: file does not end with newline
21-Feb-2009 10:01:11.746 zone 127.in-addr.arpa/IN: loaded serial 2004100501
21-Feb-2009 10:01:11.748 iceyu.cn.zone:10: file does not end with newline
21-Feb-2009 10:01:11.750 zone iceyu.cn/IN: loaded serial 2005030302
21-Feb-2009 10:01:11.751 localhost.zone:10: file does not end with newline
21-Feb-2009 10:01:11.752 zone localhost/IN: NS 'ns.localhost' has no address records (A or AAAA)
21-Feb-2009 10:01:11.753 zone localhost/IN: loaded serial 2004100501
21-Feb-2009 10:01:11.755 running
说明正确运行
ctrl+c
然后./named
在后台运行