我该如何配置dnsmasq
才能仅分配地址eth0
,而不是wlan0
?
答案1
这手册页解释得很好。如果您只是不想运行 DHCP,wlan0
那么您可以使用--no-dhcp-interface=wlan0
。如果您根本不想让 dnsmasq 监听,wlan0
那么您可以使用--except-interface=wlan0
。
如果您只想让 dnsmasq 监听,eth0
那么您可以使用--interface=eth0
。
答案2
对于那些像我一样感到困惑的人来说,为什么无论你输入哪个选项来限制端口 53,它仍对所有接口开放。还有一个选项需要打开。
-z, --bind-interfaces On systems which support it, dnsmasq binds the wildcard address, even when it is listening on only some interfaces. It then discards requests that it shouldn't reply to. This has the advantage of working even when interfaces come and go and change address. This option forces dnsmasq to really bind only the interfaces it is listening on. About the only time when this is useful is when running another nameserver (or another instance of dnsmasq) on the same machine. Setting this option also enables multiple instances of dnsmasq which provide DHCP service to run in the same machine.
答案3
这也可以从 dnsmasq 配置文件中实现,并记录在 Simon Kelley 的示例文件中http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example:
# 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=
# Or you can specify which interface _not_ to listen on
#except-interface=