07-04-2024 06:13 AM
Hi there,
I'd like to know if there is a way to retrieve WAN IP address of my ISP. Of course, my router (ISR4300) is not plugged straight to WAN link, else I would just perform a 'sh int G0/0/0' or the like
Idea behind this is to retrieve WAN address, and push it to my registrar (OVH), with an HTTP method - I used that a while ago when I used a 827 instead of an internet box, and it worked like a charm. Since ISP's WAN interface cannot be monitored, I guess that regular interval polling would be used for that.
Sure, things would be much more simple if could put an SFP straight into the router, but I doubt that first, IPS configuration allows that, and second, simplex SFPs do exists for Cisco routers.
Thanks for your ideas!
07-04-2024 06:33 AM
Hello,
since you are asking for TCL, you could try a script such as the one below on your 4300. In this example, 'whatismyip' is being used.
tclsh
set ip [exec wget -qO- http://whatismyip.akamai.com/]
puts "Current WAN IP: $ip"
07-04-2024 12:22 PM
Hi Georg, many thanks for your answer! It does not work, but I got the point: query Akamai and retrieve ip in plain text, and pass it to the router (brillant idea to use Akamai
NWR01(tcl)#set ip [exec wget -qO- http://whatismyip.akamai.com/]
^
% Invalid input detected at '^' marker.
Anyway, though I'm a real moron with TCL, and have scarcely used it, I will check docs/examples on my side to see where's the issue.
Thanks again!
07-05-2024 04:42 AM
wget is a bash utility and not in tcl. Enable guestshell on the router to enter bash environment and run commands from there.
INET#guestshell
[guestshell@guestshell ~]$
[guestshell@guestshell ~]$ ip=`curl http://whatismyip.akamai.com`
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15 100 15 0 0 205 0 --:--:-- --:--:-- --:--:-- 205
[guestshell@guestshell ~]$ echo $ip
2xx.7xx.8xx.9xx
There is also a python environment in guestshell that can be used for http services as well.
[guestshell@guestshell ~]$ python3
Python 3.6.8 (default, Dec 22 2020, 19:04:08)
[GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide