User Tools

Site Tools



en:bpi-r2:network:dnsmasq

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:bpi-r2:network:dnsmasq [2020/01/11 17:44] – [dhcp-cache] franken:bpi-r2:network:dnsmasq [2023/06/08 17:06] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== DNSMASQ ======
 +
 +===== activate config-folder =====
 +
 +before own config-files in /etc/dnsmasq.d get loaded, this folder have to be activated in /etc/dnsmasq.conf by removing the sharp (#) on beginning of the following line
 +
 +  conf-dir=/etc/dnsmasq.d
 +
 +===== Interfaces =====
 +
 +The Interface-config is separated in my setup to /etc/dnsmasq.d/interfaces.conf. In this file interfaces and their Settings are defined.
 +
 +which Interfaces should respond to DHCP-Requests (binding)?
 +
 +  interface=lan0
 +  interface=wlan1
 +  #interface=tun0
 +  interface=lxcbr0
 +  interface=ap0
 +
 +which interfaces send no DHCP-answer?
 +
 +  no-dhcp-interface=eth0
 +  no-dhcp-interface=eth1
 +
 +the settings for DHCP:
 +
 +  dhcp-range=lan0,192.168.0.100,192.168.0.150,255.255.255.0,48h
 +  dhcp-option=lan0,3,192.168.0.10
 +  dhcp-range=ap0,192.168.10.100,192.168.10.150,255.255.255.0,48h
 +  dhcp-option=ap0,3,192.168.10.1
 +  dhcp-range=wlan1,192.168.11.100,192.168.11.150,255.255.255.0,48h
 +  dhcp-option=wlan1,3,192.168.11.1
 +  dhcp-range=lxcbr0,10.0.3.100,10.0.3.150,255.255.255.0,48h
 +  dhcp-option=lxcbr0,3,10.0.3.1
 +
 +dhcp-range=interface,ip-range-start,ip-range-end,netmask,lease-time
 +dhcp-option=interface,3,Default-Gateway
 +
 +Per client dns setting:
 +
 +Add set option to host between mac and ip (after name)
 +
 +  set:specialhosts
 +
 +And set dns-servers for that name
 +
 +   dhcp-option=tag:specialhosts,option:dns-server,8.8.8.8,8.8.4.4
 +
 +https://serverfault.com/questions/509388/per-client-dns-servers-with-dnsmasq
 +===== static IP for MAC =====
 +
 +DNSMASQ can answer a DHCP-Request from a specific MAC-address always with same IP-address. For that i have also created a separate config-file (/etc/dnsmasq.d/mac.conf).
 +
 +an Entry for that looks like this:
 +
 +  dhcp-host=b8:27:eb:90:e6:06,raspberry,192.168.0.2,12h
 +
 +MAC-Address of the Client, a name, the desired IP-Address and last param is the Lease-time (how long lasts the DHCP-answer => renew of IP needed)
 +
 +on wifi i have the problem, that i have 2 WIFI-APs (with different IPv4-Subnet) running on R2 and on both the same MAC-addresses can send a query. here the entry can contain the interface:
 +
 +  dhcp-host=ap0,00:25:d3:f5:32:4b,media,192.168.10.11,12h
 +  dhcp-host=wlan1,00:25:d3:f5:32:4b,media,192.168.11.11,12h
 +  
 +  
 +===== dhcp-cache =====
 +
 +  # service dnsmasq stop
 +  Stopping DNS forwarder and DHCP server: dnsmasq.
 +  # nano /var/lib/misc/dnsmasq.leases
 +  # service dnsmasq start
 +  Starting DNS forwarder and DHCP server: dnsmasq.