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

    FQDN instead of IP

    Scheduled Pinned Locked Moved General pfSense Questions
    3 Posts 2 Posters 2.2k 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.
    • L
      Lectrician
      last edited by

      My Pfsense system has a hostname of "wifi" and a domain of "pubname" (pubname being the pubname).

      If I ping "wifi" or "wifi.pubname" I get a response from the Pfsenses LAN IP.

      I would like to change the IP to a FQDN for the captive portal, and can see I need to change the code in captiveportal.inc and the index.html in the captiveportal directory.  Indeed, I can get this working.

      http://wifi:8000 and http:wifi.pubname:8000 resolve and the captive portal appears.

      Looking at the original code, I am not sure what this function does and why?

      $ifip = portal_ip_from_client_ip($clientip);

      if (isset($config['captiveportal']['httpslogin']))
          $ourhostname = $config['captiveportal']['httpsname'] . ":8001";
      else {
          $ifip = portal_ip_from_client_ip($clientip);
          if (!$ifip)
          	$ourhostname = $config['system']['hostname'] . ":8000";
          else
          	$ourhostname = "{$ifip}:8000";
      }
      

      If this function does not return an ip, the captive portal uses the hostname as the FQDN, so commenting out $ifip = portal_ip_from_client_ip($clientip); forces it use the hostname.

      What does this function call actually do and why?

      Thanks.

      1 Reply Last reply Reply Quote 0
      • C
        craigduff
        last edited by

        Personally i would assign it an external fully qualified domain name. Alot simpler. Then i would disable loop back for Nat in the advanced setting, so when in on the lan side of pfsense i can ping the FQDN on the inside and get a response from the WAN

        Kind Regards,
        Craig

        1 Reply Last reply Reply Quote 0
        • L
          Lectrician
          last edited by

          Is there a way to put a FQDN into PFsense DNS without registering a domain name externally?  Almost like an lmhosts file in Windows?  Looks like you can add a DNS "Host Override" under advanced in DNS forwarder?  Is it a good idea to do this?  For example, the FQDN for the pub is an external hosted website, but could add wifi.puburl.com into the hosts override and assign this to the captive portal ip?

          Still not really sure what that call to the function does mentioned above?

          Looks like it would only be useful if you had more than one interface using the Captive Portal.  It seems to look at the interfaces in use for the portal, get the IP/Subnet for those interfaces, look to see which the clientIP 'matches', and then assigns the IP address for the captive portal according to which interface the client is on?

          So if using just one interface, you could opt to loose the call to this function, as you are always going to get the same result from the call.

          Is there a reason to NOT use the hostname of the pfsense server?

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