custom DHCP with dnsmasq.conf.add

2026-06-16

dnsmasq.png On Asus-Merlin, extra custom DHCP assignments can be added without touching the main config. Three methods are available :

  • Based on device name
  • Based on MAC address with optional tag
  • Multiple MAC addresses for a single machine (e.g. laptop with Wi-Fi + Ethernet)

Setup

Edit or create a dnsmasq.conf.add file — it will be automatically merged into dnsmasq.conf at boot. The file lives in /jffs/configs/ :

vi /jffs/configs/dnsmasq.conf.add

After saving, restart the dnsmasq service to apply immediate changes (no reboot needed) :

service restart_dnsmasq

Examples

Assign a fixed IP by device name

dhcp-host=My-Laptop,192.168.0.10
dhcp-host=My-Mobile,192.168.0.11

The name must match the hostname the device sends in its DHCP request.

Assign a fixed IP by MAC address

dhcp-host=AA:BB:CC:DD:EE:FF,192.168.0.20,my-desktop,12h

Format : MAC,IP,hostname,lease-duration

Assign a fixed IP to a device on a specific VLAN (with tag)

dhcp-host=BB:CC:DD:EE:FF:AA,set:guest1,192.168.2.100,tapo-cam,12h

set:guest1 assigns the device to the guest1 tag, useful for VLAN-based rules.

for example, we can force another DNS (like Cloudflare malware-secured one : 1.1.1.2/1.0.0.2, or Cloudflare adult+malware-secured : 1.1.1.3/1.0.0.3)

Option 6 is for DNS (primary + secondary)

dhcp-option=tag:guest1,6,1.1.1.2,1.0.0.2

Multiple MAC addresses for one machine

Useful when a device has both a wired and a wireless interface and you want them to always get the same IP :

dhcp-host=AA:BB:CC:DD:EE:FF,11:22:33:44:55:66,192.168.0.50

Both MACs will resolve to 192.168.0.50.

Full example

# Fixed IP by hostname
dhcp-host=My-Mobile,192.168.0.7
dhcp-host=DESKTOP001,192.168.0.121
 
# Fixed IP by MAC + VLAN tag
dhcp-host=BB:CC:DD:EE:FF:AA,set:guest1,192.168.2.100,tapo-garden,12h
dhcp-host=CC:DD:EE:FF:AA:BB,set:guest1,192.168.2.101,tapo-kitchen,12h
 
# Multiple MACs → same IP
dhcp-host=AA:BB:CC:DD:EE:FF,11:22:33:44:55:66,192.168.1.50

Tips

  • The lease duration (12h, 24h, infinite) is optional — omit it to use the router default
  • Use nslookup or cat /var/lib/misc/dnsmasq.leases to verify assignments