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

How to conditionally redirect DNS queries with dnsmasq?

· 52CE 我爱测

I would like, in my network, the host 10.10.10.1 to resolve names via 8.8.8.8 and 10.10.10.2 via 8.8.4.4 . They receive their DNS settings via the dnsmasq DHCP service. I can imagine two solutions: the hosts get a specific set of…

问题原文

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

I would like, in my network, the host 10.10.10.1 to resolve names via 8.8.8.8 and 10.10.10.2 via 8.8.4.4. They receive their DNS settings via the dnsmasq DHCP service.

I can imagine two solutions:

  • the hosts get a specific set of DNS servers depending on their IP
  • both hosts resolve though the dnsmasq server (so they both receive its IP address as DNS server) and dnsmasq redirects the requests based on the source IP of the requesting host.

Is this something which is configurable in dnsmasq?

The closest configuration I found is server=/example.com/8.8.8.8 which would redirect to 8.8.8.8 requests to resolve example.com. In my case however, it is the source which should trigger the condition and not the destination.

已采纳解答

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

Perhaps you should consider using the "views" feature in BIND. I'm not sure exactly what you're doing, but it sounds like you need different IP resolution inside of your LAN from outside of your LAN.

BIND allows you to respond to queries with different results based on the source IP. Read more about it here: https://kb.isc.org/article/AA-00851/0/Understanding-views-in-BIND-9-by-example.html

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

资料来源与适用范围

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

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

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