当用户在我们的虚拟专用网(OpenVPN)上连接时,我需要设置DNS服务器来解析我们网络服务器的名称。我可以成功地“推送”DNS服务器的IP地址到客户端。我幻想使用Bind9为本地网络安装DNS服务器很容易。我错了。首先,我从谷歌找到的每一个样本都是基于完全合格的域名,而不是本地名称。我把本地名称称为"server1",而不是"server1.my.company.com“。但我发现了著名的"@“。
现在我又遇到了另一个问题。当我尝试"server1“和"ping”或"nslookup“时,它完全可以做我想做的事情。它将"server1“解析为我们的内部IP。太棒了。但是当我尝试"www.google.com“时,它无法解析IP。这意味着客户端试图使用我的DNS服务器来解决"www.google.com“问题,而不是使用仍然在DNS服务器列表中的互联网提供商DNS服务器。
有没有办法告诉客户机器:我不认识这个人,见过别人吗?
我注意到默认情况下“”设置为"no“。我试着把它设置为“是”,但它做不到。
Ubuntu9.04下有我的Bind9配置文件:
/etc/bind/named.conf.options
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 {
// 0.0.0.0;
// };
//auth-nxdomain no; # conform to RFC1035
auth-nxdomain yes;
listen-on-v6 { any; };
// To prevent the error ";; Got recursion not available from 10.8.0.1, trying next server"
allow-recursion { 10.8.0.0/24; };
};/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";
// This is the zone definition.
zone "@" {
type master;
file "/etc/bind/zones/vpn.db";
};
// This is the zone definition for reverse DNS.
zone "0.8.10.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.0.8.10.in-addr.arpa";
};/etc/bind/zones/vpn.db
@ IN SOA vpn.local. admin.local. (
2011041608 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ; Negative Cache TTL
);
@ IN NS vpn.local.
server1 IN A 10.8.0.1/etc/bind/zones/rev.0.8.10.in-addr.arpa
@ IN SOA vpn.local. admin.local. (
2011041608 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ; Negative Cache TTL
);
@ IN NS vpn.local.
1 IN PTR mrsvn我对"SOA“一点也不懂。我从一个例子中抄袭了数字。我对“vpn.local”不太确定还有“admin.local”。总之DNS服务器正常工作。因为我需要做很多事情,所以我没有时间去阅读1000页的文本,然后才能执行如此简单的任务。是否需要将请求转发到服务器端的我自己的DNS服务器?我尝试过在选项文件中更改“转发器{.}”,但它不起作用。我不喜欢通过VPN来完成每一个DNS解析的想法。你有解决办法吗?
发布于 2012-06-22 21:06:17
我找到了解决办法。首先,在我将我的区域定义为根区域之前,转运商并没有参与进来。区域"@“指的是区域”。“,它是根区域。当我发现它时,经过一些思考,我记得DNS客户端可以配置哪个搜索域。
因此,首先,我更改了文件/etc/bind/named.conf.local的以下一行:
zone "@" {至
zone "vpn.my.company.com." {之后,对于/etc/bind/zones/vpn.db和/etc/bind/zones/rev.0.8.10.in-addr.arpa,我替换了“vpn.local”。由"vpn.my.company.com.“和“admin.local”由"admin.my.company.com“。
最后,在OpenVPN的配置文件中,我添加了以下行:
push "dhcp-option DOMAIN vpn.my.company.com"我重新开始了一切..。就这样!现在一切都解决了。
编辑:我阻止了其他域的名称解析,然后通过VPN的DNS服务器在文件/etc/bind/named.conf中这样做:
// prime the server with knowledge of the root servers
zone "." {
type master;
//type hint;
file "/etc/bind/db.root";
allow-query { 127.0.0.0/8; 192.168.0.0/16; };
};这样,其他域就可以从客户端的Internet提供商DNS服务器上解析。
发布于 2012-06-22 01:38:08
您实际上也可以让您的内部DNS服务器解析外部域。这应该能解决你的问题。我致力于解决同样的问题,并使用德斯马斯克作为我的内部DNS。
我解决了这个问题,通过在VPN网关机器上设置DNS服务器,在尝试了自己的内部DNS之后使用google。因此,/etc/surv.conf中的DNS配置看起来如下:
nameserver 127.0.0.1
nameserver 8.8.8.8发布于 2012-06-22 01:37:12
要使绑定转发查询不能回答其他名称服务器,您需要将其他DNS服务器的IP地址放置在转发器部分的/etc/bind/named.conf.options中。
本节在您的文件中注释掉了,所以Bind不知道在哪里转发查询。
// forwarders {
// 0.0.0.0;
// };例如,您可以使用ISP的DNS服务器或Google公共DNS服务器:
forwarders {
//Google public DNS
8.8.8.8;
8.8.4.4;
};您可以在本节中添加任意数量的条目。
https://stackoverflow.com/questions/11149118
复制相似问题