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

    DHCP Mod to allow static mappings inside a DHCP range

    Scheduled Pinned Locked Moved DHCP and DNS
    11 Posts 5 Posters 6.0k 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.
    • B
      BlackSpark
      last edited by

      Before starting to write about the subject I must first pull everyone's attention to this FAQ. (be sure to read it first)

      All because I want to make sure that those who are not aware of this issue to take it into account,
      and also to let know those who are that I'm well aware of the implications.

      Based on the last paragraph of the answer I decided to make a mod of the webConfigurator, so it would have an option to let a DHCP range to overlap static mappings, overriding the built in protection when enabled. In hopes that will be useful to anyone else I'm hereby sharing this mod. Use it carefully and at your own responsibility.

      The following is as screenshot showing the visual change on the DHCP Server configuration page of pfSense:

      Attached to this post you'll find a zip file (pfSense_2.0_RC3_DHCP_Mod) (pfSense_2.0_RELEASE_DHCP_Mod) containing 6 files related to this mod:
      (As for security reasons upload of zip files are not allowed I renamed the extension of the file to txt. Just rename it back to zip.)

      • services_dhcp.php

      • services_dhcp.php.diff

      • services_dhcp.php.orig

      • services_dhcp_edit.php

      • services_dhcp_edit.php.diff

      • services_dhcp_edit.php.orig

      The files with 'orig' extension are the original unmodified files existing in pfSense [2.0-RC3 (i386) built on Fri Jul 1 00:16:18 EDT 2011] [2.0-RELEASE (i386) built on Tue Sep 13 17:28:43 EDT 2011], the files with 'php' extensions are the already modified ones,  and the 'diff' files are the patches you can apply to modify the ones existing in your own pfSense.

      I'm not getting into any details on how to apply the patch files. If you don't know how to, most probably you shouldn't even be considering using this mod in first place.

      If you're still using pfSense 2.0-RC2 it should be safe to apply the patches since the two targeted files ('services_dhcp.php' and 'services_dhcp_edit.php') have not changed since then, at least not that I'm aware of. (files have changed meanwhile and the updated mod should not be used in previous versions)

      Just copy the diff files to the place where the target files are located (/usr/local/www) and apply the patch. That's it! You're done.

      You'll then find a new option in the DHCP server configuration page just like in the screenshot that will allow the DHCP range to overlap the static mappings.

      If you want to know what changes will be made to the aforementioned files before patching them, open the attached files on this post in a text editor of your preference, compare the 'php' with the 'orig' files and/or use the 'diff' files as a reference.

      Please be aware that every time you update pfSense, the patched files will be replaced with the pfSense original ones and you'll need to apply the patches again after that. Also notice that if the original 'services_dhcp.php' and 'services_dhcp_edit.php' files get modified by the developers in the future, you'll not be able to use the current patches anymore. Instead you'll need to make the necessary changes manually and create new diff files to be used later.

      Like stated before I hope this is useful to anyone. Any comments, considerations, suggestions, etc are most welcome.

      And (I can't stress this enough :P) be sure to use this mod carefully and at your own risk.

      Edit:
      Rapidshare download -> pfSense_2.0_RELEASE_DHCP_Mod.zip

      pfsens_dhcp_mod.jpg
      pfsens_dhcp_mod.jpg_thumb
      pfSense_2.0_RELEASE_DHCP_Mod.txt

      1 Reply Last reply Reply Quote 0
      • D
        Darkk
        last edited by

        Cool idea.  Can this be added as a package so anybody can use it?

        1 Reply Last reply Reply Quote 0
        • P
          pulsemedia
          last edited by

          the zip does not work ??? it says the archive is broken.

          but this should totally be included in pfsense 2 release! lazy admins dont want to change files anytime ;-)

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

            @pulsemedia:

            but this should totally be included in pfsense 2 release! lazy admins dont want to change files anytime ;-)

            Features for 2.0 were frozen quite some time ago, and I'm not sure we'd take this. It's best as a package. It's not something that should be encouraged.

            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
            • P
              pulsemedia
              last edited by

              @jimp:

              @pulsemedia:

              but this should totally be included in pfsense 2 release! lazy admins dont want to change files anytime ;-)

              Features for 2.0 were frozen quite some time ago, and I'm not sure we'd take this. It's best as a package. It's not something that should be encouraged.

              maybe you're right. so could someone who knows how to make packages consider this mod?

              have any others problems with this zip archive also?

              1 Reply Last reply Reply Quote 0
              • P
                pulsemedia
                last edited by

                hello anyone? ???

                1 Reply Last reply Reply Quote 0
                • N
                  NOYB
                  last edited by

                  @Nuno:

                  Any comments, considerations, suggestions, etc are most welcome.

                  I'd reword it slightly to be more concise.

                  Allow DHCP Reservations with-in DHCP Range
                  Warning: Read this before enabling this option!  Also before disabling this option, all DHCP reservations must be removed from with-in the DHCP Range.

                  WinZip:
                  error [C:<path>\pfSense_2.0_RC3_DHCP_Mod.zip]: start of central directory not found; Zip file corrupt.
                  Possible causes: file transfer error.</path>

                  1 Reply Last reply Reply Quote 0
                  • B
                    BlackSpark
                    last edited by

                    Sorry folks, I didn't notice the zip got corrupted while uploading.

                    Anyway I had to update the diff files since the original php files changed meanwhile.
                    I uploaded a new zip file and everything should be fine now.

                    @jimp:

                    It's best as a package. It's not something that should be encouraged.

                    He's absolutely right but at the moment I do not have the time to learn how to build a package and do it myself.

                    @NOYB:

                    I'd reword it slightly to be more concise.

                    Allow DHCP Reservations with-in DHCP Range
                    Warning: Read this before enabling this option!  Also before disabling this option, all DHCP reservations must be removed from with-in the DHCP Range.

                    Well, it's a looong warning! lol For the time being I didn't change it. Maybe some other time.
                    "DHCP Reservations" would not be a good rewording as they are not reservations but static mappings.
                    Otherwise, if they were reservations indeed, the problem wouldn't exist in first place.
                    Also the static mappings don't need to be removed necessarily. They can simply be edited so they don't overlap the pool.
                    Anyway I must agree that a rewording should/could be done.

                    1 Reply Last reply Reply Quote 0
                    • P
                      pulsemedia
                      last edited by

                      thanks for reupload, but for me the new archive is still broken  :-\

                      maybe you should choose another way to upload the file e.g. mediafire.com?

                      1 Reply Last reply Reply Quote 0
                      • B
                        BlackSpark
                        last edited by

                        @pulsemedia:

                        thanks for reupload, but for me the new archive is still broken  :-\

                        maybe you should choose another way to upload the file e.g. mediafire.com?

                        Huh… Don't know what to say. I just downloaded it, renamed the extension from "txt" to "zip" and everything's fine.
                        Nevertheless I added a rapidshare download link. Try that one instead.

                        1 Reply Last reply Reply Quote 0
                        • P
                          pulsemedia
                          last edited by

                          @Nuno:

                          @pulsemedia:

                          thanks for reupload, but for me the new archive is still broken  :-\

                          maybe you should choose another way to upload the file e.g. mediafire.com?

                          Huh… Don't know what to say. I just downloaded it, renamed the extension from "txt" to "zip" and everything's fine.
                          Nevertheless I added a rapidshare download link. Try that one instead.

                          yay! finally got it :-)
                          thx

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