Attempting to caue packet loss with netem doesn't work - possibly because of NAT (but delay does work)
Posted
by
tomdee
on Server Fault
See other posts from Server Fault
or by tomdee
Published on 2012-03-20T17:09:11Z
Indexed on
2012/03/20
17:31 UTC
Read the original article
Hit count: 272
I have traffic from a WIFI access point routed via an Ubuntu box. I have two network interfaces which are NATed
*filter
:INPUT ACCEPT [11:690]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [37:6224]
-A FORWARD -s 192.168.2.0/24 -i eth1 -o eth0 -m conntrack --ctstate NEW -j ACCEPT
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
COMMIT
# Completed on Thu Mar 15 13:37:21 2012
# Generated by iptables-save v1.4.10 on Thu Mar 15 13:37:21 2012
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -j MASQUERADE
COMMIT
If I run a ping app on an Android device connected to the WIFI network I can happily ping google.
If I use netem to introduce some delay tc qdisc change dev eth0 root netem delay 100ms
I can clearly see pings taking longer.
If I use netem to introduce some packet loss tc qdisc change dev ifb0 root netem loss 50%
then I see no change.
Packet loss does work fine for locally generated traffic, just not for traffic coming in over the network that's being NATed.
Any ideas how to sort this out?
© Server Fault or respective owner