I want to exclude some interfaces from being used by dnsmasq but I am not sure which names to actually add to the config (since there are many names for the same interfaces and the documentation doesn't give an example).
Do I have to use the actual interface/vlan names (eg. eth0/eth0.1/eth1,/eth1.2/...) or the names from the LEDE config (eg. lan/br-lan/wan/wan6/...)?
Or does adding ethX automatically include all interfaces belonging to it (e.g. add eth1 -> eth1.2/wan/wan6 are excluded too without adding them specifically)?
All interface names from "etc/config/network" seem to work (e.g. config interface 'lan', config interface 'lan4', ...), even if there is no DHCP configuration for them.
Noticed since I forgot to add my "lan4" interface to the included ones and DNS resolution stopped working on "lan4" for a day.
# nmap -p 53 192.168.1.60
Host is up (0.00052s latency).
PORT STATE SERVICE
53/tcp open domain
I've try everything, with only "interface" or only "except-interface", in config/dhcp or directly in dnsmasq.conf but nothing works, Dnsmasq seems to ignore these settings.
I'm stuck on this since yesterday and it's driving me crazy.
-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.
So I've modified /etc/init.d/dnsmasq and added --bind-interfaces manually
a) you can use /etc/dnsmasq.conf to supply additional native arguments (add a sole line bind-interfaces there)
b) I suggest to prefer (--)bind-dynamic over (--)bind-interfaces
c) The bind-dynamic option can be set in uci using option nonwildcard 1
Does anybody knows is dnsmasq UCI config (/etc/config/dhcp) supports wildcard interface names (tun+) or NOT?
I mean can I write something like (tun+) this and would it work?
config dnsmasq
option notinterface 'tun+'
I really need to exclude all VPN interfaces because DNSMASQ is trying to bind to all of them as they appear in the system.
I do not know for what purpose dnsmasq is doing this with every tunnel iface, it's very strange.
EDIT:
Answering to myself
According to dnsmasq MAN page:
A simple wildcard, consisting of a trailing '*',
can be used in --interface and --except-interface options.
I have tested the following syntax:
config dnsmasq
list notinterface 'tun*'
list notinterface 'wg*'