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

DNSMasq - Exclude some subdomains

· 52CE 我爱测

We've got several machines set up with DNSMasq to run local development environments forwarding all .dev requests to 127.0.0.1 However we need to add some exclusions to this list, wondering how we'd go about it. All these exclusi…

问题原文

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

We've got several machines set up with DNSMasq to run local development environments forwarding all .dev requests to 127.0.0.1

However we need to add some exclusions to this list, wondering how we'd go about it.

All these exclusions are still internal IP addresses, which are resolved by an internal DNS server, say on 192.168.1.255

For example we'd want to exclude any subomain or domain that has batcave.dev in it.

So batcave.dev would use the dns server on 192.168.1.255 and resolve to what ever is setup in the DNS server, along with other entries like wiki.batcave.dev and phpmyadmin.batcave.dev there could be any number of these subdomains.

We're running OSX/macOS & currently our resolver file from /private/etc/resolver/dev has just nameserver 127.0.0.1 in it.

Then our /usr/local/etc/dnsmasq.conf has this added to the bottom

address=/.dev/127.0.0.1
listen-address=127.0.0.1
port=35353

You can see the full files at https://gist.github.com/OwenMelbz/80c68e836058959b87f86f242e6efffa if needed :)

已采纳解答

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

If I understood your question correctly, then what you are looking for is the -S option on the command line:

    This is intended for private nameservers:
    if you have a nameserver on your network which deals with
    names of the form xxx.internal.thekelleys.org.uk at
    192.168.1.1 then giving the flag
    -S /internal.thekelleys.org.uk/192.168.1.1
    will send all queries for internal machines to
    that nameserver, everything else will go to
    the servers in /etc/resolv.conf.

Then,in your case it World be something like

    -S /batcave.dev/192.168.1.255

or on the config file

    server=/batcave.dev/192.168.1.255

Hope it helps!

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

资料来源与适用范围

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

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

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