Intermittent wireless drop

Hi there,

I have a D-Link DIR-825 configured as an AP on OpenWRT 22.03.4. The DHCP server runs on another router (Archer A6).

Symptoms From time to time, an iPhone connected to the D-Link AP displays "no internet access" despite signal being strong. Wired network is unaffected, including wired devices connected to the DIR-825

When it last happened, the syslog displayed this message endlessly:

Mon May 15 23:28:53 2023 daemon.warn hostapd: Failed to check if DFS is required; ret=-1

Configuration On the A6, a few static DHCP addresses, non-default DNS servers on the WAN side, a few ports forwarded through the firewall. The D-Link just redirects DNS requests to the A6. The iPhone doesn't have any VPN turned on.

Already tried as per this comment, I set the channel explicitly instead of letting OpenWRT choose it.

Ideas?

The error appears pretty clear... this is related to the wireless channel and country code... let's see your wireless config file.

To be noted: I didn't change the wireless configuration in a while, and the error never appeared before.

sure... but let's see how it is configured...

Please 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:

cat /etc/config/wireless

Also worth noting, there was another error in your log file...

Wed May 12 10:12:38 2021 daemon.err hostapd: Wrong coupling between HT and VHT/HE channel setting

Was that my log??

Here it is:

onfig wifi-device 'radio0'
	option type 'mac80211'
	option hwmode '11g'
	option path 'pci0000:00/0000:00:11.0'
	option htmode 'HT20'
	option cell_density '0'
	option channel '9'
	option country 'US'

config wifi-device 'radio1'
	option type 'mac80211'
	option hwmode '11a'
	option path 'pci0000:00/0000:00:12.0'
	option cell_density '0'
	option htmode 'HT40'
	option country 'US'
	option channel '100'

config wifi-iface 'ap_g'
	option device 'radio0'
	option mode 'ap'
	option disassoc_low_ack '0'
	option ssid 'Gargoyle-1'
	option encryption 'psk2'
	option key 'WPA2_KEY'
	option network 'lan'

config wifi-iface 'ap_a'
	option device 'radio1'
	option mode 'ap'
	option network 'lan'
	option disassoc_low_ack '0'
	option ssid 'Gargoyle-2'
	option key 'WPA2_KEY'
	option encryption 'psk2+ccmp'

Channel 100 is a DFS channel in the US. See the DFS channels shown in this table and set your channel to something outside the DFS range.

Also, you might need the htmode to be VHT40, but I am actualy not an expert on OpenWrt's wireless configs.

Hm, I should have specified: the issue occurs on the 2.4GHz band. According to the table, DFS is allowed. One thing I don't get, though, it the option hwmode set to 11a whereas I set it up as "n"

How do I change the option htmode from LuCI?

The 2.4G band doesn't have DFS channels, so the message you described at the beginning is related to your 5G radio. I'd recommend you fix that.

As for your 2.4G radio -- channel 9 is usually not a good channel. You should be using 1, 6, or 11. Try changing to one of those channels and see if your situation improves.

2 Likes

Choosing channel 9 was on purpose as 1, 6 and 11 are crowded according to the channel scan (20, 18 and 30 SSIDs respectively), and emitting at a rather high power. However, I'd rather let OpenWRT automatically choose the best one…

About 2.4 GHz band channel selection:

channel 9 overlapps with both channels 6 and 11, so theoretically there would be more interference, if you choose that one.

See here:

Wifi channels have a certain channel width. In wifi 4 (802.11n) it is usually set to 20 MHz (recommended to avoid interference), but it can be forced to 40 MHz. If you see lots of 40 MHz wide channel bandwidth usage, you could try to talk to your neighbours and negotiate 20 MHz usage.

Since you have a LOT of devices in your neighbourhood using the 2.4 GHz band, using the 5 GHz band would make sense obviously...

About ht mode and hw mode:

Check out https://openwrt.org/docs/guide-user/network/wifi/basic

I found

Name Type Required Default Description
hwmode string no (driver default) Specifies the hardware mode, possible values are 11b for 2.4 GHz (used for legacy 802.11b only), 11g for 2.4 GHz (used for 802.11b, 802.11g and 802.11n) and 11a for 5 GHz (used for 802.11a, 802.11n and 802.11ac). Note that 11ng, 11na, 11n and 11ac are invalid options, this setting should largely be seen as controlling the frequency band. (DEPRECATED since 21.02.2, replaced with band)
band string no (driver default) Specifies the band, possible values are 2g for 2.4 GHz, 5g for 5 GHz, 6g for 6 GHz and 60g for 60 GHz. (NEW since 21.02.2, replaces hwmode)
htmode string no (driver default) Specifies the high throughput mode, used to control 802.11n (HT), 802.11ac (VHT) and 802.11ax (HE). The channel width used for these depends on this configuration. See this section for details. Possible values are: HT20, HT40-, HT40+, HT40, or VHT20, VHT40, VHT80, VHT160, NOHT disables 11n and 11ac, HE20, HE40, HE80, HE160

