Dnsmasq 没有提供第二个 DNS

Dnsmasq 没有提供第二个 DNS

在 MacOS 10.12.6 上使用 Homebrew 运行 Dnsmasq 2.79 版。这是我的 dnsmasq 配置:

# Never forward plain names (without a dot or domain part)
domain-needed

# Never forward addresses in the non-routed address spaces.
bogus-priv

# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
interface=en4

# Always allocate the host with Ethernet address 11:22:33:44:55:66
# The IP address 192.168.0.60

<bunch of hosts>


# Do the same thing, but using the option name
dhcp-option=option:router,192.168.2.1
dhcp-option=option:ntp-server,192.168.2.1
dhcp-option=6,192.168.2.1,8.8.8.8,8.8.4.4

# Log lots of extra information about DHCP transactions.
log-dhcp

重要的部分是选项部分。我试图实现我的 DHCP 客户端配置三个 DNS 服务器:192.168.2.1 和两个 Google 服务器。但是,当我嗅探来自此服务器的 DHCP 流量时,我得到了以下结果:

---------------------------------------------------------------------------

  TIME: 2018-05-21 17:40:37.454
    IP: 192.168.2.1 (f6:5c:89:ca:e0:64) > 192.168.2.30 (0:50:b6:22:8e:6e)
    OP: 2 (BOOTPREPLY)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: 80916f1c
  SECS: 0
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 192.168.2.30
SIADDR: 192.168.2.1
GIADDR: 0.0.0.0
CHADDR: 00:50:b6:22:8e:6e:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         5 (DHCPACK)
OPTION:  54 (  4) Server identifier         192.168.2.1
OPTION:  51 (  4) IP address leasetime      43200 (12h)
OPTION:  58 (  4) T1                        21600 (6h)
OPTION:  59 (  4) T2                        37800 (10h30m)
OPTION:   1 (  4) Subnet mask               255.255.255.0
OPTION:  28 (  4) Broadcast address         192.168.2.255
OPTION:   3 (  4) Routers                   192.168.2.1
OPTION:   6 (  4) DNS server                192.168.2.1
OPTION:  12 (  8) Host name                 aimdroid
OPTION:  42 (  4) NTP servers               192.168.2.1
---------------------------------------------------------------------------

仅报告一个 DNS 服务器。这里出了什么问题?

答案1

这适用于 pi-hole(基于 dnsmasq,应该是完全相同的配置):

dhcp-option=option:dns-server,10.0.0.5,10.0.0.10

不确定为什么您的示例不起作用 - 它似乎是正确的。您是否尝试过只使用 2 个而不是 3 个服务器 IP?

相关内容