Two WiFi networks work only simultaneously on OpenWrt

9,353

Solution 1

I faced a similar problem on TL-MR3020 and TL-WR703N. One possible solution is:

  • to try with the default set-up (e.g., two networks).
  • After 15 seconds (or so) after start try to test uplink connection.
  • If uplink is not available, disable uplink wi-fi interface and restart Wi-Fi.

So start on boot as background task check script: i.e., add to /etc/rc.local line

wifi-sentinel.sh &

calling the following script:

# wifi-sentinel.sh (on syspath, e.g., in /usr/bin/)
#!/bin/sh

# use uci show wireless to list interfaces

# test both networks.
uci set wireless.@wifi-iface[2].disabled=0; 
uci commit wireless; 
wifi

# wait some time and test
sleep 15 

if wget http://google.com; then
   logger "You have uplink, no action."
# disable uplink wifi and restart if no connection is available
else
   uci set wireless.@wifi-iface[2].disabled=1; 
   uci commit wireless; 
   wifi
fi

Solution 2

Now, this isn’t exactly an answer, but more of an explanation why being a repeater (which is what you do, although with routing) is difficult with just one radio. A single radio can only work on one WiFi channel.

In station mode, everything is fine. You set the channel to auto and wpa_supplicant (or wpad) takes care of things, including using the correct channel. Roaming will work, too, because the appropriate channel is dynamically selected.

In AP mode, you have to explicitly specify which channel the radio will provide the network on. This channel cannot change without “restarting” the network.

As such, in repeater mode, where you are both station and AP, the channel is fixed as well. This has some implications. The most obvious is of course that roaming no longer works. Less obvious, but all the more unfortunate: In extending your wireless network, you create a downstream network that interferes with your upstream network. So while you may indeed improve the range, the quality will drop.

Your problem of the AP going down when the station goes down is most likely a side-effect of having only one radio.

I’ve spent many hours trying to build a sort-of repeater (using a MR3020) for my university network but gave up because of many problems that cannot be worked around with automatic solutions.

Share:
9,353

Related videos on Youtube

Dims
Author by

Dims

Software developer & Machine Learning engineer C/C++/Java/C#/Python/Mathematica/MATLAB/Kotlin/R/PHP/JavaScript/SQL/HTML/ LinkedIn: http://www.linkedin.com/in/dimskraft Telegram: https://t.me/dims12 I prefer fishing rod over fish.

Updated on September 18, 2022

Comments

  • Dims
    Dims over 1 year

    I am trying to use device TP-Link 3020 router with OpenWrt installed to both connect in and connect out by WiFi.

    I have home WiFi network and I setup connection to it ("client mode"). Then I set another interface on the same radio to connect my computer to device ("ap mode").

    Client mode is associated with WAN and obtaining address via DHCP in space 192.168.10.1/24 AP mode is associated with LAN and distributing addresses in space 192.168.1.1/24

    Everything works but until home WiFi is up. When I shut it down, both connections disappear, i.e. I am unable to connect to internet, which is normal, but also I can't see AP network to connect from computer to device, to, for example, see LUCI pages.

    enter image description here

    This configuration works but until In The Moon Network is up. When it goes down, by pfSense router, the Out of The Moon Network also goes down. It doesn't accessible and visible anymore, despite the fact that it is still set up in MR3020.

    Why and how to overcome?

    UPDATE

    Upgrade from 12.04 to 14.07-rc3 and reordering interfaces didn't help.

    UPDATE 2

    An explanation why isn't it possible for MR3020 (for example it has only one radio while there are two required) to serve my request also would be appreciated.

    • harrymc
      harrymc over 9 years
      You could also try DD-WRT, which I think is a more evolved firmware.
    • Dims
      Dims over 9 years
      Tried DD-WRT. It bricked my router twice with minimal config changes. Each time it required 30/30/30 reset which is idiotic itself (what sense to press 30 seconds on poweroffed router). Dislike.
    • harrymc
      harrymc over 9 years
      Strange, lots of people swear by DD-WRT. The image installed might be incompatible with the router.
    • Dims
      Dims over 9 years
      It was marked for MR3020. May be it was my mistake, for example, it changed IP, which I didn't notice. But it did thin unpredictable. For example, last time the only thing I changed was hostname (and root password). After reboot I was unable to reach device.
    • harrymc
      harrymc over 9 years
      If that helps : The downloads I see in DD-WRT are from 2013. The button "Other downloads" leads to more recent versions, where there is also a difference between MR3020 and MR3020v1.
    • Joey
      Joey over 9 years
      What exactly are you trying to achieve?
    • harrymc
      harrymc over 9 years
      @DanielB: DD-WRT branched from OpenWrt on 2005. Today both firmwares total about 1 million articles each on Google and are the most-known 3rd-party firmwares. Please don't throw around emotional words like "crap".
    • harrymc
      harrymc over 9 years
      @Dims: You could also try the TP-LINK firmware from 2014, which should in theory be the most suitable to the hardware.
    • Daniel B
      Daniel B over 9 years
      @harrymc I don’t care where it came from. It’s just a fact: The settings system is partly broken and very confusing. OpenWrt is superior in just about every way, more up-to-date, more flexible and even features a Web UI these days.
    • harrymc
      harrymc over 9 years
      I still think that if there is a chance that a 3rd-party firmware is not using efficiently enough the hardware, the original TP-LINK one should be tried, even as a test of whether the hardware cannot support the wanted configuration.