Wifi connection lost after a few minutes

Hi all, I'm new here and hope I can find some help!

After some hours of try-and-error I managed to get OpenWrt installed on an old FritzBox.

I am currently connecting to it via LAN cable but want to use WIFI to connect more devices. The problem is when I disconnect the LAN cable and connect WIFI it works for like 2-5 minutes and then loses connection. After that I need to connect the LAN cable again to even open the LUCI portal in the browser.

Is this a known problem?

does it solve the wifi issue ?

who knows, there's plenty of Fritz! devices, and we're no mind readers.

While LAN is connected the laptop uses that for the internet connection so I need to disconnect it again to test WIFI. But it only works again after restarting the radio, then disconnect LAN, connect WIFI, after a few minutes it disconnects again and I need to repeat.

FritzBox 7412 with latest OpenWrt version 23.05.5.

In the system logs I can see that STA-OPMODE-SMPS-MODE-CHANGED gets spammed by changing between OFF and STATIC every second, is that related?

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall

Sorry for the delay, I hope I redacted everything correctly:

/etc/config$ ubus call system board
{
	"kernel": "5.15.167",
	"hostname": "Portal",
	"system": "xRX200 rev 1.2",
	"model": "AVM FRITZ!Box 7412",
	"board_name": "avm,fritz7412",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "23.05.5",
		"revision": "r24106-10cc5fcd00",
		"target": "lantiq/xrx200",
		"description": "OpenWrt 23.05.5 r24106-10cc5fcd00"
	}
}
/etc/config$ cat /etc/config/network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'REDACTED'

config atm-bridge 'atm'
	option vpi '1'
	option vci '32'
	option encaps 'llc'
	option payload 'bridged'
	option nameprefix 'dsl'

config dsl 'dsl'
	option annex 'b'
	option tone 'av'
	option ds_snr_offset '0'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan'

config device
	option name 'lan'
	option macaddr 'REDACTED'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr 'REDACTED'
	option netmask 'REDACTED'
	option ip6assign '60'
	list dns 'REDACTED'

config device
	option name 'dsl0'
	option macaddr 'REDACTED'

config interface 'wan'
	option proto 'dhcp'
	option type 'bridge'
	option device 'br-lan'
	option force_link '1'

config interface 'wan6'
	option device '@wan'
	option proto 'dhcpv6'
	option type 'bridge'

config interface 'wwan'
	option proto 'dhcp'

config interface 'WGINTERFACE'
	option proto 'wireguard'
	option private_key 'REDACTED'
	list addresses 'REDACTED'
	option force_link '1'

config wireguard_WGINTERFACE
	option public_key 'REDACTED'
	list allowed_ips 'REDACTED'
	option route_allowed_ips '1'
	option endpoint_host 'REDACTED'
	option endpoint_port 'REDACTED'

/etc/config$ cat /etc/config/wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'pci0000:00/0000:00:00.0/0000:01:00.0'
	option channel '4'
	option band '2g'
	option htmode 'HT20'
	option cell_density '0'
	list ht_capab 'SMPS-STATIC'
	option noscan '1'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'REDACTED'
	option encryption 'psk2'
	option key 'REDACTED'
	option wpa_disable_eapol_key_retries '1'
	option disassoc_low_ack '0'
	option skip_inactivity_poll '1'
	list ht_capab 'SMPS-STATIC'
	option max_inactivity '3000'

/etc/config$ cat /etc/config/dhcp

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option cachesize '1000'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option localservice '1'
	option ednspacket_max '1232'
	list server 'REDACTED'
	option strictorder '1'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option force '1'

config dhcp 'wan'
	option interface 'wan'
	option start '100'
	option limit '150'
	option leasetime '12h'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

/etc/config$ cat /etc/config/firewall

config defaults
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option synflood_protect '1'

config zone
	option name 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	list network 'lan'

config zone
	option name 'WGZONE'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	list network 'WGINTERFACE'

config zone
	option name 'wan'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	list network 'wan'
	list network 'wan6'
	list network 'wwan'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option dest_port '546'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-MLD'
	option src 'wan'
	option proto 'icmp'
	option src_ip 'fe80::/10'
	list icmp_type '130/0'
	list icmp_type '131/0'
	list icmp_type '132/0'
	list icmp_type '143/0'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Input'
	option src 'wan'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Forward'
	option src 'wan'
	option dest '*'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-IPSec-ESP'
	option src 'wan'
	option dest 'lan'
	option proto 'esp'
	option target 'ACCEPT'

config rule
	option name 'Allow-ISAKMP'
	option src 'wan'
	option dest 'lan'
	option dest_port '500'
	option proto 'udp'
	option target 'ACCEPT'

config forwarding
	option src 'lan'
	option dest 'WGZONE'


You've over-redacted thigns here, but it's clear that you have maor issues.

For example, why is the wan connected to br-lan:

