Posted: Mon Mar 29, 2021 19:20 Post subject: Static IP assignments via file
Can anyone provide me some help?
I'd like to build a text file that includes all of my static mappings, and apply them on bootup instead of assigning them manually via the GUI.
Does anyone have an example or maybe point me in the right direction? I'm sure it has to do with dhcpd options, but I'm unsure how to format the file and where to place it on the router so it picks it up.
Thanks in advance! _________________ ASUS RT-AC3100 AP Merlin 386.12_4
ASUS RT-AC68U Media Bridge/Merlin 386.12_4 (x2)
ASUS RT-AC68U AP r54604
ASUS RT-AC68U Gateway/AP r54604
Edgerouter-4, v2.0.9-hotfix7
Thanks! I have the file built on /jffs but the router is not reading the file, and I have put the line in the Additional DNSMasq options area. If I do a cat /tmp/dnsmasq.conf, the configs are not listed. How does this work? In the dnsmasq.conf file there is a line that reads dhcp-leasefile=/tmp/dnsmasq.leases Do I need to edit that file as well???
Is there a way to see if the router has imported the file? or does it just check once that client joins?
Thanks for the help with this. _________________ ASUS RT-AC3100 AP Merlin 386.12_4
ASUS RT-AC68U Media Bridge/Merlin 386.12_4 (x2)
ASUS RT-AC68U AP r54604
ASUS RT-AC68U Gateway/AP r54604
Edgerouter-4, v2.0.9-hotfix7
My suggestions assume you have at least one or more static leases defined in the GUI that can be exported. If you do, and issue the following command ...
Code:
grep dhcp-host /tmp/dnsmasq.conf
... you should see one or more dhcp-host directives dumped to the command line.
My suggestions assume you have at least one or more static leases defined in the GUI that can be exported. If you do, and issue the following command ...
Code:
grep dhcp-host /tmp/dnsmasq.conf
... you should see one or more dhcp-host directives dumped to the command line.
If this the case?
Yes. I was able to follow the directions you sent previously to export what I had, then added to the file, and saved to /jffs/dnsmasq.custom. _________________ ASUS RT-AC3100 AP Merlin 386.12_4
ASUS RT-AC68U Media Bridge/Merlin 386.12_4 (x2)
ASUS RT-AC68U AP r54604
ASUS RT-AC68U Gateway/AP r54604
Edgerouter-4, v2.0.9-hotfix7
Then if you add the following to Additional DNSMasq Options the following ...
Code:
conf-file=/jffs/dnsmasq.custom
.. you should see that directive (NOT the dhcp-host directives) in /tmp/dnsmasq.conf once dnsmasq is restarted. And DNSMasq should be using the static leases at that point.
Then if you add the following to Additional DNSMasq Options the following ...
Code:
conf-file=/jffs/dnsmasq.custom
.. you should see that directive (NOT the dhcp-host directives) in /tmp/dnsmasq.conf once dnsmasq is restarted. And DNSMasq should be using the static leases at that point.
Of course, you'll probably have to reboot both the router and affected clients to see the effects.
Okay. Thats how I have it configured, but only had one client plugged in. I guess we'll see what happens when I add the other clients back in. Thanks for the help!!
Edit: just another thought. I also have other commands as well... would that make any difference?
No-resolv and preferred dns servers... _________________ ASUS RT-AC3100 AP Merlin 386.12_4
ASUS RT-AC68U Media Bridge/Merlin 386.12_4 (x2)
ASUS RT-AC68U AP r54604
ASUS RT-AC68U Gateway/AP r54604
Edgerouter-4, v2.0.9-hotfix7
The file pointed to by conf-file can contain any DNSMasq directives you want. In fact, you can have *multiple* conf-file directives pointing to other files as well.
does the custom config replace /tmp/dnsmasq.conf? - should I copy the contents into the /jffs/dnsmasq.custom and then add my leases? _________________ ASUS RT-AC3100 AP Merlin 386.12_4
ASUS RT-AC68U Media Bridge/Merlin 386.12_4 (x2)
ASUS RT-AC68U AP r54604
ASUS RT-AC68U Gateway/AP r54604
Edgerouter-4, v2.0.9-hotfix7
By default, dnsmasq will use /etc/dnsmasq.conf for the configuration file. But you can override it w/ the -C/--conf-file argument on the command line, as dd-wrt does.
But dnsmasq also allows any config file to include references to other config files using the same option. That's what you're doing when you add your own conf-file directive to Additional DNSMasq Options.
Everything is working a-ok! Thanks for the help I really appreciate it.
Cheers! _________________ ASUS RT-AC3100 AP Merlin 386.12_4
ASUS RT-AC68U Media Bridge/Merlin 386.12_4 (x2)
ASUS RT-AC68U AP r54604
ASUS RT-AC68U Gateway/AP r54604
Edgerouter-4, v2.0.9-hotfix7