我在 Ubuntu 服务器上运行了 bind,我想使用它而不是使用主机文件。我对 bind 相当不熟悉,遇到了很多麻烦。目前 bind 服务器正在为内部 dns 工作,以前是外部 DNS 服务器,但已不再使用。我已按照教程操作这里并且无法使其工作。有没有更简单的方法来绑定 DNS 条目?我主要为我的路由器运行 clearOS,它们只是一种简单的方法来添加具有主机名和 IP 地址的主机。
因此,我想要做的是获取主机名 westappps.cable.comcast.com 并将其指向 IP 10.168.220.220。有没有办法在不为其创建区域的情况下做到这一点?
/etc/bind/named.conf.local
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
include "/etc/bind/rndc.key";
view "internal" {
match-clients {
lan_hosts;
};
recursion yes;
// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};
// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912
zone "localhost" {
type master;
file "/etc/bind/db.local";
};
zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};
zone "trizonllc.com" {
type master;
file "/var/lib/bind/trizonllc.com.internal.hosts";
};
zone "gotrizon.com" {
type master;
file "/var/lib/bind/gotrizon.com.internal.hosts";
};
zone "trizon.com" {
type master;
file "/var/lib/bind/trizon.com.internal.hosts";
};
zone "8.168.192.in-addr.arpa" {
type master;
file "/var/lib/bind/db.192.168.8";
allow-update {
key rndc-key;
};
notify yes;
};
zone "cable.comcast.com"{
type master;
file "/var/lib/bind/cable.comcast.com.internal.hosts";
};
};
view "external" {
match-clients {
!lan_hosts;
any;
};
recursion no;
// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};
zone "trizonllc.com" {
type master;
file "/var/lib/bind/trizonllc.com.hosts";
};
zone "spectraseven.com" {
type master;
file "/var/lib/bind/spectraseven.com.hosts";
};
zone "doelevate.com" {
type master;
file "/var/lib/bind/doelevate.com.hosts";
};
zone "frontiersalessupport.com" {
type master;
file "/var/lib/bind/frontiersalessupport.com.hosts";
};
zone "gotrizon.com" {
type master;
file "/var/lib/bind/gotrizon.com.hosts";
};
zone "trizon.com" {
type master;
file "/var/lib/bind/trizon.com.hosts";
};
zone "teltanium.com" {
type master;
file "/var/lib/bind/teltanium.com.hosts";
};
zone "transynergydirect.com" {
type master;
file "/var/lib/bind/transynergydirect.com.hosts";
};
zone "trizonstall.com" {
type master;
file "/var/lib/bind/trizonstall.com.hosts";
};
zone "czncorp.com" {
type master;
file "/var/lib/bind/czncorp.com.hosts";
};
zone "trizonllc.net" {
type master;
file "/var/lib/bind/trizonllc.net.hosts";
};
zone "spectraseven.net" {
type master;
file "/var/lib/bind/spectraseven.net.hosts";
};
zone "redrk.com" {
type master;
file "/var/lib/bind/redrk.com.hosts";
};
zone "redrocc.com" {
type master;
file "/var/lib/bind/redrocc.com.hosts";
};
zone "getredrock.com" {
type master;
file "/var/lib/bind/getredrock.com.hosts";
};
zone "maxguardid.com" {
type master;
file "/var/lib/bind/maxguardid.com.hosts";
};
zone "gotritech.com" {
type master;
file "/var/lib/bind/gotritech.com.external.hosts";
};
zone "cooleypro.com" {
type master;
file "/var/lib/bind/cooleypro.com.external.hosts";
};
zone "amerihomesgroup.com" {
type master;
file "/var/lib/bind/amerihomesgroup.com.hosts";
};
zone "cable.comcast.com"{
type master;
file "/var/lib/bind/cable.comcast.com.hosts";
};
};
/var/lib/bin/cable.comcast.com.local
$ttl 3600
cable.comcast.com. IN SOA 69.252.81.81 (
42
900
600
86400
3600 )
NS ns02.cable.comcast.com.
A 10.0.0.123
westapps A 10.168.220.220
答案1
所以我找到了答案。我使用命令named-checkzone example.com /etc/bind/db.example.com
检查文件,结果出现了以下错误:
/var/lib/bind/cable.comcast.com.hosts:9: ignoring out-of-zone data (ns02)
/var/lib/bind/cable.comcast.com.hosts:12: ignoring out-of-zone data (westapps)
zone cable.comcast.com/IN: has no NS records
zone cable.comcast.com/IN: not loaded due to errors.
为了修复忽略区域外数据错误,我添加了每个的 FQDN 并重新启动绑定。我仍然没有使用 Comcast 设置的 DNS 服务器,但这应该可以解决我的问题。这是我完成的区域文件。
$ORIGIN .
$ttl 3600
cable.comcast.com. IN SOA cable.comcast.com. admin.cable.comcast.com. (
42
900
600
86400
3600 )
NS ns02.cable.comcast.com.
ns02.cable.comcast.com. A 69.252.81.81
westapps.cable.comcast.com. A 10.168.220.220
erone.cable.comcast.com. A 10.165.55.140
我希望这可以帮助别人。