It will probably be faster to restart from scratch than to fix your existing problems. I recommend making a backup so you can grab some of the things like the wg config (copy-paste back into place), but your current config shouldn't be restored.

1 Like

Sorry, I was not sure which I could leave. Let me know if anything redacted is needed.

Not sure about wan and br-lan. I think I tried some things from different tutorials and it ended up like this. I'll try the reset if I have some time tomorrow. Found this manual here https://openwrt.org/docs/guide-user/troubleshooting/failsafe_and_factory_reset#soft_factory_reset

RFC1918 addresses are not sensitive information and should be left in place (i.e. 192.168.x.x, 172.16.x.x - 172.31.x.x, 10.x.x.x). This helps us understand the configuration. And the subnet masks do not need to be redacted, either.

Yeah, you probably introduced many different issues along the way, is my guess.

You can use the failsafe method, but if you are able to connect to the router in general, all you need to do is click the reset to defaults button in the LuCI web interface or issue firstboot -y && reboot in an ssh session.

Sorry for the delay. Did not have much time this week.

I exported the backup and performed the reset as asked. But now I have trouble even enabling WIFI because I don't remember what I did last time.
I did go to Network > Wireless and pressed Enable on the OpenWrt entry below radio0. Then I also used the blue Edit button to set Encryption to WPA2-PSK and gave a password.

The problem now is that my phone will not connect to it even with the right pw.

Here is a new log of the commands:

/etc/config$ ubus call system board
{
	"kernel": "5.15.167",
	"hostname": "OpenWrt",
	"system": "xRX200 rev 1.2",
	"model": "AVM FRITZ!Box 7412",
	"board_name": "avm,fritz7412",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "23.05.5",
		"revision": "r24106-10cc5fcd00",
		"target": "lantiq/xrx200",
		"description": "OpenWrt 23.05.5 r24106-10cc5fcd00"
	}
}
/etc/config$ cat /etc/config/network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'REDACTED'

config atm-bridge 'atm'
	option vpi '1'
	option vci '32'
	option encaps 'llc'
	option payload 'bridged'
	option nameprefix 'dsl'

config dsl 'dsl'
	option annex 'b'
	option tone 'av'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan'

config device
	option name 'lan'
	option macaddr 'REDACTED'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config device
	option name 'dsl0'
	option macaddr 'REDACTED'

config interface 'wan'
	option device 'dsl0'
	option proto 'pppoe'
	option username 'username'
	option password 'password'
	option ipv6 '1'

config interface 'wan6'
	option device '@wan'
	option proto 'dhcpv6'

/etc/config$ cat /etc/config/wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'pci0000:00/0000:00:00.0/0000:01:00.0'
	option channel '4'
	option band '2g'
	option htmode 'HT40'
	option cell_density '0'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'psk2'
	option key 'REDACTED'

config wifi-iface 'wifinet1'
	option device 'radio0'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'none'

/etc/config$ cat /etc/config/dhcp

config dnsmasq
	option domainneeded '1'
	option boguspriv '1'
	option filterwin2k '0'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option nonegcache '0'
	option cachesize '1000'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option nonwildcard '1'
	option localservice '1'
	option ednspacket_max '1232'
	option filter_aaaa '0'
	option filter_a '0'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	option ra_slaac '1'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

/etc/config$ cat /etc/config/firewall
config defaults
	option syn_flood	1
	option input		REJECT
	option output		ACCEPT
	option forward		REJECT
# Uncomment this line to disable ipv6 rules
#	option disable_ipv6	1

config zone
	option name		lan
	list   network		'lan'
	option input		ACCEPT
	option output		ACCEPT
	option forward		ACCEPT

config zone
	option name		wan
	list   network		'wan'
	list   network		'wan6'
	option input		REJECT
	option output		ACCEPT
	option forward		REJECT
	option masq		1
	option mtu_fix		1

config forwarding
	option src		lan
	option dest		wan

# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
	option name		Allow-DHCP-Renew
	option src		wan
	option proto		udp
	option dest_port	68
	option target		ACCEPT
	option family		ipv4

# Allow IPv4 ping
config rule
	option name		Allow-Ping
	option src		wan
	option proto		icmp
	option icmp_type	echo-request
	option family		ipv4
	option target		ACCEPT

config rule
	option name		Allow-IGMP
	option src		wan
	option proto		igmp
	option family		ipv4
	option target		ACCEPT

# Allow DHCPv6 replies
# see https://github.com/openwrt/openwrt/issues/5066
config rule
	option name		Allow-DHCPv6
	option src		wan
	option proto		udp
	option dest_port	546
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-MLD
	option src		wan
	option proto		icmp
	option src_ip		fe80::/10
	list icmp_type		'130/0'
	list icmp_type		'131/0'
	list icmp_type		'132/0'
	list icmp_type		'143/0'
	option family		ipv6
	option target		ACCEPT

