So in advanced settings you can set the interface to be brought up on boot. What if I don’t need or want to bring it up in boot but bring it up only when it’s needed. I am talking about the Wi-Fi interface which I don’t need it to be connected all the time just when it’s needed. Is there a way to bring it up only when main WAN goes down when it’s disconnected only in the event of need. I hope I explained myself all right lol
You'll probably need to be more specific about the events themselves, but the way to do this in general is to use hotplug.
By event I mentioned I mean
Yes, that's possible -- you look for an ifdown
event on wan, then trigger wifi to turn on. Do this via hotplug.
Whoa. That’s programming. No lucí settings there. What would the commands be to do it? Bring it up when main WAN is down and shut it off and disconnect it when maIn WAN is back up.
Any tutorials? Doc you kindly provided [thank you] is much appreciated but has only info not much of a tutorial.
is the wifi an upstream connection (i.e. an alternate internet connection)?
If so, is there a reason not to have it estabslished but unused? If you go this route, you could use mwan3 (which does have a LuCI front end interface).
Yeah, it’s my personal mobile hotspot. Don’t need it nor want it connected all the time. And yeah I’m using mwan3 in Luci
So that’s why I need this. Mwan3 does it? How where which setting is it? I remember I saw some ppope virtual connection settings but that’s not this case scenario.
mwan doesn't bring up the interface, but can be set to fail-over based on the criteria you set (in this case the normal wan going down, and back when the wan comes back online).
If you want the wifi interface to actually be down until the wan has been detected as having gone down and only then bring it up, you'll need to create a hotplug script. The link I provided earlier has all the necessary documentation and you can search the forums for hotplug ifup/ifdown and wifi up/down scripts.
Okay I did. Found none. Is there a special section for scripts? Couldn’t find any.
I searched the forum for "hotplug ifdown" and found this right away...
It's not necessarily the exact script you want, of course, but it'll be useful in demonstrating how to reach your goal.
Oh i searched for wifi up/down hehe
Ok I’ll give it a shot. Thanks.
So based in the post shared I made (with the help of Gemini) this script.
#!/bin/bash
# Log the action and interface
echo "hotplug/net: $ACTION $INTERFACE" >> /var/log/hotplug
logger -t hotplug "hotplug script: $ACTION $INTERFACE"
# Check if the event is "down" for the "wan" interface
if [ "$ACTION" = "down" -a "$INTERFACE" = "wan" ]; then
echo "wan interface is down"
# Activate wwan1 as a backup
echo "Activating wwan1 interface..."
ifup wwan1
if [ $? -ne 0 ]; then
echo "Error activating wwan1 interface" >> /var/log/hotplug
logger -t hotplug "Error activating wwan1"
else
echo "wwan1 interface activated successfully"
logger -t hotplug "wwan1 activated as backup"
fi
fi
Named it /etc/hotplug.d/iface/99-wwan-switch.sh
With .sh my recommendation from Gemini. Without it I tried it first but still the same.
It doesn’t trigger, it doesn’t enable wwan1 it doesn’t work. What am I missing?