For a script that I am using, I need to programmatically determine the name of the qmimuxN interface that gets assigned the IP address when using WWAN. It’s usually qmimux0 but sometimes (for reasons unknown!) it gets assigned as qmimux1.
I poked around inside /lib/netifd/netifd-proto.sh to see if I could work something out. The 2 one-liners below both “do the job” but I’m not sure if these are safe/correct. Anyone have a better way, or is this a good way of doing it?
Hi,
these commands probably would be fine, but I would suggest to interact more with netifd or API, because if something changes internally your script might get broken.
You can list network interfaces from config or in ubus: ubus list network.interface.*
Then there is a lib at /lib/functions/network.sh, there you can find usefull functions.
OR
api get /interfaces/status https://developers.teltonika-networks.com
I examined the JSON returned by the api but couldn’t find a way to reverse this interface name from the output. For example the JSON paths that contain the value qmimux0 are: