Openmptcprouter: Get WAN Public IP from omr router console

Created on 8 Nov 2020  路  9Comments  路  Source: Ysurac/openmptcprouter

Hello,
i see that from interface omr shows wan ip addresses, and i wish to grab them for some scripting.
I need 4G WAN in particular.
How can i retrieve them from console?
This is what i need:
image

Thanks.
edit: if there are any api or anything else i can use fron LAN to retrieve them, it's well accepted.

question

All 9 comments

On OpenMPTCProuter all data that are displayed in status page come from ubus: ubus call openmptcprouter status.
This can be accessed via http, you an check OpenWrt doc for that.

Thanks, i think it's what i need.

i'm opening this for a question: is there a command to force re-check for the public IP it shows?
I have 4G connection and it's reporting a false, old ,public IP. But it's not getting updated.
Restarted but it still showing an old public ip for 4G connection.
I'm reading ASN, and this false reporting is an issue for some scripts, maybe someone can help me.

If external check are not disabled, IPs are updated about every hours.
To force update, uci del openmptcprouter.wan1.lc where "wan1" is the interface to force. IPs will be updated by scripts a few minutes after.

as always that command did the trick!
Are there side effects on launching the last command?
I explain a bit: when the 4G connection updates the IP i can get 2 different ASN, one is heavy filtered and high ping, the other is not filtered and much better ping, so when it comes, i must switch from the worst ASN to the other(doing data disconnection/reconnection and then check the ASN, repeat if ASN is wrong), and i have to be sure the IP get updated ASAP, launching then that command.
Thanks

It would be better to create a script and launch it via crontab that should be able to do that alone.

Do you mean crontab uci del openmptcprouter.wan1.lc ?
Is every 15 mins too much?
I want something i could relay on, but not task intesive.

No. A crontab that check IP himself, check ASN, disconnnect/reconnect the 4G connection if needed.

i have that, but since ubus call openmptcprouter status got stuck with bad ip, i will rely on that uci del ... for updating the IP and then do all checks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ndaptardar picture ndaptardar  路  4Comments

ndaptardar picture ndaptardar  路  3Comments

PCRyan picture PCRyan  路  4Comments

rifaterdemsahin picture rifaterdemsahin  路  13Comments

joshuaeb09 picture joshuaeb09  路  4Comments