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

    Custom "Check IP Service" not working: "There was an error trying to determine the public IP for interface - wan"

    DHCP and DNS
    dynamic dns
    7
    21
    6.3k
    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.
    • GertjanG
      Gertjan @bartekmao
      last edited by

      @bartekmao said in Custom "Check IP Service" not working: "There was an error trying to determine the public IP for interface - wan":

      it seems it can't fetch my public ip

      In other words : you can't connect to it.
      If you have an Internet connection, you have a WAN IP that can not be a RFC1918.

      Click on it - and you'll see your WAN IP :
      http://checkip.dyndns.org
      The IP can't be a RFC1918, as a RFC11918 isn't routable over the Internet.

      Your pfSense could be placed behind an (ISP) router, which is place behind yet another router (etc). All this little family would communicate between them using RFC1918. But the last one will use your WAN IP.
      This is the IP http://checkip.dyndns.org return. http://checkip.dyndns.org will always return an IP.

      Btw :
      http://checkip.dyndns.org is "http". A httpS version isn't offered by checkip.dyndns.org. Ok, true, it retirn a text fragment hat conatins your IP, the same IP that is already in the headers of the IP packet that travels over the net.
      I decided to create my own "checkip.dyndns.org" check page (as we all have a web server some where doing close to nothing ^^)

      219d94b7-230f-4369-bbca-d5c33b3f48e8-image.png IPv4 is old school -

      This one returns IPv4 or IPv6, as the latter is the default protocol these days.
      Also, I ditched 'http' support, it's all 'https' now.

      This is the content of the "whatismyip.php" file :

      <?php
      echo "<html><head><title>Current IP Check</title></head><body>Current IP Address: ".$_SERVER['REMOTE_ADDR']."</body></html>";
      ?>
      

      edit :
      When you use RFC2136, don't forget to check this option :

      8c5d4f4d-71a3-4cf0-80cd-df629255bb43-image.png

      No "help me" PM's please. Use the forum, the community will thank you.
      Edit : and where are the logs ??

      B fireodoF 2 Replies Last reply Reply Quote 1
      • B
        bartekmao @Gertjan
        last edited by

        @gertjan thanks for your reply

        I checked with mtr and there are two hops before the internet so yes the isp is doing some nat and routing. Nevertheless surfing to any ip resolving site including dyndns.org resolves perfectly the ip assigned to me by my isp. doing so from the command line with "dig" and from pfsense itself returns the correct ip, so I do mistrust the dynamic dns service on pfsense 21.05.
        I am not using RFC2136 since I didn't find any config for that with free account of noip.
        .

        GertjanG 1 Reply Last reply Reply Quote 0
        • GertjanG
          Gertjan @bartekmao
          last edited by

          @bartekmao said in Custom "Check IP Service" not working: "There was an error trying to determine the public IP for interface - wan":

          so I do mistrust the dynamic dns service on pfsense 21.05.

          It works.
          You can test it yourself.

          This is what the code does - you can use the system command your :

          [2.5.2-RELEASE][admin@pfsense.yournetwork.net]/root: curl http://checkip.dyndns.org
          <html><head><title>Current IP Check</title></head><body>Current IP Address: 82.127.34.254</body></html>
          

          'curl' behaves very much the same way as a web browser.
          It retrieves the file, and shows it. A web browser will also interpret the obtained html; culd doesn't, it just shows the file "as is".

          'curl' will do the usual intermediate steps : it will resolve "dyndns.org" first.
          You can do that also yourself :

          [2.5.2-RELEASE][admin@pfsense.yournetwork.net]/root: dig checkip.dyndns.org +short
          checkip.dyndns.com.
          193.122.130.0
          193.122.6.168
          132.226.8.169
          158.101.44.242
          132.226.247.73
          
          

          I tend to say : if you have issues retrieving checkip.dyndns.org, you have set up issues.

          No "help me" PM's please. Use the forum, the community will thank you.
          Edit : and where are the logs ??

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

            Yes it works from shell or from pfsense Command Prompt gui, but not from dyndns services. It used to work for some years now. Only after a recent upgrade to 21.05 it doesn't. I already deleted and configured from zero the noip dynds, but the problem persists.

            curl.png

            1 Reply Last reply Reply Quote 0
            • _
              _igor_
              last edited by

              Hello!
              This morning i encountered the same problem: The dyndns-IP at the status-page was showing N/A, after a while it changed to the actual IP, but is shown in red.
              So i tried to ping my private dyndns, which resulted good without packet-loss.
              so far, so good.
              But when i have an IP-change from my ISP, dyndns-update fails. It still shows the old IP.
              I did the tests mentioned here via curl, dig, all checks passed, i get shown my public IP.
              Only the automatic check doesnt work. When i enter the dyndns-settings and push "save and force check", the IP gets resolved and i see it at the status-page, but still red, not green.
              I didnt change any settings for a while, so i am not sure, whats happening.
              I am at pfsense 2.5.2, double-natted. In front of pfsense i have a router from ISP, which is set to "exposed host".
              Advanced settings in pfsense is set to "pureNAT".
              The settings run fine now since april.
              Automatic check via cron the logs show:

              Zeitpunkt	Prozess	PID	Nachricht
              Jul 30 09:50:00	php	58642	rc.dyndns.update: Dynamic DNS () There was an error trying to determine the public IP for interface - wan (em0 ).
              Jul 30 09:50:00	php	58642	rc.dyndns.update: Dynamic DNS (): running get_failover_interface for wan. found em0
              Jul 30 09:50:00	php	58642	rc.dyndns.update: Dynamic DNS: updatedns() starting
              

              Staus: Current IP in red, which is ok, due to the fail...

              With manual check:

              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: phpDynDNS (): (Erfolgreich) IP-Adresse erfolgreich aktualisiert!
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: phpDynDNS: aktualisiere Zwischenspeicher Datei /conf/dyndns_wancustom''0.cache: xxx.xxx.xxx.231
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Dynamic DNS custom (): xxx.xxx.xxx.231 extracted from Check IP Service
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Dynamic DNS custom (): _checkStatus() gestartet.
              Jul 30 08:53:33	php-fpm	72709	<title>DDNSS - Kostenloser DynDNS Service : Re-ProutDNS v5.01v</title>
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Data: <head>
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header:
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header:
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: Content-Type: text/html; charset=UTF-8
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: Content-Length: 249
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: X-Permitted-Cross-Domain-Policies: master-only
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: X-WebKit-CSP: default-src 'self'
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: X-XSS-Protection: 1; mode=block
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: X-Frame-Options: deny
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: X-Content-Type-Options: nosniff
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: Vary: Accept-Encoding
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: good: Your hostname has been updated.
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: DDNSS-Message: Your hostname has been updated.
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: DDNSS-Response: good
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: Cache-Control: no-cache, must-revalidate
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: Last-Modified: Fri, 30 Jul 2021 06:47:15 GMT
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: Expires: 0
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: Pragma: no-cache
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: Strict-Transport-Security: max-age=15768000
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: Server: Apache
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: Date: Fri, 30 Jul 2021 06:47:15 GMT
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Response Header: HTTP/1.1 200 OK
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Sende Anfrage an: https://ddnss.de/upd.php?key=zzz&host=pxxxxe.ddnss.de
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Dynamic DNS custom (): _update() gestartet.
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Dynamic DNS (): führe get_failover_interface für wan aus. em0 gefunden
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Dynamic DNS custom (): xxx.xxx.xxx.231 extracted from Check IP Service
              Jul 30 08:53:33	php-fpm	72709	/services_dyndns_edit.php: Dynamisches DNS: updatedns() wird gestartet
              

              Staus: Current IP in red, which is not ok, all went good...

              Manual check when IP changed:
              I have added another IP-check for debugging.

              Jul 30 07:20:08	php	97919	rc.dyndns.update: phpDynDNS (): (Success) IP Address Updated Successfully!
              Jul 30 07:20:08	php	97919	rc.dyndns.update: phpDynDNS: updating cache file /conf/dyndns_wancustom''0.cache: xxx.xxx.xxx.166
              Jul 30 07:20:08	php	97919	rc.dyndns.update: Dynamic DNS custom (): xxx.xxx.xxx.166 extracted from Check IP Service
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Dynamic DNS custom (): _checkStatus() starting.
              Jul 30 07:20:00	php	97919	<title>DDNSS - Kostenloser DynDNS Service : Re-ProutDNS v5.01v</title>
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Data: <head>
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header:
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header:
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: Content-Type: text/html; charset=UTF-8
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: Content-Length: 249
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: X-Permitted-Cross-Domain-Policies: master-only
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: X-WebKit-CSP: default-src 'self'
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: X-XSS-Protection: 1; mode=block
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: X-Frame-Options: deny
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: X-Content-Type-Options: nosniff
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: Vary: Accept-Encoding
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: good: Your hostname has been updated.
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: DDNSS-Message: Your hostname has been updated.
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: DDNSS-Response: good
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: Cache-Control: no-cache, must-revalidate
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: Last-Modified: Fri, 30 Jul 2021 05:13:42 GMT
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: Expires: 0
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: Pragma: no-cache
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: Strict-Transport-Security: max-age=15768000
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: Server: Apache
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: Date: Fri, 30 Jul 2021 05:13:42 GMT
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Response Header: HTTP/1.1 200 OK
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Sending request to: https://ddnss.de/upd.php?key=zzz&host=pxxxxxe.ddnss.de
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Dynamic DNS custom (): _update() starting.
              Jul 30 07:20:00	php	97919	rc.dyndns.update: DynDns (): Dynamic Dns: cacheIP != wan_ip. Updating. Cached IP: xxx.xxx.xxx.39 WAN IP: xxx.xxx.xxx.166
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Dynamic Dns (): Current WAN IP: xxx.xxx.xxx.166 Cached IP: xxx.xxx.xxx.39
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Dynamic DNS custom (): xxx.xxx.xxx.166 extracted from Check IP Service
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Dynamic DNS (): running get_failover_interface for wan. found em0
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Dynamic DNS custom (): xxx.xxx.xxx.166 extracted from Check IP Service
              Jul 30 07:20:00	php	97919	rc.dyndns.update: Dynamic DNS: updatedns() starting
              

              Staus: Current IP in red, which is not ok, all went good...

              GertjanG Bob.DigB 2 Replies Last reply Reply Quote 0
              • GertjanG
                Gertjan @_igor_
                last edited by

                @_igor_ said in Custom "Check IP Service" not working: "There was an error trying to determine the public IP for interface - wan":

                Only the automatic check doesnt work

                If you use the default :

                84f6386e-f002-49fe-9358-489707eb765c-image.png

                this is what is executed :

                https://github.com/pfsense/pfsense/blob/7fb96c6c266d8086597e00053087c9bcb7281f88/src/etc/inc/services.inc#L2264

                at line 2277 the 'page' is filtered and the IP is isolated.

                I tested the list Services > Dynamic DNS > Dynamic DNS Clients
                It's a mess.
                IP's marked in red, or just N/A.

                I switch back to my own checkip service ;)

                Keep in mind :
                http://checkip.dyndns.org is http only, not https (the code is hardcoded to use no https).
                It's a free serveice .... which means 'they' can do whatever they want with it - and repait, if needed, when they see fit.

                That's why I created my own "checkip.dyndns.org " with some web server I run on the Internet. Just to have a plan A and a plan B.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 1
                • fireodoF
                  fireodo @Gertjan
                  last edited by

                  @gertjan said in Custom "Check IP Service" not working: "There was an error trying to determine the public IP for interface - wan":

                  This is the content of the "whatismyip.php" file :
                  <?php
                  echo "<html><head><title>Current IP Check</title></head><body>Current IP Address: ".$_SERVER['REMOTE_ADDR']."</body></html>";
                  ?>

                  Thank you too 😊

                  Have a nice Weekend,
                  fireodo

                  Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                  SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                  pfsense 2.7.2 CE
                  Packages: Apcupsd Cron Iftop Iperf LCDproc Nmap pfBlockerNG RRD_Summary Shellcmd Snort Speedtest System_Patches.

                  1 Reply Last reply Reply Quote 0
                  • _
                    _igor_
                    last edited by

                    Maybe it would be a great idea/suggestion to add a parameter to the settings of the services/checkip for the corresponding answer from my own IP-check, so from ddnss.de the answer is

                    curl ddnss.de/meineip.php
                    <html>
                     <head>
                      <title>
                      DDNSS - Wie ist meine IP ?
                    </title>
                    </head><body>
                    Aktuelle IP: <b>xxx.xxx.xxx.xxx</b></body></html>
                    

                    That would make us use the service without hacking services.inc to meet my own wishes. The actual dyndns.org setting tends to fail too much in my opinion...
                    I personally changed services.inc, which resulted easy to get it working nicely...

                    Happy Weekend to all!

                    GertjanG 1 Reply Last reply Reply Quote 0
                    • GertjanG
                      Gertjan @_igor_
                      last edited by

                      @_igor_ said in Custom "Check IP Service" not working: "There was an error trying to determine the public IP for interface - wan":

                      Maybe it would be a great

                      Some knowlegde about what is returned will be needed.
                      Remember : what you see is not what you get.
                      A browser shows :

                      6c45d143-d739-48d6-91c4-c4a85dafe927-image.png

                      but it actually receives :

                      b58813dd-ee96-4cd7-89b0-ecfeac31ad8a-image.png

                      In the past, it would be normal that a persons that administrates a firewall knows all about "html" and that kind of stuff.
                      These days, that's not the case any more. They say they manage "Internet" without remotely knowing what's going on.

                      And it gets even better : what you're asking for is that the user enters a search string that has to match.
                      Here it is for the "http://checkip.dyndns.org/" :

                      Current IP Address: (.*)</body>=siU'
                      

                      If this string matches, it return something that could be an IPv4 (or IPv6).
                      I guess you've lost most of us right there.
                      'grep' is understood by those who where there when it was invented - as it was needed.
                      Learning it from scratch is ... well ... most will abandon.

                      Note : it's not really grep, I over simplify.

                      Btw : I'm not saying your idea is wrong - on the contrary.
                      As said, I have some web servers doing close to nothing, so I wrote my own solution, as it is a bit simpler to write a solution on the 'other side' of the equitation.

                      No "help me" PM's please. Use the forum, the community will thank you.
                      Edit : and where are the logs ??

                      Bob.DigB 1 Reply Last reply Reply Quote 1
                      • Bob.DigB
                        Bob.Dig LAYER 8 @_igor_
                        last edited by Bob.Dig

                        @_igor_ I saw the same problem. But as far I have understand it, pfSense is only updating DDNS if the cron job is due anyways.
                        I also have a double-NAT situation like you. So what I did is scheduling the IP change on my first router (VDSL) and then also scheduling a cron job on pfSense for rebooting and another on after that for DDNS Update.

                        That is much more complicated then it should be but also you are advised to use a modem or bridge and not another router in front of pfSense. So I have no hope that it will change anytime soon.

                        1 Reply Last reply Reply Quote 0
                        • Bob.DigB
                          Bob.Dig LAYER 8 @Gertjan
                          last edited by Bob.Dig

                          @gertjan said in Custom "Check IP Service" not working: "There was an error trying to determine the public IP for interface - wan":

                          They say they manage "Internet" without remotely knowing what's going on.

                          Would you mind to give such a person access to your check-ip service?
                          I am asking for a friend. 😉

                          GertjanG 1 Reply Last reply Reply Quote 0
                          • GertjanG
                            Gertjan @Bob.Dig
                            last edited by Gertjan

                            @bob-dig said in Custom "Check IP Service" not working: "There was an error trying to determine the public IP for interface - wan":

                            Would you mind to give such a person access to your check-ip service?

                            This one

                            9e82b598-5171-4011-9ad8-e35b1b26f73f-image.png

                            ?
                            It's a public web server. Not something I should hide.

                            Be carefull, teir could be side effects :

                            75b7fd56-bd97-424a-bed2-07616ac2edcc-image.png

                            @bob-dig said in Custom "Check IP Service" not working: "There was an error trying to determine the public IP for interface - wan":

                            check-ip service

                            The PHP page knows about the visitors originating IP address. How could it answering you if it doesn't ;)
                            All it does is showing it.

                            No "help me" PM's please. Use the forum, the community will thank you.
                            Edit : and where are the logs ??

                            Bob.DigB 1 Reply Last reply Reply Quote 3
                            • Bob.DigB
                              Bob.Dig LAYER 8 @Gertjan
                              last edited by Bob.Dig

                              @gertjan Thank you, I am trying it out right now to see, if the behavior of showing red IPs in the ddns-widget is changing.

                              No more red IPs... will stick with gertjans service for now.

                              🖖

                              1 Reply Last reply Reply Quote 0
                              • G good4y0u referenced this topic on
                              • N NickyDoes referenced this topic on
                              • First post
                                Last post
                              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.