Ograniczanie serwera DHCP dnsmasq do jednego interfejsu


12

Jak skonfigurować, dnsmasqaby przypisywać tylko adresy eth0, a nie wlan0?

Odpowiedzi:


14

Strona podręcznika opisuje go całkiem przyjemnie. Jeśli to tylko DHCP, na którym nie chcesz uruchamiać wlan0, możesz użyć --no-dhcp-interface=wlan0. Jeśli nie chcesz, aby dnsmasq w ogóle nasłuchiwał wlan0, możesz użyć --except-interface=wlan0.

Jeśli chcesz, aby dnsmasq nasłuchiwał eth0, możesz użyć --interface=eth0.


12

Dla tych, którzy mnie lubią, mylą się, dlaczego port 53 jest nadal otwarty dla wszystkich interfejsów, niezależnie od tego, którą opcję ograniczysz. Jest jeszcze jedna opcja, którą należy włączyć.

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


Jest to dokładnie rzecz, którą łatwo przeoczyć, ale jest kluczowa, aby działała z innymi rozwiązaniami DHCP (jak w moim przypadku z wewnętrznymi usługami QNAP). Ktoś powinien wziąć trzy główne odpowiedzi i połączyć je. To uratowało mi dzień, dzięki
Danielo515

11

Jest to również możliwe z pliku konfiguracyjnego dnsmasq i jest udokumentowane w przykładowym pliku Simona Kelleya pod adresem 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=
Korzystając z naszej strony potwierdzasz, że przeczytałeś(-aś) i rozumiesz nasze zasady używania plików cookie i zasady ochrony prywatności.
Licensed under cc by-sa 3.0 with attribution required.