Ubuntu 中查询 DNS

发布于 2024-09-13 03:59:33 字数 367 浏览 1 评论 0原文

我使用两台 DNS 服务器,一台是公共 DNS 服务器 (8.8.8.8) 和本地的 (192.168.1.20) 在ubuntu中,如果我写了两个DNS 192.168.1.20, 8.8.8.8 它将始终查询第一个,直到第一个关闭,然后它将开始查询第二个。 当然我必须再次将本地指向8.8.8.8 像这样我几乎没有问题,我可以解析本地地址和公共地址 但当我离开办公室时,所有的问题就开始了。 首先拥有本地 DNS 使得 ubuntu 在每次需要解析时都会检查它。 因此,我每次更改位置时(8.8.8.8、192.168.1.20)都会切换 DNS 的优先级。

如果我使用 Windows,则不会出现这种情况。它以某种方式同时发送到两个 DNS 或类似的东西。 有没有办法避免更改每个位置的 DNS?

I use two DNS servers a public one (8.8.8.8)
and a local one (192.168.1.20)
In ubuntu, If I wrote both DNSs 192.168.1.20, 8.8.8.8
it will always query the first and until the first is down and then it will start querying the second.
And of course I have to make the local point again to 8.8.8.8
Like this i have almost no problems, I can resolve local addresses and also public ones
but when I'm out of the office that's were all the problems start.
Having the local DNS first makes ubuntu checks for it every single time it needs to resolve.
So I end up switching switching the priority of the DNS every (8.8.8.8, 192.168.1.20) time I change my location.

This is not the case if I was using windows. It somehow sends to both DNSs at once or something of that sort.
Is there a way to avoid changing the DNS for every location?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

将军与妓 2024-09-20 03:59:33

如果第一台服务器没有答复,Ubuntu 还必须查询 /etc/resolv.conf 中的每台服务器。
请给出“dig google.com”的输出,


您写道“直到第一个崩溃”...
当然,只有当第一个服务器没有响应时,系统才会连接其他服务器!
服务器按优先顺序列出

Ubuntu also must query each server in /etc/resolv.conf if there is no answer from the first server.
Give an output of 'dig google.com' please


You wrote 'until the first is down'...
The system of course will connect other servers ONLY if has no respond from the first one!!
The servers are listed in preferable order

彡翼 2024-09-20 03:59:33

不是答案,而是可能的解决方法。
您可以为每个网络使用不同的网络接口吗?
如果是这样,您可以在“/etc/network/interfaces”文件中指定不同的“dns-nameservers”。

Not an answer but a possible work around.
Are you able to use different network interfaces for each network?
If so you can specify different "dns-nameservers" in the "/etc/network/interfaces" file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文