# cat /etc/dnsmasq.conf dhcp-authoritative server=192.168.1.6 log-facility=/var/log/dnsmasq.log log-queries local=/example.com/ domain=example.com # cat /etc/dnsmasq.conf | grep "^dhcp-host" | awk -v OFS="\t" -F "," '{print $3, $2}' | sort -k2 > /etc/hosts.pre addn-hosts=/etc/hosts.pre # DHCP dhcp-range=192.168.1.150,192.168.1.200,255.255.255.0,1d dhcp-option=option:router,192.168.1.6 dhcp-option=option:ntp-server,217.7.239.199 # DNS dhcp-option=option:dns-server,1.1.1.1,8.8.8.8 # PXE dhcp-boot=undionly.kpxe,srv,192.168.1.9 dhcp-boot=net:sip,http://srv/snom3x0/snom3x0.xml,srv,192.168.1.9 dhcp-boot=net:ts,ltsp/amd64/pxelinux.0,ts,192.168.1.159 # Clients dhcp-host=00:00:00:00:00:03,www,192.168.1.3 dhcp-host=00:00:00:00:01:70,mx,192.168.1.170 # LTSP dhcp-host=00:01:02:03:04:11,workstation1,192.168.1.79,net:ts dhcp-host=00:01:02:03:04:22,workstation2,192.168.1.80,net:ts # SIP dhcp-host=00:11:22:33:44:01,juri.sip,192.168.1.210,net:sip # CNAME cname=www.example.com,www cname=mail,mx #dhcp-host=00:00:00:00:00:03,host1:specialhosts,192.168.1.3 #dhcp-option=tag:specialhosts,option:dns-server,192.168.1.6 expand-hosts #no-poll domain-needed #bogus-priv #no-resolv # Gateway #dhcp-option=tag:gateway1,3,192.168.1.6 #dhcp-option=tag:gateway2,3,192.168.1.253 #dhcp-host=set:gateway1,00:1A:4D:49:80:C2,192.168.1.111,12h #dhcp-host=set:gateway2,00:1A:4B:6F:C6:65,192.168.1.121,12h # test # redirect all ? address=/#/192.168.2.1 dhcp-range=interface:eth0,192.168.1.128,192.168.1.254,24h dhcp-range=interface:eth1,192.168.2.128,192.168.2.254,24h interface=eth1 dhcp-authoritative domain-needed bogus-priv #no-resolv #server=10.0.254.254@ens10 server=192.168.33.33 local=/dev/ domain=dev #dhcp-range=10.0.0.0,static dhcp-range=192.168.33.100,192.168.33.200,255.255.255.0,1d dhcp-option=option:ntp-server,192.168.33.33 dhcp-option=option:router,192.168.33.33 dhcp-option=option:classless-static-route,0.0.0.0/0,10.0.0.1,172.16.0.0/21,10.0.0.253 #dhcp-boot=pxelinux.0 dhcp-boot=undionly.kpxe enable-tftp tftp-root=/srv/tftp/fai log-dhcp log-queries log-facility=/var/log/dnsmasq.log
Options
ttps://blog.abysm.org/2020/06/human-readable-dhcp-options-for-dnsmasq/
dnsmasq --help dhcp http://oss.segetech.com/intra/srv/dnsmasq.conf dhcp-option=tag:d1-mgmt-dev,option:domain-name,dev.example.com # testme dhcp-host=11:22:33:44:55:66,ignore dhcp-script=/var/lib/dnsmasq/dhcp-script.sh addn-hosts=/tag:mgmt-dev,etc/dnsmasq.hosts
DHCP by circuitid
# Switch Mac dhcp-remoteid=set:aurora-1,00:06:00:15:62:a7:64:00 # Port Vlan and ID dhcp-circuitid=set:vlan-500-port-1,00:04:01:f4:00:00 dhcp-circuitid=set:vlan-500-port-2,00:04:01:f4:00:01 dhcp-circuitid=set:vlan-500-port-3,00:04:01:f4:00:02 dhcp-circuitid=set:vlan-500-port-4,00:04:01:f4:00:03 dhcp-circuitid=set:vlan-500-port-5,00:04:01:f4:00:04 dhcp-option=option:router,192.10.101.1 dhcp-option=option:dns-server,192.10.96.192,192.10.96.193 #Statics dhcp-range=tag:aurora-1,tag:vlan-500-port-1,set:locked,192.10.101.242,192.10.101.242,255.255.255.0,192.10.101.255,10m dhcp-range=tag:aurora-1,tag:vlan-500-port-3,set:locked,192.10.101.243,192.10.101.243,255.255.255.0,192.10.101.255,10m dhcp-range=tag:aurora-1,tag:vlan-500-port-5,set:locked,192.10.101.245,192.10.101.245,255.255.255.0,192.10.101.255,10m #Default dhcp-range=tag:!locked,192.10.101.230,192.10.101.239,255.255.255.0,10m ## v2 ############################ dhcp-circuitid=set:dc1-e2-rack10,01:03:72:31:30 # String configured on Relay: r10 dhcp-circuitid=set:dc1-e2-rack11,01:03:72:31:31 # String configured on Relay: r11 dhcp-circuitid=set:dc1-e2-rack12,01:03:72:31:32 # String configured on Relay: r12 # Rack specific IPMI ranges, based on tags dhcp-range=tag:dc1-e2-rack12,set:dc1-ipmi-dev,10.32.99.100,10.32.99.200,255.255.240.0,72h dhcp-range=tag:dc1-e2-rack11,set:dc1-ipmi-dev,10.32.98.100,10.32.98.200,255.255.240.0,72h dhcp-range=tag:dc1-e2-rack10,set:dc1-ipmi-dev,10.32.97.100,10.32.97.200,255.255.240.0,72h # Options for dc1 dev-ipmi ranges dhcp-option=tag:dc1-ipmi-dev,option:classless-static-route,0.0.0.0/0,10.32.96.1,10.32.0.0/16,10.32.96.1 dhcp-option=tag:dc1-ipmi-dev,option:domain-name,ipmi.example.com # Rack specific MGMT ranges, based on tags dhcp-range=tag:dc1-e2-rack12,set:dc1-mgmt-dev,10.33.99.100,10.33.99.200,255.255.240.0,72h dhcp-range=tag:dc1-e2-rack11,set:dc1-mgmt-dev,10.33.98.100,10.33.98.200,255.255.240.0,72h dhcp-range=tag:dc1-e2-rack10,set:dc1-mgmt-dev,10.33.97.100,10.33.97.200,255.255.240.0,72h # Options for all dev-mgmt ranges dhcp-option=tag:dc1-mgmt-dev,option:classless-static-route,0.0.0.0/0,10.33.96.1,10.33.0.0/16,10.33.96.1 dhcp-option=tag:dc1-mgmt-dev,option:domain-name,example.com
Links
http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html
https://wiki.archlinux.org/index.php/dnsmasq
https://www.g-loaded.eu/2010/09/18/caching-nameserver-using-dnsmasq/
https://oss.segetech.com/intra/srv/dnsmasq.conf
https://blog.zumbi.com.ar/using-dnsmasq-and-unbound-at-the-same-time.html