DNSmasq配置DHCP Server

单网段配置

interface=ens192
listen-address=192.168.0.240
dhcp-range=192.168.0.100,192.168.0.199,255.255.255.0,3600s
dhcp-option=option:router,192.168.0.1
dhcp-option=option:dns-server,192.168.0.1,192.168.0.230
dhcp-host=00:50:56:2C:DA:FE,192.168.0.200

多网段配置

interface=eth0
listen-address=192.168.0.240
dhcp-range=eth0,192.168.0.100,192.168.0.199,255.255.255.0,3600s
dhcp-option=eth0,option:router,192.168.0.1
dhcp-option=eth0,option:dns-server,192.168.0.1,192.168.0.230

interface=eth1
listen-address=192.168.1.2
dhcp-range=eth1,192.168.1.100,192.168.1.199,255.255.255.0,3600s
dhcp-option=eth1,option:router,192.168.1.1
dhcp-option=eth1,option:dns-server,114.114.114.114,114.114.115.115

interface=eth2
listen-address=192.168.2.2
dhcp-range=interface:eth2,192.168.2.100,192.168.2.199,255.255.255.0,3600s
dhcp-option=interface:eth2,option:router,192.168.2.1
dhcp-option=interface:eth2,option:dns-server,114.114.114.114,114.114.115.115

为设备分配指定IP

dhcp-host=00:50:56:2C:DA:FE,192.168.0.200

指定网卡接口的两种写法

dhcp-range=ap0,192.168.12.20,192.168.12.150,255.255.255.0,12h
dhcp-range=ap1,192.168.13.20,192.168.13.150,255.255.255.0,12h

dhcp-range=interface:ap0,192.168.12.20,192.168.12.150,255.255.255.0,12h
dhcp-range=interface:ap1,192.168.13.20,192.168.13.150,255.255.255.0,12h

DNSmasq前台运行(DEBUG模式)
dnsmasq -d

来源:
https://blog.csdn.net/weixin_40911652/article/details/85110455
https://bbs.csdn.net/topics/392052459
https://blog.csdn.net/lux_veritas/article/details/41702505
https://serverfault.com/questions/952220/dnsmasq-on-2-interfaces