Two WiFi networks work only simultaneously on OpenWrt

1

0

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.

Dims

Posted 2014-09-29T06:10:54.550

Reputation: 8 464

You could also try DD-WRT, which I think is a more evolved firmware.

– harrymc – 2014-10-06T13:26:37.417

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. – Dims – 2014-10-08T08:02:01.343

Strange, lots of people swear by DD-WRT. The image installed might be incompatible with the router. – harrymc – 2014-10-08T10:07:51.977

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. – Dims – 2014-10-08T13:18:17.900

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. – harrymc – 2014-10-08T13:36:00.983

What exactly are you trying to achieve? – Joey – 2014-10-09T09:21:27.107

I would like MR3020 be what is was designed for: mobile router. It should consume any network it met, including WiFis, and provide it to my notebook via WiFi. – Dims – 2014-10-09T09:52:13.800

DD-WRT is crap. Being WiFi client and AP at the same time is, too: You have to “hard-code” the channel. I don’t recommend it. – Daniel B – 2014-10-09T14:43:12.920

@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 – 2014-10-11T09:04:55.853

@Dims: You could also try the TP-LINK firmware from 2014, which should in theory be the most suitable to the hardware.

– harrymc – 2014-10-11T09:08:05.797

@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. – Daniel B – 2014-10-11T11:20:25.570

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. – harrymc – 2014-10-12T18:27:49.493

Answers

1

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.

Daniel B

Posted 2014-09-29T06:10:54.550

Reputation: 40 502

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

tpcz

Posted 2014-09-29T06:10:54.550

Reputation: 11

0

In theory this can work, but it needs cooperation from all of hostapd, wpa_supplicant, the kernel drivers and the firmware on the radio itself as well as the glue that binds it within OpenWRT, in an unusual (and thus somewhat untested) setup.

I have a similar setup on similar hardware. My suspicion is that hostapd/wpa_supplicant aren't playing nicely together. Connecting via ethernet when the AP has gone down as a result of the STA mode access being lost logread shows one line in particular:

Sun Oct 12 03:54:23 2014 daemon.notice netifd: Network device 'wlan0-1' link is down

i.e. something has marked the other interfaces sharing the same radio as down too.

Doing some more digging, when all is working we can see the AP side:

> iw dev wlan0-1 info
Interface wlan0-1
    ifindex 38
    wdev 0x16
    addr XX:XX:XX:XX:XX:XX
    ssid YYYYYYY
    type AP
    wiphy 0
    channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz

When the interface is down the AP has lost SSID and channel settings:

> iw dev wlan0-1 info
Interface wlan0-1
    ifindex 38
    wdev 0x16
    addr XX:XX:XX:XX:XX:XX
    type AP
    wiphy 0

Eventually on mine the AP mode operation does seem to recover unaided.

I tried various combinations of manually resetting it, but in the end I solved it with a USB WiFi adapter to use in the USB port for the STA mode device. Multiple discrete radios is an all round better solution and cheap/easy with USB ports on OpenWRT these days.

Flexo

Posted 2014-09-29T06:10:54.550

Reputation: 1 897

0

If wpa_supplicant looses the connection it will go into an active scan cycle which renders the wiphy unusable for ap mode operation, therefore the ap is taken down if the sta looses its association. That is nothing that can be fixed easily and there are no current plans to solve this.

read more here

https://dev.openwrt.org/ticket/12000 https://forum.openwrt.org/viewtopic.php?id=41610

Alex Voskresenskiy

Posted 2014-09-29T06:10:54.550

Reputation: 1