1
I have a Pi 3 B+ setup as Wi-Fi access point and would like to simulate packet delays and packet loss for connected devices communicating through the AP. I thought that I could achieve this using tc and iptables to cause packet jitter and loss for connected devices communicating through the AP but those packets are unaffected. The only packets that are affected are packets from a connected device who's destination IP is the AP or AP packets who's destination who's destination IP is a connected device. Any insight on how to affect connected devices communicating through the AP would be greatly appreciated. Also I cannot modify the software or configuration on the devices connected to the AP. I tried commands similar to the ones below on the AP without success.
tc qdisc change dev wlan0 root netem delay 100ms 10ms
tc qdisc change dev wlan0 root netem loss 0.1
iptables -D INPUT -m statistic --mode random --probability 0.2 -j DROP
iptables -D OUTPUT -m statistic --mode random --probability 0.2 -j DROP
iptables -D FORWARD -m statistic --mode random --probability 0.2 -j DROP
I tried this but with the follow command without success as the tc filter command was not working. Any other ideas would be greatly appreciated # modprobe ifb
ip link set dev ifb0 up
tc qdisc add dev eth0 ingress
tc filter add dev eth0 parent ffff: \
protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0
tc qdisc add dev ifb0 root netem delay 750ms< – user9773452 – 2018-05-14T01:08:41.173
@user9773452 How exactly was the tc filter command "not working"? Was there an error message? – Chromatix – 2018-05-14T11:02:19.263
It was a parsing error – user9773452 – 2018-05-15T03:49:45.907
@user9773452 In that case, try the version in my edited answer. – Chromatix – 2018-05-15T09:41:09.877
The commands now work but only packets that are affected are packets from a connected device who's destination IP is the AP or AP packets who's destination who's destination IP is a connected device. – user9773452 – 2018-05-15T14:45:55.150
@user9773452 That's weird. Really weird. But as a workaround you could give eth0 the same treatment. You can direct the eth0 ingress traffic to the same ifb0 device, so you don't need to duplicate that as well. – Chromatix – 2018-05-16T21:31:12.360