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

    Wrong IP from dyndns on multiwan router

    Scheduled Pinned Locked Moved Routing and Multi WAN
    1 Posts 1 Posters 534 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.
    • I
      individual-it
      last edited by

      Our multi-WAN routes retrieve the wrong public IP from "checkip.dyndns.org" when "second WAN" is set as default gateway.

      here our 2 WAN interfaces.

      
      re0: flags=8843 <up,broadcast,running,simplex,multicast>metric 0 mtu 1500
      	options=8209b <rxcsum,txcsum,vlan_mtu,vlan_hwtagging,vlan_hwcsum,wol_magic,linkstate>ether 00:00:00:00:00:0a
      	inet6 fe80::200:ff:fe00:a%re0 prefixlen 64 scopeid 0x1 
      	inet 202.xx.xx.xx netmask 0xffffffe0 broadcast 202.xx.xx.xx 
      	nd6 options=21 <performnud,auto_linklocal>media: Ethernet autoselect (100baseTX <full-duplex>)
      	status: active
      re1: flags=8843 <up,broadcast,running,simplex,multicast>metric 0 mtu 1500
      	options=8209b <rxcsum,txcsum,vlan_mtu,vlan_hwtagging,vlan_hwcsum,wol_magic,linkstate>ether 00:0d:b9:33:10:8d
      	inet6 fe80::20d:b9ff:fe33:108d%re1 prefixlen 64 scopeid 0x2 
      	inet 10.49.xx.xx netmask 0xffffff00 broadcast 10.49.xx.255 
      	nd6 options=21 <performnud,auto_linklocal>media: Ethernet autoselect (100baseTX <full-duplex>)
      	status: active</full-duplex></performnud,auto_linklocal></rxcsum,txcsum,vlan_mtu,vlan_hwtagging,vlan_hwcsum,wol_magic,linkstate></up,broadcast,running,simplex,multicast></full-duplex></performnud,auto_linklocal></rxcsum,txcsum,vlan_mtu,vlan_hwtagging,vlan_hwcsum,wol_magic,linkstate></up,broadcast,running,simplex,multicast> 
      

      In the WebGui they show up as:

      WANGW (default) WIMAX 10.49.xx.xx
      OPT1GW                 WLINK 202.xx.xx.xx

      WANGW is behind an other router and so has a private IP, OPT1GW has a real public IP.

      Still on both interfaces we are running dyndns to get the public IPs also we are running dyndns for some gatewaygroups, like incoming VPN GW groups

      Now what happens: If I set WANGW as default everything works as expected, but if I set OPT1GW as default GW all dyndns clients (of all GW and GW-groups) get the same IP, the IP of OPT1GW.

      I've tested with this code snippet:

      
      $ip_address="10.49.xx.xx";
      $hosttocheck = "http://checkip.dyndns.org";
      $ip_ch = curl_init($hosttocheck);
      curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE);
      curl_setopt($ip_ch, CURLOPT_INTERFACE, 'host!' . $ip_address);
      curl_setopt($ip_ch, CURLOPT_CONNECTTIMEOUT, '130');
      curl_setopt($ip_ch, CURLOPT_TIMEOUT, 260);
      curl_setopt($ip_ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
      $ip_result_page = curl_exec($ip_ch);
      curl_close($ip_ch);
      
      $ip_result_decoded = urldecode($ip_result_page);
      preg_match('=Current IP Address: (.*)=siU', $ip_result_decoded, $matches);
      $ip_address = trim($matches[1]);
      
      echo $ip_address;
      
      

      So if I set OPT1GW as default GW it does not matter what IP I put into $ip_address I get only back the public IP of OPT1

      P.S. we are running 2.2.6-RELEASE (nanobsd)

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