Beschränken des DHCP-Servers von dnsmasq auf eine Schnittstelle


11

Wie konfiguriere ich dnsmasq, dass nur Adressen zugewiesen werden eth0, nicht wlan0?

Antworten:


13

Die Manpage erklärt es ganz nett. Wenn es sich nur um DHCP handelt, auf dem Sie nicht ausgeführt werden möchten, wlan0können Sie es verwenden --no-dhcp-interface=wlan0. Wenn Sie nicht möchten, dass dnsmasq überhaupt zuhört wlan0, können Sie verwenden --except-interface=wlan0.

Wenn Sie nur möchten, dass dnsmasq abhört, eth0können Sie verwenden --interface=eth0.


12

Für diejenigen, die mich mögen, ist es verwirrend, warum Port 53 immer noch für alle Schnittstellen geöffnet ist, unabhängig davon, welche Option Sie eingeben, um es einzuschränken. Es gibt noch eine Option, die aktiviert werden muss.

-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.


Dies ist genau die Art von Dingen, die leicht zu übersehen sind, aber es ist der Schlüssel, damit es mit anderen DHCP-Lösungen (wie in meinem Fall einem internen QNAP-Dienst) funktioniert. Jemand sollte die drei Hauptantworten nehmen und zusammenführen. Das hat mir den Tag gerettet, danke
Danielo515

11

Dies ist auch in der Konfigurationsdatei dnsmasq möglich und in der Beispieldatei von Simon Kelley unter http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example dokumentiert :

# 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=
Durch die Nutzung unserer Website bestätigen Sie, dass Sie unsere Cookie-Richtlinie und Datenschutzrichtlinie gelesen und verstanden haben.
Licensed under cc by-sa 3.0 with attribution required.