your device is configured to use ht (high throughput; 802.11n standard) on the 5 GHz band, whereas it probably would be better to use vht indeed. Maybe you also have to replace the hwmode 11a option with a band option. No clue.

You said you used the UI to configure this, but now you have wrong values, so for whatever reason, apparently something is wrong. Maybe you upgraded from older versions of OpenWrt and kept old configuration files or maybe you encountered a bug. Be it as it may, better to use commandline for now.

2 Likes

As already discussed by @ThiloteE, the reason for using the 3 specified channels is because you need guard bands between the channels to avoid overlap/interference. Therefore, your choice to use channel 9 is the worst of both worlds, effectively combining the noise of 6 and 11 as interference for channel 9.

2 Likes

Among the other symptoms:
a bunch of smart plugs regularly have trouble connecting to the 2.4GHz band (many seconds to connect, which kind of defeats the purpose of a wifi switch).

Thanks for all those details, as I understand:

  • htmode vht would be impossible on this 802.11n router;
  • changing hwmode wouldn't have any effect since the setting is deprecated
  • Unsure what setting band 5g may do since both radios are distinct.

Since hwmode isn't supposed to have any effect, I removed the option in /etc/config/wireless

That I did as I didn't want to loose wireless connectivity. I remember fiddling for a while before finding the right settings for an AP (not a repeater, not to piggyback a second router) and use the connected USB drive as root. For some reason, the firmware generator always failed for this board when trying to customize included packages.

As for the channels: none of the detected ones list "40MHz", though a few are marked "40MHz intolerant". Even if there were, I doubt I could 1- Find whose SSID it is 2- Convince neighbours to use 20MHz width 3- Help them find the right setting. From the MAC address, most are using their ISP's boxes preconfigured for maximum range, not good neighbour practices, and their custom firmware typically don't expose any advanced setting (costs less in tech support when something goes wrong).

Pardon my ignorance, but should I understand it's better for all 80+ SSIDs to use the same three channels to avoid interference than try to spread them over the full range?

Depending on the upgrade path (previous > current), you may have done something that is unsupported. For example, upgrades (keeping settings) from 19.07 to 22.03 are not supported and may well cause the behavior you are seeing.

If that is the case, you should reset to defaults and configure again from scratch. Make a backup first and you'll have a reference by which you can recreate your settings. Obviously wifi will be disabled by default, so make sure you have an ethernet connection when you do this.

