大网数据广告活动
服务器运维问答

Resolv Conf Multiple DNS Servers with specific domains

· 52CE 我爱测

I need the ability to have specific dns servers for multiple networks, and i would like to know how to properly update my /etc/resolv.conf : lets say I have a major vpn, that I route all my trafiic and DNS queries through it. But…

问题原文

原帖链接 · Alfredo Palhares · CC BY-SA 3.0

I need the ability to have specific dns servers for multiple networks, and i would like to know how to properly update my /etc/resolv.conf:

lets say I have a major vpn, that I route all my trafiic and DNS queries through it. But know I have another VPN that gives me specific accesss to a network, that VPN also as a DNS server, but it only serves a specific domain lets say: ´mydomain.local´

I have a constructed the following resolv.conf:

nameserver 10.8.0.1
search mydomain.local
nameserver 10.250.0.2

But the DNS queries will go on to the first domain server no matter what, changing order does not matter.

Can anyone give me any suggestion?

社区高分解答

原帖链接 · kostix · CC BY-SA 3.0

Impossible to achieve using /etc/resolv.conf only.

I'd say the easiest thing is to install dnsmasq (a caching DNS client), make it the sole resolver by putting nameserver 127.0.0.1 into /etc/resolv.conf and then modify dnsmasq configuration:

  • uncomment no-dhcp-interface= to disable dnsmasq's DHCP server facilities;
  • add a single generic record: server=10.8.0.1;
  • add specific record: server=/mydomain.local/10.250.0.2 to all requests for hosts in mydomail.local go to that server.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-09-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。