Page 1 of 1

How to get dynamic WAN IP?

Posted: Tue Sep 19, 2017 2:29 pm
by SilverNodashi
Hi,

I wonder if anyone can help me.

I have a MikroTik RB2011UiASM, with a Hauwei LTE router on IP 192.168.8.1. The MikroTik is on 192.168.8.2.

How can I get the WAN IP address, using a script? I have searched the forum but cannot find anything that works?

Re: How to get dynamic WAN IP?

Posted: Tue Sep 19, 2017 2:39 pm
by az1984
Hi,

for what you want to use the WAN-IP information?

In IP -> Cloud you can find the Mikrotik-DNS Name and your WAN-IP - maybe this will help you out.

Re: How to get dynamic WAN IP?

Posted: Tue Sep 19, 2017 3:17 pm
by SilverNodashi
Hi,

for what you want to use the WAN-IP information?

In IP -> Cloud you can find the Mikrotik-DNS Name and your WAN-IP - maybe this will help you out.
Oh, yes, I should have said. I have a dual WAN setup, with a remove VPN. So the MikroTik can establish a VPN connection regardless of which WAN connection is connected. But it's giving some problems so I want to write a script to change the routes, depending on which WAN is connected. Pinging the LTE router (192.168.8.1) and ADSL router (192.168.4.3) doesn't help much.

So, how do I get that IP address using a script?
And, how do I know chih gateway updated the DNS entry?

Re: How to get dynamic WAN IP?

Posted: Tue Sep 19, 2017 3:58 pm
by az1984
Ok, that makes things a bit clearer, but I don't know yet, why you want to work with your WAN-IP.
If you have VPN-Clients which want to connect to the Mikrotik you can use it's DNS-name I think.

Re: How to get dynamic WAN IP?

Posted: Tue Sep 19, 2017 4:04 pm
by SilverNodashi
Ok, that makes things a bit clearer, but I don't know yet, why you want to work with your WAN-IP.
If you have VPN-Clients which want to connect to the Mikrotik you can use it's DNS-name I think.
Like I said, there's 2 WAN's and I need to change some stuff when the WANS's change, based on which WAN is used.

And, client's don't connect to the MikroTik. The MikroTik is a VPN client to another network.

Re: How to get dynamic WAN IP?

Posted: Tue Sep 19, 2017 4:09 pm
by az1984
Just found here...

viewtopic.php?t=73287

Re: How to get dynamic WAN IP?

Posted: Tue Sep 19, 2017 4:16 pm
by SilverNodashi
Just found here...

viewtopic.php?t=73287
Thanx.

I am still looking for a way to know which WAN / route was used to establish the connection.

Re: How to get dynamic WAN IP?

Posted: Sun Sep 24, 2017 8:39 pm
by gotsprings
Look at the Call-ID on the Connected to Tik?

But if you need to "get the WAN IP"

/ip cloud get public-address