本部分介绍 Solaris OS 中 BIND 9 DNS 名称服务的配置和管理。
Solaris 10 操作系统随附 BIND 9.x DNS 名称服务器。本章提供与在 Solaris 操作系统中使用 BIND 9 有关的配置和管理信息。常规的 BIND 和 DNS 信息可从许多其他来源获得,包括相关材料中列出的来源。
本章包含以下主题:
有关 DNS 和 BIND 管理的信息,请参见以下文档。
/usr/share/doc/bind/migration.txt 中的 BIND 9 迁移说明文档
Internet Systems Consortium (ISC) Web 站点 http://www.isc.org 中的 BIND 9 管理员手册
BIND 功能、已知错误和缺陷的列表以及到 ISC Web 站点 http://www.isc.org 中的其他材料的链接
《DNS and Bind》,由 Paul Albitz 和 Cricket Liu 编著,(第 4 版,O'Reilly 出版社,2001 年)
BIND 9 可与大多数 BIND 8 功能向上兼容。但是,在升级现有的 BIND 8 安装以使用 BIND 9 时,仍需了解许多注意事项。安装和使用 BIND 9 之前,务必阅读整个迁移说明文档。迁移说明位于 /usr/share/doc/bind/migration.txt 中。而且,BIND 软件包名称已更改为 SUNWbind 和 SUNWbindr。SUNWbindr 软件包包含 DNS 服务器 manifest。
以下列表列出了 BIND 8 与 BIND 9 之间区别的简短说明。迁移说明中提供了详细信息。
配置文件兼容性
关于未实现选项的警告消息
transfer-format 选项已更改
配置文件错误
日志类别已更改
通知消息和刷新查询已更改
多个类已更改
区域文件兼容性
区域文件中 TTL 规则更严格
SOA(面向服务的体系结构)序列号已更改
引号不配对将引起错误
换行符、语言更改
在域名中使用 \$ 代替 $$
新协议功能的互操作性影响
BIND 9 中新增 EDNS0
区域传送缺省值已更改
不受限的字符集
对字符集没有任何限制
安全问题,错误命名
服务器管理工具
rndc 程序取代了 ndc
nsupdate: 多个更新的方式已更改
区域之间无信息泄漏
以不同的方式处理粘附 NS 记录
未修改 Umask
可能的 umask 权限问题
可以使用服务管理工具 (Service Management Facility, SMF) 来管理 DNS/BIND named 服务。有关 SMF 的概述,请参阅System Administration Guide: Basic Administration中的“Managing Services (Overview)”。另请参阅 svcadm(1M)、svcs(1) 和 svccfg(1M) 手册页以获取更多详细信息。还可以查看 /var/svc/manifest/network/dns 中的 DNS 服务器 manifest server.xml。
可以使用 svcadm 命令对此服务执行启用、禁用或重新启动等管理操作。
使用 -t 选项暂时禁用服务可为服务配置提供一些保护。如果禁用服务时使用了 -t 选项,则在重新引导后将恢复服务的初始设置。如果禁用服务时未使用 -t,则服务在重新引导后仍将保持禁用状态。
用于 DNS 服务的故障管理资源标识符 (Fault Managed Resource Identifier, FMRI) 是 svc:/network/dns/server:<instance> 和 svc:/network/dns/client:<instance>。
使用 svcs 命令可以查询 DNS 服务器和客户机的状态。
svcs 命令和输出示例。
# svcs \*dns\* STATE STIME FMRI online Nov_16 svc:/network/dns/server:default online Nov_16 svc:/network/dns/client:default |
svcs -l 命令和输出示例。
# svcs -l /network/dns/server fmri svc:/network/dns/server:default name Internet domain name server (DNS) enabled true state online next_state none restarter svc:/system/svc/restarter:default contract_id 25 dependency require_all/none svc:/system/filesystem/minimal (online) dependency require_all/none file://localhost/etc/named.conf (online) dependency require_any/error svc:/network/loopback (online) dependency optional_all/error svc:/network/physical (online) |
如果需要以不同选项启动 DNS 服务(例如,用 /etc/named.conf 之外的配置文件),可以使用 svccfg 命令更改 DNS 服务器 manifest 的 start method 属性。
仅当要运行 BIND 9 名称服务的多个副本时,才需要多个 SMF 服务实例。在 DNS 服务器 manifest 中可为其他每个实例指定不同的启动方法。
尽管建议使用 svcadm 管理服务器,但也可以使用 rndc。SMF 可识别 BIND 9 named 服务的状态更改,无论使用 svcadm 还是 rndc 来管理。
如果从命令行手动执行服务,SMF 将不识别 BIND 9 named 服务。
BIND 8 ndc 和 BIND 9 rndc 名称服务器控制工具不向后兼容。rndc 不能与 BIND 8 名称服务器对话,ndc 不能与 BIND 9 名称服务器对话。功能、选项、缺省操作模式以及配置文件要求都已更改。 因此,在 BIND 9 服务器中使用 ndc 会导致功能丧失或操作不安全。有关更多信息,请参见 rndc(1M) 手册页。
BIND 8 中的 ndc 与 BIND 9 中的 rndc 之间最显著的差别在于 rndc 需要自己的配置文件 rndc.conf。此文件可由 rndc-confgen 命令生成。rndc.conf 文件可以指定将由哪个服务器进行控制及该服务器应使用算法。
options { default-server localhost; default-key "rndc-key"; }; key "rndc-key" { algorithm hmac-md5; secret "qPWZ3Ndl81aBRY9AmJhVtU=="; }; |
controls { inet * allow { any; } keys { "rndc-key"; }; }; key "rndc-key" { algorithm hmac-md5; secret "qPWZ3Ndl81aBRY9AmJhVtU=="; }; |
ndc 和 rndc 实用程序都使用控制通道来向名称服务器发送信息以及从该服务器中检索信息。但是,这两个实用程序之间存在差别。
在 BIND 8 中,ndc 可以使用 AF_UNIX 域套接字(UNIX 控制通道)或 TCP/IP 套接字(inet 控制通道)。缺省情况下,ndc 不需要 /etc/named.conf 中提供的任何支持,因为 BIND 8 服务器使用 UNIX 域套接字,且路径 (/var/run/ndc.d/ndc) 已编译到 in.named 中。
但对于 BIND 9,rndc 只使用经过验证的 TCP/IP inet 控制通道,因而不与 BIND 8 向后兼容。在 BIND 9 服务器中,不存在对控制通道的 UNIX 域套接字支持。
使用 rndc 时,需要指定用于与名称服务器通信的 'key' 子句。BIND 9 服务器和 rndc 客户机必须共享同一密钥(在 /etc/named.conf 和 /etc/rndc.conf 中定义)。 在 BIND 9 中使用 BIND 8 控制项将产生错误消息。
从 ndc 到 rndc 实现,一些命令选项已更改。其中包括 -c 选项,该选项在 BIND 9 中具有不同的语法。因此,要在 BIND 9 中指定控制通道,请使用 rndc -s <server> -p <port>。
以下列表介绍 rndc 命令。
重新装入配置文件和区域
重新装入单个区域
安排区域的立即维护
仅重新装入配置文件和新区域
将服务器统计信息写入统计文件中
切换查询日志
将高速缓存转储到转储文件 (named_dump.db)
将暂挂更新保存到主文件并停止服务器
停止服务器,但不保存暂挂更新
将调试级别增加一级
更改调试级别
将调试级别设置为 0
刷新服务器的所有高速缓存
为某一视图刷新服务器的高速缓存
显示服务器的状态
重新启动服务器(尚未实现)
在 BIND 9 中,有些命令、文件、工具和选项与 BIND 8 中保持相同,有些已被修改,还有一些是新增的。本节介绍 BIND 9 中的许多命令、文件、工具和选项以及与每项关联的新增行为或已修改的行为。
Solaris 操作系统提供了以下 BIND 9.x 工具。
Solaris 10 支持以下 BIND 9.x 配置文件。
下表对 BIND 8 和 BIND 9 的命令及配置文件进行了比较。
BIND 8 命令 |
BIND 9.x 替代命令 |
---|---|
dnskeygen(1M) |
dnssec-keygen(1M) |
ndc(1M) |
rndc(1M) |
named-bootconf(1M) |
不需要 |
nsupdate(1M) |
nsupdate(1M) |
nslookup(1M) |
nslookup(1M) |
named-xfer(1M) |
不需要 |
in.named(1M) |
named(1M) |
named.conf(4) |
named.conf [BIND 9.2.4 中不包括详细的 named.conf 手册页。named.conf 选项 包括 BIND 9.2.4 所支持的 named.conf 选项的摘要。] |
dig(1M) |
dig(1M) |
下面列出的所有不兼容项都是等效的 BIND 9 二进制文件不支持的 BIND 8 功能和接口。此列表不用作任何 BIND 9.x 二进制文件的选项、命令行选项或功能的详细列表。
命令 |
选项更改 |
---|---|
不支持 DNS 名称服务器的一些 in.named 命令行选项。 在 BIND 9.x 名称服务器中,不支持 -g group_name、-q、-r 和 -w directory 选项,并且 -c config_file 替代了 BIND 8.x -b config_file。有关详细信息,请参见 named 手册页。 |
|
dnssec-keygen(1M) |
BIND 8.x 中的 dnskeygen 用于生成密钥,BIND 9.x 中的 dnssec-keygen 没有通用选项。有关详细信息,请参见 dnssec-keygen 手册页。 |
rndc(1M) |
BIND 8.x 中的 ndc 与 BIND 9.x 中的 rndc 存在显著差别。它们不共享通用选项。与 ndc 不同,rndc 需要在 /etc/rndc.conf 中有一个配置文件才能运行。有关详细信息,请参见 rndc、rndc.conf 和 rndc-confgen 手册页。 |
在 BIND 9.x 中,nsupdate -k 选项的语法已更改。不再是 -k keydir::keyname,该语法现在为 k keyfile。其他仅有的差别是,以前使用空白行作为向服务器发送输入的信号,而现在使用显式的 send 子命令来执行相同操作。有关详细信息,请参见 nsupdate 手册页。 |
|
9.x 版本的 BIND 不支持以下选项:help、host server、set ignoretc、set noignoretc、set srch[list]=N1[/N2/.../N6]、set ro[ot]=host、root、finger [USER]、ls [opt] DOMAIN [> FILE] |
|
named.conf(4) |
有几个选项不受支持、未实现或更改了缺省值。有关选项更改的列表和所有 named.conf 选项的摘要,请参见named.conf 选项。 |
以下列表比较了 BIND 8 和 BIND 9 的 named.conf 选项。还提供了更改的简短说明。“更改”列中的 OK 表示选项在 BIND 9 版本的 named 中工作方式不变。
本节介绍 BIND 8 语句与 BIND 9 语句之间的所有差别。
unix 是 ndc 的缺省设置,并且编译了所有参数。inet 是 rndc 唯一的选项,并且未编译任何内容。
Syntax controls { [ inet ip_addr port ip_port allow { address_match_list; }; ] OK [ unix path_name perm number owner number group number; ] Not Implemented }; |
日志语法发生了显著更改。有关 named.conf 选项的列表,请参见named.conf 选项。
BIND 8 named.conf 手册页中用于区域语句的语法大部分在 BIND 9 中都受支持,以下语法除外:
[ pubkey number number number string; ] Obsolete [ check-names ( warn | fail | ignore ); ] Not Implemented |
该语句在 BIND 9 中的工作方式未更改。
Syntax acl name { address_match_list }; |
该语句在 BIND 9 中的工作方式未更改。
Syntax key key_id { algorithm algorithm_id; secret secret_string; }; |
工作方式未更改,但使用此语句的代码在 BIND 9.2.4 中已被禁用。
Syntax trusted-keys { [ domain_name flags protocol algorithm key; ] }; |
support-ixfr 已过时,但以下所有选项在 BIND 9 中的工作方式未更改。请注意,transfer-format 的缺省设置已更改。
Syntax server ip_addr { [ bogus yes_or_no; ] [ transfers number; ] [ transfer-format ( one-answer | many-answers ); ] [ keys { key_id [ key_id ... ] }; ] [ edns yes_or_no; ] }; |
该语句在 BIND 9 中的工作方式未更改。
Syntax include path_name; |
BIND 9.2.4 不包括详细的 named.conf 手册页。下面是 BIND 9.2.4 支持的 named.conf 选项的摘要。
options { blackhole { <address_match_element>; ... }; coresize <size>; datasize <size>; deallocate-on-exit <boolean>; // obsolete directory <quoted_string>; dump-file <quoted_string>; fake-iquery <boolean>; // obsolete files <size>; has-old-clients <boolean>; // obsolete heartbeat-interval <integer>; host-statistics <boolean>; // not implemented host-statistics-max <integer>; // not implemented interface-interval <integer>; listen-on [ port <integer> ] { <address_match_element>; ... }; listen-on-v6 [ port <integer> ] { <address_match_element>; ... }; match-mapped-addresses <boolean>; memstatistics-file <quoted_string>; // not implemented multiple-cnames <boolean>; // obsolete named-xfer <quoted_string>; // obsolete pid-file <quoted_string>; port <integer>; random-device <quoted_string>; recursive-clients <integer>; rrset-order { [ class <string> ] [ type <string> ] [ name <quoted_string> ] <string> <string>; ... }; // not implemented serial-queries <integer>; // obsolete serial-query-rate <integer>; stacksize <size>; statistics-file <quoted_string>; statistics-interval <integer>; // not yet implemented tcp-clients <integer>; tkey-dhkey <quoted_string> <integer>; tkey-gssapi-credential <quoted_string>; tkey-domain <quoted_string>; transfers-per-ns <integer>; transfers-in <integer>; transfers-out <integer>; treat-cr-as-space <boolean>; // obsolete use-id-pool <boolean>; // obsolete use-ixfr <boolean>; version <quoted_string>; allow-recursion { <address_match_element>; ... }; allow-v6-synthesis { <address_match_element>; ... }; sortlist { <address_match_element>; ... }; topology { <address_match_element>; ... }; // not implemented auth-nxdomain <boolean>; // default changed minimal-responses <boolean>; recursion <boolean>; provide-ixfr <boolean>; request-ixfr <boolean>; fetch-glue <boolean>; // obsolete rfc2308-type1 <boolean>; // not yet implemented additional-from-auth <boolean>; additional-from-cache <boolean>; query-source <querysource4>; query-source-v6 <querysource6>; cleaning-interval <integer>; min-roots <integer>; // not implemented lame-ttl <integer>; max-ncache-ttl <integer>; max-cache-ttl <integer>; transfer-format ( many-answers | one-answer ); max-cache-size <size_no_default>; check-names <string> <string>; // not implemented cache-file <quoted_string>; allow-query { <address_match_element>; ... }; allow-transfer { <address_match_element>; ... }; allow-update-forwarding { <address_match_element>; ... }; allow-notify { <address_match_element>; ... }; notify <notifytype>; notify-source ( <ipv4_address> | * ) [ port ( <integer> | * ) ]; notify-source-v6 ( <ipv6_address> | * ) [ port ( <integer> | * ) ]; also-notify [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ]; ... }; dialup <dialuptype>; forward ( first | only ); forwarders [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ]; ... }; maintain-ixfr-base <boolean>; // obsolete max-ixfr-log-size <size>; // obsolete transfer-source ( <ipv4_address> | * ) [ port ( <integer> | * ) ]; transfer-source-v6 ( <ipv6_address> | * ) [ port ( <integer> | * ) ]; max-transfer-time-in <integer>; max-transfer-time-out <integer>; max-transfer-idle-in <integer>; max-transfer-idle-out <integer>; max-retry-time <integer>; min-retry-time <integer>; max-refresh-time <integer>; min-refresh-time <integer>; sig-validity-interval <integer>; zone-statistics <boolean>; }; controls { inet ( <ipv4_address> | <ipv6_address> | * ) [ port ( <integer> | * ) ] allow { <address_match_element>; ... } [ keys { <string>; ... } ]; unix <unsupported>; // not implemented }; acl <string> { <address_match_element>; ... }; logging { channel <string> { file <logfile>; syslog <optional_facility>; null; stderr; severity <logseverity>; print-time <boolean>; print-severity <boolean>; print-category <boolean>; }; category <string> { <string>; ... }; }; view <string> <optional_class> { match-clients { <address_match_element>; ... }; match-destinations { <address_match_element>; ... }; match-recursive-only <boolean>; key <string> { algorithm <string>; secret <string>; }; zone <string> <optional_class> { type ( master | slave | stub | hint | forward ); allow-update { <address_match_element>; ... }; file <quoted_string>; ixfr-base <quoted_string>; // obsolete ixfr-tmp-file <quoted_string>; // obsolete masters [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ] [ key <string> ]; ... }; pubkey <integer> <integer> <integer> <quoted_string>; // obsolete update-policy { ( grant | deny ) <string> ( name | subdomain | wildcard | self ) <string> <rrtypelist>; ... }; database <string>; check-names <string>; // not implemented allow-query { <address_match_element>; ... }; allow-transfer { <address_match_element>; ... }; allow-update-forwarding { <address_match_element>; ... }; allow-notify { <address_match_element>; ... }; notify <notifytype>; notify-source ( <ipv4_address> | * ) [ port ( <integer> | * ) ]; notify-source-v6 ( <ipv6_address> | * ) [ port ( <integer> | * ) ]; also-notify [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ]; ... }; dialup <dialuptype>; forward ( first | only ); forwarders [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ]; ... }; maintain-ixfr-base <boolean>; // obsolete max-ixfr-log-size <size>; // obsolete transfer-source ( <ipv4_address> | * ) [ port ( <integer> | * ) ]; transfer-source-v6 ( <ipv6_address> | * ) [ port ( <integer> | * ) ]; max-transfer-time-in <integer>; max-transfer-time-out <integer>; max-transfer-idle-in <integer>; max-transfer-idle-out <integer>; max-retry-time <integer>; min-retry-time <integer>; max-refresh-time <integer>; min-refresh-time <integer>; sig-validity-interval <integer>; zone-statistics <boolean>; }; server { bogus <boolean>; provide-ixfr <boolean>; request-ixfr <boolean>; support-ixfr <boolean>; // obsolete transfers <integer>; transfer-format ( many-answers | one-answer ); keys <server_key>; edns <boolean>; }; trusted-keys { <string> <integer> <integer> <integer> <quoted_string>; ... }; allow-recursion { <address_match_element>; ... }; allow-v6-synthesis { <address_match_element>; ... }; sortlist { <address_match_element>; ... }; topology { <address_match_element>; ... }; // not implemented auth-nxdomain <boolean>; // default changed minimal-responses <boolean>; recursion <boolean>; provide-ixfr <boolean>; request-ixfr <boolean>; fetch-glue <boolean>; // obsolete rfc2308-type1 <boolean>; // not yet implemented additional-from-auth <boolean>; additional-from-cache <boolean>; query-source <querysource4>; query-source-v6 <querysource6>; cleaning-interval <integer>; min-roots <integer>; // not implemented lame-ttl <integer>; max-ncache-ttl <integer>; max-cache-ttl <integer>; transfer-format ( many-answers | one-answer ); max-cache-size <size_no_default>; check-names <string> <string>; // not implemented cache-file <quoted_string>; allow-query { <address_match_element>; ... }; allow-transfer { <address_match_element>; ... }; allow-update-forwarding { <address_match_element>; ... }; allow-notify { <address_match_element>; ... }; notify <notifytype>; notify-source ( <ipv4_address> | * ) [ port ( <integer> | * ) ]; notify-source-v6 ( <ipv6_address> | * ) [ port ( <integer> | * ) ]; also-notify [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ]; ... }; dialup <dialuptype>; forward ( first | only ); forwarders [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ]; ... }; maintain-ixfr-base <boolean>; // obsolete max-ixfr-log-size <size>; // obsolete transfer-source ( <ipv4_address> | * ) [ port ( <integer> | * ) ]; transfer-source-v6 ( <ipv6_address> | * ) [ port ( <integer> | * ) ]; max-transfer-time-in <integer>; max-transfer-time-out <integer>; max-transfer-idle-in <integer>; max-transfer-idle-out <integer>; max-retry-time <integer>; min-retry-time <integer>; max-refresh-time <integer>; min-refresh-time <integer>; sig-validity-interval <integer>; zone-statistics <boolean>; }; lwres { listen-on [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ]; ... }; view <string> <optional_class>; search { <string>; ... }; ndots <integer>; }; key <string> { algorithm <string>; secret <string>; }; zone <string> <optional_class> { type ( master | slave | stub | hint | forward ); allow-update { <address_match_element>; ... }; file <quoted_string>; ixfr-base <quoted_string>; // obsolete ixfr-tmp-file <quoted_string>; // obsolete masters [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ] [ key <string> ]; ... }; pubkey <integer> <integer> <integer> <quoted_string>; // obsolete update-policy { ( grant | deny ) <string> ( name | subdomain | wildcard | self ) <string> <rrtypelist>; ... }; database <string>; check-names <string>; // not implemented allow-query { <address_match_element>; ... }; allow-transfer { <address_match_element>; ... }; allow-update-forwarding { <address_match_element>; ... }; allow-notify { <address_match_element>; ... }; notify <notifytype>; notify-source ( <ipv4_address> | * ) [ port ( <integer> | * ) ]; notify-source-v6 ( <ipv6_address> | * ) [ port ( <integer> | * ) ]; also-notify [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ]; ... }; dialup <dialuptype>; forward ( first | only ); forwarders [ port <integer> ] { ( <ipv4_address> | <ipv6_address> ) [ port <integer> ]; ... }; maintain-ixfr-base <boolean>; // obsolete max-ixfr-log-size <size>; // obsolete transfer-source ( <ipv4_address> | * ) [ port ( <integer> | * ) ]; transfer-source-v6 ( <ipv6_address> | * ) [ port ( <integer> | * ) ]; max-transfer-time-in <integer>; max-transfer-time-out <integer>; max-transfer-idle-in <integer>; max-transfer-idle-out <integer>; max-retry-time <integer>; min-retry-time <integer>; max-refresh-time <integer>; min-refresh-time <integer>; sig-validity-interval <integer>; zone-statistics <boolean>; }; server { bogus <boolean>; provide-ixfr <boolean>; request-ixfr <boolean>; support-ixfr <boolean>; // obsolete transfers <integer>; transfer-format ( many-answers | one-answer ); keys <server_key>; edns <boolean>; }; trusted-keys { <string> <integer> <integer> <integer> <quoted_string>; ... }; |