STA WiFi drops when wired LAN is disconnected

I have an OpenWRT-based device which is not going to be used as a router and I'm attempting to have it connect to LAN via WiFi (STA mode). I used a wired connection while configuring.
Well, I got it to connect just fine except that the device drops the WiFi connection when the LAN cable is disconnected and reconnects when the LAN cable is reconnected. Basically I can't access the device over WiFi when it's not connected to a wired network (which it's not supposed to).

Here are the network / wireless configuration files, note that the device is not connected to any WAN network, only LAN.

/etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config interface 'lan'
option proto 'static'
option dns 'x.x.x.x'
option ifname 'eth0'
option netmask '255.255.254.0'
option ipaddr '192.168.0.x'
option gateway '192.168.0.1'

config interface 'wan'
option ifname 'eth1'
option proto 'dhcp'
option hostname 'xxx'

config interface 'wwan'
option proto 'dhcp'

/etc/config/wireless
config wifi-device 'radio0'
option type 'mac80211'
option phy 'phy0'
option htmode 'HT20'
list ht_capab 'SHORT-GI-40'
list ht_capab 'DSSS_CCK-40'
option disabled '0'
option noscan '1'
option channel '1'
option hwmode '11g'
option country 'IL'
option legacy_rates '1'

config wifi-iface
option network 'wwan'
option ssid 'xxx'
option encryption 'psk2'
option device 'radio0'
option mode 'sta'
option key 'xxx'

EDIT: Works when wired interface proto is set to 'dhcp', not sure though why it wouldn't work in the first place.

Please use the Preformatted Text tool </> for config files, the result should look like this:

Make sure OpenWrt's lan and wwan interfaces use different subnets.
Adjust the following options if necessary:

	option netmask '255.255.254.0'
	option ipaddr '192.168.0.x'

Remove these:

	option dns 'x.x.x.x'
	option gateway '192.168.0.1'

Also see the wiki article Connect to client Wi-Fi network.

Just to make sure I understand this correctly:
Your client is connected to the existing network, and you are trying to reach the OpenWrt device through its WiFi uplink?
Is the wwan interface assigned to the wan firewall zone on OpenWrt?

2 Likes