Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    [SOLVED] Delete all static mapping for interface

    Scheduled Pinned Locked Moved DHCP and DNS
    8 Posts 3 Posters 3.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sreyas
      last edited by

      Hi,
      We had created more than 500 static mapping for our dhcp pool. Now we need to remove all static mapping & need to reconfigure again. Is there any solution for this instead of removing one by one @ dhcp configuration page ?

      Regards
      Sreyas

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        Is that your only DHCP-enabled interface?

        If so, you can wipe the DHCP config from the command prompt using:

        pfSsh.php playback disabledhcpd
        

        That will completely remove ALL DHCP server configuration from the firewall for ALL interfaces.

        If you need to keep some settings, then your safest bet is to backup the config, edit out the settings you do not want, and then restore the backup.

        There are other ways using PHP commands and unsetting specific variables, but they are not as reliable.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • S
          sreyas
          last edited by

          No, I have 2 LAN interfaces

          1. Enabled DHCP for office users  - LAN#1
          2. Enabled DHCP with captive portal for guest users - LAN#2

          My task is to remove some range of static mapping from LAN#1 interface [if not possible I need to delete all static mapping]

          If I remove all static entries is there any way to  export a range of static entries / is it possible to edit dhcp table

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

            Not effectively.

            The closest you'll get is to backup config.xml (actually make two copies, just in case the edited one breaks), then you can copy/paste the mappings you want to keep in a new XML file and remove them from the config.xml backup copy. Then restore that config.xml.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            1 Reply Last reply Reply Quote 0
            • S
              sreyas
              last edited by

              Could you please let me know exact location for config file & where can I find dhcp related details on that file.

              1 Reply Last reply Reply Quote 0
              • jimpJ
                jimp Rebel Alliance Developer Netgate
                last edited by

                Diagnostics > Backup/Restore - download a backup from there. If you restore a backup (even an edited one), use the same page.

                In that file, the DHCP settings are under <pfsense>… <dhcpd>... <[interface name]> and the individual mappings are under <staticmap>tags. Once you look at the file it's fairly obvious.</staticmap></dhcpd></pfsense>

                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                1 Reply Last reply Reply Quote 1
                • D
                  DGordon
                  last edited by

                  @jimp
                  Thank you for sharing this, it will help, even with my home network as I have many static assigned devices.

                  @sreyas
                  Yes trying to do this one by one is very trying and time consuming - bordering on near impossible.

                  After jimp had said where the files were and their format I went and looked and realized that maybe an XML editor would be helpful, so I went and found a free opensource one at sourceforge;

                  XML Copy Editor 1.2.1.3

                  https://sourceforge.net/projects/xml-copy-editor/?source=directory

                  there is both a Linux (in .deb format) and Windows (in install .exe format) version.

                  I've just tried the Linux version and it works.

                  Most important though is to have made two or three good backups on preferably different media of the pfSense config. Then only edit one and reload and test it.

                  Take Care & Enjoy

                  1 Reply Last reply Reply Quote 0
                  • S
                    sreyas
                    last edited by

                    @Jimp
                    Thank You for your guidance, it works perfect & this is what I exactly needed.

                    @DGordon

                    Thank you  for sharing your experience, the download link helps me a lot. I had deleted all my stale entries & restored the config file. Now my box is back to normal without any issues,

                    Take care & Have an nice day. ;)

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.