If you've ever tuned an AM/FM radio, you'll know that sometimes you will pass through a section of the range that is between two closely spaced radio stations... you can hear the audio from both of them on top of each other. The radio stations themselves are spaced such that there will never be overlap when you are centered properly on that station, but there must be 'guard bands' on either side to prevent overlap with other stations. Wifi (in the 2.4G band) is the same deal -- you can use 1, 6, and 11, but you need to skip 2-5 and 7-10 for those reasons (i.e. if you're on channel 6, there is the potential for anyting on channels 3-5 and 7-9 to overlap with your signal). When you use channel 9, you're actually in a worse situation than if you had used 6 or 11 because of the fact that 9 will be a similar situation as the overlapping radio stations, making it much harder to get a usable signal.

All you have to do is run an RF scan and see which of the 3 channels has the lowest noise floor... and then use that. You don't have to bother your neighbors (although yes, it would be good if everyone configured their wifi to cover only the necessary range by lowering the output power).

2 Likes

That I think I did. This router previously ran Gargoyle, a customized OpenWRT 19.07 version. I don't recall why I chose this particular version, though.

I tried just that, but the DIR-825 gives an unrealistically low -95dBm, even after reinstalling. Another router in a different place gives -76dBm, -74dBm, -77dBm on channel 1, 6, 11 respectively, so it may vary a bit.

Anyway I tried to reinstall and reconfigure from scratch, not saving anything, following the wiki's page. I notice there's no LuCI-accessible way to change port for HTTPS, but that's a minor issue.

Since this router doesn't have a lot of flash space available, I wanted to use an older 16GiB USB 2.0 thumb drive as extroot to hold additional packages. Problem is, trying to customize an image always fails for this router so I can't use it to generate a custom image either. Besides, the USB drive was already being used to hold log files on the same router. I don't mind losing these if necessary

Basic configuration:
What I did:
Install required packages:
Since I want to use f2fs as recommended for thumb drives, there are no ext2 or ext4 utility, nor is there any USB3 module. I didn't install usbutils as this is a known-good USB drive.

opkg update && opkg install block-mount kmod-fs-f2fs kmod-usb-storage kmod-usb2 

Fast-forward to the end of the wiki page, it does automatically mount and all appeared to work.

Using the USB drive as extroot:
I configured rootfs_data to be mounted someplace else as it seemed like a good idea to have the original /overlay still available. The closing note is unclear, though. As I understood it:

The /rwm mount will not mount via block until you've already successfully booted into your extroot configuration.

Meaning that I have to proceed in order for the setup to be complete.

Configuring the selected partition as new overlay:
I didn't use a mkfs.f2fs command as the drive is already formatted and partitioned. I also rebooted after the commit, just to check it is working properly.

DEVICE="/dev/sda1"
eval $(block info ${DEVICE} | grep -o -e "UUID=\S*")
uci -q delete fstab.overlay
uci set fstab.overlay="mount"
uci set fstab.overlay.uuid="${UUID}"
uci set fstab.overlay.target="/overlay"
uci commit fstab
reboot

Transferring data:

mount ${DEVICE} /mnt

That should mount the /dev/sda1 to /mnt as /mnt/sda1, and it is, according to the mount command:

/dev/sda1 on /mnt/sda1 type f2fs (rw,lazytime,relatime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=reuse,fsync_mode=posix)

However, that's also where it failed with an "out of space"-style error as I tried to move the files from the old overlay to the new.

After a reboot, I got the dreaded

Your JFFS2-partition seems full and overlayfs is mounted read-only.
Please try to remove files from /overlay/upper/... and reboot!

What is taking up so much space:

# du -sh *
25.5K	etc
704.0K	lib
1.8M	mnt
28.5K	sbin
680.5K	usr

and:

/overlay/upper/mnt/upper# du -sh *
22.0K	etc
704.0K	lib
398.5K	mnt
677.5K	usr

But I don't know what can be removed from /overlay/upper since it's mounted read-only.

Help appreciated.

I'm going to give you my exact recipe for setting up extroot. It has never failed me. Follow it exactly, but start with an ext4 formatted flash drive and a default install (reset to defaults).

opkg update; opkg install block-mount kmod-usb-storage kmod-fs-ext4
reboot

Then insert flash disk (preformatted ext4) and make sure it is recognized at /dev/sda1.

block info

Assuming it is, continue:

mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt

block detect > /etc/config/fstab; \
   sed -i s/option$'\t'enabled$'\t'\'0\'/option$'\t'enabled$'\t'\'1\'/ /etc/config/fstab; \
   sed -i s#/mnt/sda1#/overlay# /etc/config/fstab; \
   cat /etc/config/fstab;
   
reboot

Finally, # Verify that the extroot has worked by checking the disk free

df -h

Let me know what happens.

Thanks, but is there a specific reason why you recommend ext4?
After all, the wiki says f2fs is the recommended filesystem for flash drives, presumably to save on wear (journal is always in the same block otherwise), but also general speed (though it probably isn't very important on a dumb AP). My drive has seen quite a bit of use over the years and I'd rather not try to debug the non-specific issues that can arise when a flash-based storage wears out.

The extroot wiki article assumes ext4.

The following assumes that you will be creating your extroot as an EXT4 filesystem on your OpenWRT device with a connected USB flash drive. The process is similar for other kinds of devices.

On flash wear, this is actually not much of an issue with a standard extroot configuration since OpenWrt writes data very infrequently. It may be more of an issue if you are sending logs to the flash disk, but modern USB flash storage is cheap, easy to source, and reasonably reliable. If you're doing anything mission critical, don't write logs to the same physical device as your extroot. If it's a home setup and not a major issue if you have a problem, do whatever works for you... just make sure you have backups should your usb stick fail... super easy to redo the extroot process with a new device if necessary.

1 Like

That I did, but now you say it… It was probably to find out why the wireless connection dropped intermittently. You're right, it may not be an issue anymore. I'll try and keep you postd.

TL:DR: It works. Now I must have a closer look at sed manpage.

As I undestood it, unlike the original wiki page, this method assumes:

  1. Previous formatting and partitioning done on a Linux machine, or another router with more memory to install all the required tools;
  2. Optional modules that are used to test out and verify aren't installed (usbutils);
  3. Optional modules aren't installed / necessary (USB 3 support, UAS, etc.)

Remaining issue:
wireless doesn't show correct noise level.

Closing remarks
Even though this 2010 router is hopelessly outdated, it can still be useful in 2023 for non-critical wifi traffic. It meets the bare minimum requirements for OpenWRT at 8MiB Flash and 64MiB RAM, which isn't enough (ironically) to install the full, recommended toolkit for external storage setup with only 3328KiB available in /overlay. From all the documentation available in the wiki and the mods, though, it appears to be a rare case of over-engineering. I just learned it likely has a second, un-populated USB2.0 port inside. Could come in handy should I want to install the USB drive more permanently inside the enclosure and use the external port for something else.
While F2FS is recommended for controller-less flash-based storage, ext4 has better built-in support in Linux. Downside is, well, you need a Linux computer or virtual machine to format it, or another, supported router.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.