DHCP hostname sub-domain issue



  • 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



  • 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.


Log in to reply