微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ubuntu – 我的VPN的DNS服务器只能解决网络名称

我需要设置DNS服务器,以便在用户连接VPN(OpenVPN)时解析网络服务器的名称.我可以成功地将DNS服务器的IP地址“推送”到客户端.我有一种错觉,即使用Bind9为本地网络设置DNS服务器很容易.我错了.首先,我从Google找到的每个样本都基于完全合格的域名,而不是本地名称.我称之为本地名称的是“server1”,而不是“server1.my.company.com”.但我发现了着名的“@”.

现在我有一个问题.当我用“ping”或“nslookup”尝试“server1”时,它完全符合我的要求.它将“server1”解析为我们的内部IP.大.但是,当我尝试“www.google.com”时,它无法解析IP.这意味着客户端尝试使用我的DNS服务器而不是仍在DNS服务器列表中的互联网提供商DNS服务器解决“www.google.com”问题.

有没有办法告诉客户端机器:我不认识这个人,看到别人?

我注意到认情况下“auth-nxdomain”设置为“no”.我试图将其设置为“是”,但它不能完成这项工作.

在Ubuntu 9.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服务器?我通过在选项文件中更改“forwarders {…}”来尝试它,但它不起作用.我不喜欢通过VPN完成每个DNS解析的想法.你有解决方案吗 ?

解决方法

您实际上也可以让内部DNS服务器解析外部域.那应该可以解决你的问题.我处理完全相同的问题,并使用 dnsmasq作为我的内部DNS.

我通过在VPN网关机器上设置DNS服务器以在尝试使用谷歌DNS自己的内部DNS后解决了这个问题.所以/etc/resolv.conf中的DNS配置看起来像:

nameserver 127.0.0.1
nameserver 8.8.8.8

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