如何配置dnsmasq
为仅分配地址eth0
,而不分配wlan0
?
如何配置dnsmasq
为仅分配地址eth0
,而不分配wlan0
?
Answers:
对于像我这样的人来说,他们困惑为什么为什么对所有接口仍然打开端口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.
这也可以从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=