Packet loss & Ping spikes

Setup: The RPi4 is the router connected to the isp pppoe feed with the USB dongle.
Which has the Mi router (configured as a wireless access point) connected via the Pi's LAN ethernet.
Firmware: Any build

Issues:

  1. When I ping from LAN to wifi devices it shows packet loss & ping spikes. What's weird is that when I ping from wireless devices to lan ping is stable as normal. LAN to LAN wired network there's no problem.
  2. On wireless devices even though at very close proximity in-games ping goes to >200ms even at no load.

Tried all default settings with no SQM module & it still happens. The problem is related to OpenWrt. LAN cables are fine.
Someone kindly help me fix this, this is really driving me crazy

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 type 'bridge'
	option ifname 'eth0'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'

config interface 'wan'
	option proto 'pppoe'
	option ifname 'eth1'
	option username 'asdasdasd'
	option password 'asdasdasd'

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 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 confdir '/tmp/dnsmasq.d'
	list server '127.0.0.1#5053'
	list server '127.0.0.1#5054'
	option noresolv '1'
	option doh_backup_noresolv '-1'
	list doh_backup_server '127.0.0.1#5053'
	list doh_backup_server '127.0.0.1#5054'

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

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

config host
	option name 'Router'
	option dns '1'
	option mac '84:27:E9:B4:84:84'
	option ip '192.168.1.1'

config/firewall


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

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'

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 src_ip 'fc00::/6'
	option dest_ip 'fc00::/6'
	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 rule
	option name 'Support-UDP-Traceroute'
	option src 'wan'
	option dest_port '33434:33689'
	option proto 'udp'
	option family 'ipv4'
	option target 'REJECT'
	option enabled 'false'

config include
	option path '/etc/firewall.user'

config include 'miniupnpd'
	option type 'script'
	option path '/usr/share/miniupnpd/firewall.include'
	option family 'any'
	option reload '1'

config redirect
	option target 'DNAT'
	option name 'DMZ'
	option src 'wan'
	option src_dport '0-65535'
	option dest 'lan'

Update: Issue 1 is resolved. It's due to phones power saving mode ping was spiking. Issue 2 in-game UDP packets randomly fluctuate to the point games are literally unplayable. (I also changed my ISP)

Not that it helps, but the PI's wifi chip simply does not seem up to the task....

1 Like

This is absolutely the issue... Maybe @AlanDias17 has the devices reversed... Put the Pi as the router and whatever is the router now make it an AP?

But I also tried router's wifi rather RPi4's wifi. It's the same issue with wifi connected devices.

Phone 1,2,3,.. wirelessly connected to the router <==wired==>RPi4 (AP)<==wired==>PC1,2..

PC to phone packet loss & high pink spikes but ping to WAN works normally.
Phone to PCs shows normal ping
This is so awkard??

If you're trying to ping a phone you'll find that their power saving causes you to lose packets and have high latency. try making sure the phone screen is on and you're doing something with it... and then run your ping to it.

1 Like

My first thought exactly but when I connect to my brother's router (TPLINK) it shows normal ping. So idk where's the problem? looks at OpenWrt

but when the screen is on and you're doing stuff, what is the ping like?

When the screen is off after 20 sec "Request timeout" on both routers. When phone screen is on
On my setup its 2ms-800ms varies
On my brother's router phone shows 10ms-80ms max
Edit: Also I did network reset on all devices before testing everything.

Hmm. Let's ignore the RPi for the moment, test against your main router. what hardware is that?

It's the 2 years old MI router (Good condition working) Also sorry about the mistake I did in my post. RPi is a switch & router is connected to it acts as a wireless router

What role does the RPi actually play here. Is it just bridging between two interfaces? Does it do bridge filtering? Is it's built in wifi chip involved at all?

It has two basic simple interfaces. LAN bridge & WAN. I've a custom firewall for filtering & SQM purpose. But it won't matter bcz the problem still reoccur at default clean settings with no custom filtering firewall. Whether built in wifi chip enabled or disabled the problem persist on wireless devices.

You seem to have your pi set up as a router using 2 ethernet interfaces, yet a pi4 only has one.
Do you have a usb ethernet dongle?
What is the wan interface connecting to using pppoe? Your isp router? Is that router in bridge mode? What is its ip address? What is connected to what by ethernet?
You say the pi is a switch.... with only a single ethernet port ... and no switch configuration...
What are you actually trying to do?

I tried heavy CPU usage on phones and it solved the high ping problem. Your advice worked!
But now the only problem left behind is I get random UDP fluctuation high latency only in games. Both on wired or wireless devices. Seems like it's only related to UDP packets. Any guess?

Yes I do TP-Link UE300 USB 3.0

RPi is directly connected to the ISP WAN then another router to RPi for Wi-Fi

Yep. TP-Link UE300 USB 3.0 goes to RPi USB for WAN interface and Ethernet port goes to the MI router which serves LAN connections & WiFi
Btw PC to phone ping problem is resolved. As dlakelan mentioned it's due to power saving.

You should really learn to use the correct terminology - and learn the difference between a wireless router and a wireless access point. Also the pi4 is still not a switch.
So in summary:

  • The pi4 is the router connected to the isp pppoe feed with the usb dongle.
  • The pi4 has the MI (configured as a wireless access point) connected via the pi's lan ethernet.

You don't say where the udp packets are coming from/being sent to, but would guess that most likely it is the MI dropping packets on the wifi connection - assuming you are using the wifi and pushing it hard - you have not given much information to work with.

Couldn't summarized better and thank you. If I'm connected to either Mi or RPi4 WiFi and start playing games in-game ping goes high 200ms> at no load ofc at the same time if I ping to phone it remains normal. So it gotta be related to UDP packets. My first thought was it's due to MiniUPnP module but even at fresh default settings it happens.
I also switched the router with TPLink still the same