Adding a lot of DHCP Static Mapping entries via CLI



  • Hello all im moving from Toastman's Tomato firmware to PFSense.
    I have lots of DHCP Static Mappings that i entered via the CLI and have saved in notepad.
    This is the following format used by Toastman's Tomato firmware

    nvram set dhcpd_static="XX:XX:XX:XX:XX:XX<192.168.1.2<computer#2<1>YY:YY:YY:YY:YY:YY<192.168.1.3<computer#3<1>"

    I have around 50 entries saved in notepad

    Is there a similar method in doing this in PFSense?

    I searched around and couldnt find much

    Nothing in the manual
    https://doc.pfsense.org/index.php/DHCP_Server#Static_IP_Mappings

    Nothing in the forum search that helped
    https://forum.pfsense.org/index.php?action=search2

    Thanks in advance</computer#3<1></computer#2<1>



  • I made mention of this a couple of posts back. Your firewall config is held in /cf/conf/config.xml. The DHCP section has entries for 'staticmap', which define all the DHCP static mappings set within the firewall. You can edit this directly, following the formatting shown in any existing examples you can find in the config (if not, create a test static map entry to see what this looks like). Once you have finished editing the config file, you can run /etc/rc.reload_all to activate the changes you've made.

    I probably don't need to mention that you should take a backup of your config.xml file before making any direct changes.