在我工作的 Intranet 上,我们有不公开的内部应用程序,例如:app1.example.com、app2.example.com,而 example.com 是面向公众的网站。app1.example.com 和 app2.example.com 都解析为内网的 ip。
据我搜索,我发现这可以通过将本地 DNS 服务器连接到我们的 Intranet 来实现。
因此,我想通过使用 Virtualbox VM 来复制它,所以使用了 3 个 Ubuntu 风格的 Vm 的一个 Xubuntu、一个 Lubuntu 和一个 Ubuntu Budgie Edition 剩余的来自以前的“实验”。他们都有 2 个网络适配器:
- 一种设置为 NAT 和
- 另一个作为“内部网络”,静态具有来自
192.0.0.0/24
网络的 ips。
在 Xubuntu 上,我安装了 bind9 和一个网络服务器,并尝试通过输入 Xubuntu 和 Budgie Edition Vms 的浏览器 app1.intranet.example.com 和 app2.intranet.example.com 来模拟,以服务于 2 个不同的站点。这些站点在网络之外(这 3 个 Vms 的)将不可用,甚至无法解析这 2 个站点的 DNS 条目。
至于现在在运行绑定的虚拟机上(The Xubuntu One)有这些设置:
options {
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
forwarders {
208.67.222.222;
208.67.220.220;
};
//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//========================================================================
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
acl "intranet" { 192.0.0.1/24; };
view "intranetView" {
match-clients { "intranet"; };
recursion yes;
zone "intranet.example.com" {
type master;
file "/etc/bind/db.intranet"
}
}
view "outside" {
match-clients { any; }
recursion no;
}
另外,/etc/bind/db.intranet
我有以下条目:
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA intranet.example.com. root.example.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS 192.0.0.2
@ IN A 192.0.0.2
app1 IN A 192.0.0.2
app2 IN A 192.0.0.2
但是由于某种原因,当我尝试重新启动绑定时它失败了。你能帮我找出问题所在吗?
NS 记录必须是主机名
你也错过了一些
;
之后}
命令:
输出:
除了雅各布的回复,您还错过了对 ip4 的监听。
还要检查系统日志以获取任何有用的线索
并尝试命名-checkconf 和命名-checkzone。在启动绑定服务之前非常有用的工具。