Community discussions

MikroTik App
 
yaylitzis
just joined
Topic Author
Posts: 15
Joined: Fri Jan 11, 2019 8:58 am

Print in log the public ip

Wed Jun 09, 2021 4:49 pm

Hello,
I have a static public IP from my ISP. I read here viewtopic.php?t=73287#p750603 that I can print the public IP, using the command
:put [/ip cloud get public-address]
which works fine in my case!

Is there a way to monitor if my public IP change, to add a message in the log? For example, :

//Pseudocode
If my public IP != MY_STATIC_IP_ THEN PRINT TO LOG "public ip is 111.111.111"
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Print in log the public ip

Wed Jun 09, 2021 5:09 pm

Yes, is possible,
but if your ISP give you a Static IP as you say, all this are useless...

Instead to hypotize someting, write what you want at the end and why.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Print in log the public ip

Wed Jun 09, 2021 7:29 pm

Many ISP say that you get static IP, but in fact its just DHCP with long lease time. As long as your modem/router are online, it will not change.

Here is just one script I found using goolge to monitor and log outside IP changes.
https://mhelp.pro/mikrotik-scripts-noti ... r-changes/
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Print in log the public ip

Wed Jun 09, 2021 7:33 pm

Sorry, but on my country Static (Public) IP are Static (Public) IP,
otherwise are called Dynamic Public IP.
Also I have ALL my users with Dynamic Public IPv4/v6, but if someone want one or more Static (Public) IPv4, we rent for each one at 10€ for month.
Fixed (Public) IPv6 pool are free.
 
yaylitzis
just joined
Topic Author
Posts: 15
Joined: Fri Jan 11, 2019 8:58 am

Re: Print in log the public ip  [SOLVED]

Wed Jun 09, 2021 9:00 pm

The reason I am asking this is because in Mikrotik I have 2 connections from ISPs (one internet line is primary and if it fails for any reason backup line is enabled).
From both ISPs, I have static IP which doesn't change. So, I want to monitor how many often my primary internet line disconnects.

EDIT
I followed this article where @Jotne posted and I managed to create a script to do it.

Who is online

Users browsing this forum: Majestic-12 [Bot], rogerioqueiroz and 16 guests