"There was an error trying to determine the public IP for interface - wan(em0)"

Started by edjados, June 15, 2022, 11:27:40 AM

Previous topic - Next topic
Hi folks,

I have an OPNsense 22.1.8 box with the os-dyndns plugin installed (version 1.27_3) and configured with my Cloudflare API token. (waiting for os-ddclient to work with CloudFlare tokens before updating to that.)

Unfortunately it isn't working, and the log file indicates it can't source the public IP. The log file entries look like so:

2022-06-15T09:54:43 Error php-cgi /services_dyndns_edit.php: Dynamic DNS (REDACTED.co.uk) There was an error trying to determine the public IP for interface - wan(em0). Probably interface is not a WAN interface.
2022-06-15T09:54:43 Error php-cgi /services_dyndns_edit.php: Dynamic DNS (REDACTED.co.uk): running dyndns_failover_interface for wan. found em0
2022-06-15T09:54:43 Error php-cgi /services_dyndns_edit.php: Dynamic DNS (REDACTED.co.uk): IP address could not be extracted
2022-06-15T09:54:43 Error php-cgi /services_dyndns_edit.php: Aborted IPv6 detection: no address for em0
2022-06-15T09:54:43 Error php-cgi /services_dyndns_edit.php: Dynamic DNS: updatedns() starting


The important part appears to be "There was an error trying to determine the public IP for interface - wan(em0). Probably interface is not a WAN interface." My OPNsense is connected directly to the Internet (only a fiber modem sits between it) and my ISP does not perform CG-NAT.

I've been told os-dyndns just does a > curl http://checkip.dyndns.org <, and when I do this myself over SSH, I see the correct public IP in the output:

root@OPNsenseGateway:~ # curl http://checkip.dyndns.org
<html><head><title>Current IP Check</title></head><body>Current IP Address: 51.183.[REDACTED]</body></html>


I've configured os-dyndns to look at my WAN interface as seen in the log above. Does anyone know what could be going wrong to cause it to fail?

Thanks in advance!

-----
Versions:
OPNsense 22.1.8_1-amd64
FreeBSD 13.0-STABLE
OpenSSL 1.1.1o 3 May 2022
CPU type: Intel Core 2 Duo E7500 @ 2.93GHz (2 cores, 2 threads)
Load average: 0.24, 0.31, 0.26
Uptime:7 days 13:22:03

As you can see the problem pertains to IPv6, which probably has no GUA on the WAN (em0).

As such you cannot use it like you are trying to.


Cheers,
Franco

Hi Franco,

Apologies for the late response. The WAN interface does indeed have no IPv6 address, however I thought that wouldn't cause any issue. It has an IPv4 address which it grabs via DHCP from my ISP, and it's this IPv4 address which I want to push up to Cloudflare (since my ISP often doesn't renew the lease for the same IP so it changes without notice).

The OPNsense box displays the correct WAN IPv4 address on the dashboard and on the Interfaces > Overview page, so it "knows" it has this IP. This matches the IP which is returned by a > curl http://checkip.dyndns.org <, also.

I assumed that line in the log about there being no IPv6 address was just informational, since it's the IPv4 one it's failing to grab.

I also thought I'd mention I only have one WAN interface, i.e. this isn't in a failover or multi-WAN configuration which I've heard can cause issues with this.

I don't understand. Have you configured IPv6 DynDNS update or not? The log line would indicate that is the case which is the root of the "problem" reported.


Cheers,
Franco

Hi Franco,

I feel extremely silly. I could swear I'd enabled the non-v6 option (i.e. just "Cloudflare API token", not "Cloudflare API token (v6)", but I had obviously misread what I'd set, and misread multiple times.

I've just changed it to the non-v6 option and everything is now working fine, of course!

Thank you for your prompting, hopefully this thread can help anyone who makes this oversight in future.

Thanks, no worries. We all make mistakes and learn from it. :)


Cheers,
Franco