0

I have a pfSense router that handles some labs. It is configured such that DHCP only hands out IP addresses for machines listed in the static IP/MAC bindings list.

Whenever we upgrade a lab with new machines, I have to manually remove all of the old machines one-by-one, clicking the delete icon beside each entry. To make matters worse, I have to scroll down to the bottom of the page after each entry is removed!

Then I have to painstakingly add all of the new bindings, one-by-one, again, scrolling down to the bottom of the page after each addition.

If I have all of the MACs and IPs in a list, is there any way that is already built into pfSense to make all of these changes at once without have to work with each record individually? Perhaps something like a multi-line text box that would let me dump csv data in that could be parsed to update all entries at once?

b_laoshi
  • 103
  • 5

2 Answers2

1

Yes, you can achieve this by following the below steps:

  1. Navigating to Diagnostics -> Backup & Restore.
  2. Select the options as below: Configuration Options

  3. Click on download configuration as XML.

Now you can make changes to the file and restore this again.

If you want to, you can convert your xml file to csv to edit the mappings and convert csv to xml again when you are ready to upload.

To delete all the existing mappings, I think(I'm not sure) disabling the service DHCP service on the particular interface will do it for you.

HawkEye
  • 128
  • 9
  • It's not what I was hoping for, but it's good enough for me! Yes, to delete all of the existing mappings, restarting the DHCP server should be sufficient. I've noticed that when I stop the DHCP server, my machines lose their IP addresses relatively quickly. – b_laoshi Nov 09 '18 at 05:24
0

I made a tool using python specifically for this task. You can found it here. I hope It might be useful to somebody in the future. Works with a CSV file in format of:

Name,MAC address,Static IPv4 Address,Enabled - header of CSV Linux_server,a8:a1:59:64:32:86,192.160.21.48,true - 1 line is 1

Another project with similar functions: https://github.com/cjnaz/dhcpcsv2pfsense

miksolo
  • 1
  • 1