How to open the web gui automatically when there is no connection in the wlan

this is something that I would like to do a lot, and I would like to do it following a best practice because it greatly increases the usability by a user ...

to access the web interface (whether it is LuCi or any custom one) I have to open the browser and access the address http://192.168.99.1 (for example) ...

I would like that if there was no connection in the wlan interface, then when any client connected on the lan interface accesses the browser any request he makes receives the web interface as a response (whether it is LuCi or any custom) ...

I think there are many different ways to do it (similar to a captive portal?), but if I had a suggestion I could then implement this function in the best way ...

thank you for your support, as always I hope this topic can be useful to other users too!

I don't have the answer, I'm afraid, but I'm curious to know the use-case. Why would you need wired clients to have LuCI open when WLAN clients disconnect?

And how do you want to handle it if WLAN client connection drops momentarily then works again?

And do you want LuCI to open in the web browser by itself? Or do you mean that when wired clients try to open a Web page, they get LuCI instead? Because these are two different things, and I don't think the former is easy to achieve.

There is a thread on here somewhere where a non-luci vpn web control/action is posted. It does not have redirect when down but simple NAT(D/S) via watcher script or similar to an alternate port / process / ip would be the first call ( do yourself a favour and just run http to begin with ).

You can run a ttyd session there with a number menu or similar interaction if need be.

I wouldn't worry too much about "best practice" because this type of feature is "active"... and not inline with OpenWrt philosophy ( routers like OEM providers that auto update / redirects are too much ). If you get something basic running, then worry about the finer aspects.

there are some cases in which the network is not connected via ethernet cable but through association with a wifi access point (as if it were a repeater) ... in that case I would like that when I open the browser (the browser I open it from my device connected on the lan) is redirected to a page inside the device that allows me to associate it with one of the detected wifi networks...

And how do you want to manage it if the connection of the WLAN client breaks temporarily and then works again?

this I think is the crux of the matter, inserting a trigger that controls the connection status of an interface, in reality I want to activate "default page" not if the connection is absent but if the wlan interface is not associated with any access point. ..

And do you want LuCI to open in the web browser by itself?

it's possible? it would be great! how can i do it?

Or do you mean that when wired clients try to open a Web page, they get LuCI instead?

I think this is the captive portal solution, which would also be fine for me, but I know when I last implemented it (on an ubuntu server) it created problems if I opened an https ...

and I don't think the former is easy to achieve.

I don't believe it either, but I like pain :yum:

There is a thread on here somewhere where a non-luci vpn web control/action is posted.

yes, I could not find the post, but there are similar scripts in the GliNet interfaces, I can take inspiration from there ...

simple NAT(D/S) ... to an alternate port / process / ip would be the first call

I'm sorry but I didn't understand what you're talking about ... diverting traffic by changing the routing table? I'm inside the same device why should I have to set the NAT?

1 Like

I wasn't suggesting it; it's just the use-case was not clear to me so I wasn't sure what you are after.

I don't expect it to be possible out of the box, but it shouldn't be impossible. I imagine you would want to have some code on your PC that waits for a message from the router (which would be sent when the WiFi connection drops), and when it received it, it opens the router's IP address in the default browser. I don't know the most efficient way to do it, not do I think it would be the best use of your PC resources; but I think the theory is valid.

Edit: Alternatively, you could do it all on your PC. You can have an application to continuously ping the main router at intervals s--say every minute; if it fails then open the GUI of the next router. Again, that would cause some traffic and use of the resources, but it should be easy to implement if you really need it.

when I connect to a captive portal with the android smartphone the browser is opened automatically, it may be interesting to replicate the mechanism ...

I don't want to set up client solutions ...

now I have split the problem:

  1. TRIGGER: notice when the wlan is not associated and have an action performed

  2. REDIRECT: activate and / or deactivate the redirection (http only for the moment) ... this I can do in 2 ways:

  • activating a captive portal
  • activating a transparent proxy like squid