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

    DHCP hostname sub-domain issue

    Scheduled Pinned Locked Moved General pfSense Questions
    2 Posts 2 Posters 2.1k 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.
    • U
      UnderCover
      last edited by

      On the DHCP server section when I try to add MAC address reservations with hostnames with subdomains it says they are invalid (where it worked in the old configuration)

      for example my main domain is example.com  so to reserve a client for that i would type in hostname client1  and the firewall would append example.com

      but if i have a sub domain department1.example.com and I would need to reserve the client with a hostname of client2.department1 and the firewall would append example.com

      in 1.2.3  this worked great in 2.0 i get the error

      The following input errors were detected:

      A valid hostname is specified, but the domain name part should be omitted

      1 Reply Last reply Reply Quote 1
      • J
        joelwhitehouse
        last edited by

        I upgraded a pfsense box from 1.2.3 to 2.0 and ran into this error when I tried to update some legacy static leases that used "subdomain.domain" notation.  I resolved it by commenting out the PHP code that generates this error.

        To disable the offending PHP code:

        • Enable SSH (System->Advanced->Enable Secure Shell)

        • SSH into your pfsense box.

        • Backup the php file: (cp /usr/local/www/services_dhcp_edit.php /usr/local/www/services_dhcp_edit.php.orig)

        • Open the php file: (vi /usr/local/www/services_dhcp_edit.php)

        • Locate lines 122-126:
          } else {
          if (strpos($_POST['hostname'],'.')) {
          $input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
          }
          }

        • Comment them out like this:
          } /* else {
          if (strpos($_POST['hostname'],'.')) {
          $input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
          }
          }*/

        • Save the file.

        Make sure that you do not comment out the entire line 122–the very first brace on that line closes the block of code above it.  Also, test your change by adding a static DHCP lease from the web interface before you close your ssh session.

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