Feature #13901
Updated by Marcos M over 2 years ago
The default service @checkip.dyndns.org@ will fail when connecting over IPv6 (e.g. if upstream only provides IPv6 connectivity). IPv6. The default service could be changed to e.g. @noip.com@ (see https://www.noip.com/integrate/ip-detection) and updated to prefer IPv4 and fail back to IPv6. Test: <pre> # PHP code $ip_address = get_interface_ip('wan'); $ip_ch = curl_init('http://ip1.dynupdate6.no-ip.com/'); curl_setopt($ip_ch, CURLOPT_VERBOSE, 1); $curlerr = fopen('php://temp', 'w+'); curl_setopt($ip_ch, CURLOPT_STDERR, $curlerr); curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1); $ip_result_page = curl_exec($ip_ch); curl_close($ip_ch); $ip_result_decoded = urldecode($ip_result_page); rewind($curlerr); $curlerrlog = stream_get_contents($curlerr); fclose($curlerr); print_r($ip_result_decoded ? $ip_result_decoded : $curlerrlog); # success 2001:db8:x:x:x:x:x:x # fail (using http://checkip.dyndns.org/ as the URL) * Trying 158.101.44.242:80... * Immediate connect fail for 158.101.44.242: Network is unreachable * Trying 193.122.6.168:80... * Immediate connect fail for 193.122.6.168: Network is unreachable * Trying 132.226.8.169:80... * Immediate connect fail for 132.226.8.169: Network is unreachable * Trying 132.226.247.73:80... * Immediate connect fail for 132.226.247.73: Network is unreachable * Trying 193.122.130.0:80... * Immediate connect fail for 193.122.130.0: Network is unreachable * Closing connection 0 </pre>