# Allow essential incoming IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Input
	option src		wan
	option proto	icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	list icmp_type		router-solicitation
	list icmp_type		neighbour-solicitation
	list icmp_type		router-advertisement
	list icmp_type		neighbour-advertisement
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

# Allow essential forwarded IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Forward
	option src		wan
	option dest		*
	option proto		icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-IPSec-ESP
	option src		wan
	option dest		lan
	option proto		esp
	option target		ACCEPT

config rule
	option name		Allow-ISAKMP
	option src		wan
	option dest		lan
	option dest_port	500
	option proto		udp
	option target		ACCEPT


### EXAMPLE CONFIG SECTIONS
# do not allow a specific ip to access wan
#config rule
#	option src		lan
#	option src_ip	192.168.45.2
#	option dest		wan
#	option proto	tcp
#	option target	REJECT

# block a specific mac on wan
#config rule
#	option dest		wan
#	option src_mac	00:11:22:33:44:66
#	option target	REJECT

# block incoming ICMP traffic on a zone
#config rule
#	option src		lan
#	option proto	ICMP
#	option target	DROP

# port redirect port coming in on wan to lan
#config redirect
#	option src			wan
#	option src_dport	80
#	option dest			lan
#	option dest_ip		192.168.16.235
#	option dest_port	80
#	option proto		tcp

# port redirect of remapped ssh port (22001) on wan
#config redirect
#	option src		wan
#	option src_dport	22001
#	option dest		lan
#	option dest_port	22
#	option proto		tcp

### FULL CONFIG SECTIONS
#config rule
#	option src		lan
#	option src_ip	192.168.45.2
#	option src_mac	00:11:22:33:44:55
#	option src_port	80
#	option dest		wan
#	option dest_ip	REDACTED
#	option dest_port	120
#	option proto	tcp
#	option target	REJECT

#config redirect
#	option src		lan
#	option src_ip	192.168.45.2
#	option src_mac	00:11:22:33:44:55
#	option src_port		1024
#	option src_dport	80
#	option dest_ip	REDACTED
#	option dest_port	120
#	option proto	tcp

Edit: Restarted radio1 and waited 1 minute. Now I can connect. Will try to see how stable it is and move to the next problem for now.

5ghz radio listens for radar for one minute before transmitting. For less functional wifi cards it means listening each option at a time for a minute then choosing ok channel. or in other words check logs if 5ghz radio is not up in 10 minutes.

I think this FritzBox 7412 only has 2.4ghz.
What I did do was go into Status > Channel Analysis where I saw that channel 1 had much overlap from nearby WIFIs so I went into Network > Wireless > Edit on the OpenWrt option and changed the Operating Frequency Channel to 4 which was free in the Channel Analysis. And changed Width to 40MHz for a strong signal if I understood that right.

Don’t use channel 4. Try 1, 6, or 11.

Delete this:

Restart and test again.

Don’t use channel 4. Try 1, 6, or 11.

Why not? It should be just like the other ones from 1 to 13, no?

Delete this:
Restart and test again.

Done.

Edit: Okay I found this https://www.reddit.com/r/techsupport/comments/pkiehs/my_neighbor_is_using_channel_4_for_his_24ghz_wifi/ and https://www.reddit.com/r/HomeNetworking/comments/k8ukpn/channel_1_6_11_congested_what_is_the_best/ which explains it. I set it to 6 now.

Problem now is that I have no internet again coming from a second router, see Get internet from second router over LAN
Interestingly that one worked before I changed this channel to 6. But right after I could not reach the OpenWrt router over WIFI again so I disconnected the LAN cable from the Fritzbox and connected the OpenWrt router to the laptop to open the the web ui and restart the radio1 which fixed the WIFI when I changed from 1 to 4 before.
Afterwards connected the OpenWrt router to the FritzBox again. I can still access the web ui over WIFI.

It's not like any other.
WiFi channels are overlapping, the typical (on 2.4 GHz) 20 MHz channel bandwidth spans over 3 channels at once - and partial overlap is even worse than full-on overlap (as that makes the interference unintelligible, so that collision avoidance mechanisms don't apply).

The only non-overlapping 20 MHz channels on 2.4 GHz are 1, 6 and 11, which has become the standard (global) channel roaster for 2.4 GHz. Yes, for Europe/ ETSI it would be (almost) possible to cram 4 channels into the spectrum up to ch13, but the prevalence of the 'default' 1-6-11 roaster makes that a futile (and actively harmful) effort, unless you have no neighbours and can implement your own 4-channel roaster undisturbed from outside interference.

https://en.wikipedia.org/wiki/List_of_WLAN_channels#2.4_GHz_.28802.11b.2Fg.2Fn.2Fax.2Fbe.29

1 Like

Got it. Might be a nice-to-have as an info box in the ui for non-power-users :wink:

Now looking to fix the next problem Get internet from second router over LAN