Suggestions for a long list of DHCP Static Mappings
-
When I first stated using PFS, I had a modest number of hosts in the Mappings file. But as time went on and projects have come and gone, but might come back, the file is now nearly 150 names long.
I know about exporting the list, modify the json and reload trick and that works well for big changes.
Does anyone have a suggestion to better handle the day to day changes and updates? Having to first scroll through DHCP Server lines for the LAN in order to get the the long list of DHCP Static lines is getting tedious. Has some one come up with a short cut?
-
@preese to add a new entry sure you can just go to your url directly for the interface your wanting to edit
https://sg4860.home.arpa:8443/services_dhcp_edit.php?if=opt9
Where that if=opt9 in my case is my dmz network, so you could edit a bookmark to reflect the interface..
To go directly to add a new entry for my lan, I would go here
https://sg4860.home.arpa:8443/services_dhcp_edit.php?if=lan
see how if=lan for your lan
Now editing a specific old entry you could just jump directly there with something like this
https://sg4860.home.arpa:8443/services_dhcp_edit.php?if=opt8&id=8
but problem is - the idX would be the order that the entries were added.. So kind of hard to know exactly, but you could create shortcuts to the ones you update a reg basis, etc. And naming the bookmark something more identifiable for yourself.
-
Thanks Johnpoz for your reply. The suggestions do work and you've outlined the limitations
After asking the question and seeing your answer, I thought of a clearer, more straight forward question.
The DHCP static entry has three basic components, IP, MAC and name, and there is a comment field. Most often I have at least one of these but need to know the others. The 'host' command plays well to get two of the three. Does anyone know of a similar way to get the MAC addr quickly? Something specific to PFS?
Usually I'm setting up a set of VMs and need to prepopulate the MAC address so the VM gets a specific address and linked name when it is created. I was just hoping for an easier way to juggle those three important bits.
-
@preese said in Suggestions for a long list of DHCP Static Mappings:
similar way to get the MAC addr quickly?
Of what, do you know the IP or fqdn, you can just query the arp table
something like
[23.09.1-RELEASE][admin@sg4860.home.arpa]/root: arp -a | grep nas.home.arpa nas.home.arpa (192.168.9.10) at 00:11:32:7b:29:7d on igb0 permanent [ethernet] [23.09.1-RELEASE][admin@sg4860.home.arpa]/root:
Or you mean in your vm.. until the device has been online pfsense would not know the mac.. You can look in your vm software for what mac a device is going to use before it even boots.
-
Ah that looks promising Johnpoz! I use Vagrant and/or Cockpit to build projects. I take an existing IP/MAC entry and use that MAC as I edit the Vagrantfile or confi the VM so I know what IP and name it will have.
I'm not sure how fast the arp table turns over but I sure will give it a try! Thanks for the follow up!
-
@preese pfsense out of the box will cache an arp entry for 20 minutes.
-
Hmm, that might be a little too quick. I often retest projects after a week or more. Still, you've made two helpful suggestions. I'm a little surprised others haven't experienced similar issues and frustrations. But since everything does work, a little extra scrolling is really just a first world problem.