I want to do some testing, and add some delay to web traffic (have web pages load slowly)
I found the netem app and have installed it, as well as read over the openwrt page for it ,
It seems to suggest
tc qdisc add dev eth0 root netem delay 100ms
(ill probably use 1000ms)
My question is how do i turn it off when im done?
tc qdisc del dev eth0 root
That would leave you with pfifo_fast, the default when there's no qdisc specified. You might want to replace it with some other qdisc instead
tc qdisc replace dev eth0 root ....
Also, be aware that netem is going to give you delay, but not bandwidth reduction. So the connection will take a while to get started, but the quantity of information you can transmit per second once it's started will be unaffected (at least basically it won't be queueing and dropping packets like a traffic shaper).
1 Like
sorry but i dont understand the ramifications of doing del
vs replace
, can you explain that a bit more?
i guess that del
will put me back to how it was prior to adding the delay though, correct?
also i just did that command
tc qdisc add dev eth0 root netem delay 1000ms
and there is no noticeable different with web pages loading. any ideas why?
Owengerig:
sorry but i dont understand the ramifications of doing del
vs replace
, can you explain that a bit more?
i guess that del
will put me back to how it was prior to adding the delay though, correct?
Del will cause the kernel to put a pfifo_fast on that interface. This is probably not what it had before you did the netem because by default openwrt uses fq_codel I think. So replace would allow you to specify any other qdisc you want, and there are many options.
First, is eth0 your WAN interface, LAN interface, what? Second, you realize that a gigabit interface must have 128MB of buffer to buffer 1000ms of data right?
Perhaps you can describe your test setup a little more thoroughly. What devices are involved, which interface is the netem on, and what kinds of speeds do you have on the various interfaces. That would help a lot.
1 Like
is there a way for me to see what my qdisc is prior to changing it?
My test setup: trying to add delay/lag to all web page request done by any clients on the lan. nothing special, i have my openwrt router and a few clients (pcs, mobile devices, etc) on the lan. I want these clients to experience the lag/delay when web surfing
br-lan Link encap:Ethernet HWaddr 94:10:3E:80:0A:0B
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fd22:c70b:d405::1/60 Scope:Global
inet6 addr: fe80::9610:3eff:fe80:a0b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13024530 errors:0 dropped:0 overruns:0 frame:0
TX packets:19088947 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1690480996 (1.5 GiB) TX bytes:34553808151 (32.1 GiB)
eth0 Link encap:Ethernet HWaddr 94:10:3E:80:0A:0B
inet6 addr: ff80::9610:3eff:fe80:a0b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5183427 errors:0 dropped:0 overruns:0 frame:0
TX packets:8092820 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1024
RX bytes:466878368 (445.2 MiB) TX bytes:20908120900 (19.4 GiB)
Interrupt:26
eth0.1 Link encap:Ethernet HWaddr 94:10:3E:80:0A:0B
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5181879 errors:0 dropped:0 overruns:0 frame:0
TX packets:7996090 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:373495138 (356.1 MiB) TX bytes:20869366065 (19.4 GiB)
eth1 Link encap:Ethernet HWaddr 94:10:3E:80:0A:0B
inet6 addr: ff80::9610:3eff:fe80:a0b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:72241345 errors:0 dropped:0 overruns:0 frame:0
TX packets:25426996 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1024
RX bytes:58988922343 (54.9 GiB) TX bytes:9884358035 (9.2 GiB)
Interrupt:27
eth1.2 Link encap:Ethernet HWaddr 94:10:3E:80:0A:0B
inet addr:73.45.142.105 Bcast:72.35.159.255 Mask:255.255.224.0
inet6 addr: fe80::9610:3eff:fe80:a0b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:64252451 errors:0 dropped:0 overruns:0 frame:0
TX packets:25426971 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:57282621899 (53.3 GiB) TX bytes:9782645704 (9.1 GiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:6361 errors:0 dropped:0 overruns:0 frame:0
TX packets:6361 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:618694 (604.1 KiB) TX bytes:618694 (604.1 KiB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:192.168.8.1 P-t-P:192.168.8.1 Mask:255.255.255.0
inet6 addr: fe80::3f09:d4fd:f525:7617/64 Scope:Link
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:304 (304.0 B)
wireguard Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.0.10.1 P-t-P:10.0.10.1 Mask:255.255.255.240
UP POINTOPOINT RUNNING NOARP MTU:1420 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:755 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 94:10:3E:80:0A:0C
inet6 addr: ff80::9610:3eff:fe80:a0c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:429617 errors:0 dropped:0 overruns:0 frame:0
TX packets:687394 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:97601518 (93.0 MiB) TX bytes:636335184 (606.8 MiB)
wlan1 Link encap:Ethernet HWaddr 94:10:3E:80:0A:0D
inet6 addr: ff80::9610:3eff:fe80:a0d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7555872 errors:0 dropped:0 overruns:0 frame:0
TX packets:12067254 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1393735532 (1.2 GiB) TX bytes:13474386817 (12.5 GiB)
tc qdisc show dev eth0
should do it.
I think you should probably be adding the qdisc to eth0.1 though. This is likely the LAN interface no? (it would be more informative to get the output of "ip addr show" rather than ifconfig which is deprecated and generally less useful)
1 Like
dlakelan:
ip addr show
root@Skittles:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1024
link/ether 94:10:3f:80:0a:0b brd ff:ff:ff:ff:ff:ff
inet6 fe80::9610:3fff:fe80:a0b/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1024
link/ether 94:10:3f:80:0a:0b brd ff:ff:ff:ff:ff:ff
inet6 fe80::9610:3fff:fe80:a0b/64 scope link
valid_lft forever preferred_lft forever
5: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
6: ifb0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 32
link/ether 06:9d:59:ba:92:1b brd ff:ff:ff:ff:ff:ff
7: ifb1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 32
link/ether 76:b1:f4:7d:44:68 brd ff:ff:ff:ff:ff:ff
8: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether da:e0:00:bc:00:9d brd ff:ff:ff:ff:ff:ff
11: teql0: <NOARP> mtu 1500 qdisc noop state DOWN group default qlen 100
link/void
12: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 94:10:3f:80:0a:0b brd ff:ff:ff:ff:ff:ff
inet 192.168.1.1/24 brd 192.168.1.255 scope global br-lan
valid_lft forever preferred_lft forever
inet6 ff22:c70b:d405::1/60 scope global noprefixroute
valid_lft forever preferred_lft forever
inet6 fe80::9610:3fff:fe80:a0b/64 scope link
valid_lft forever preferred_lft forever
13: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP group default qlen 1000
link/ether 94:10:3f:80:0a:0b brd ff:ff:ff:ff:ff:ff
14: eth1.2@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 94:10:3e:80:0a:0b brd ff:ff:ff:ff:ff:ff
inet 12.34.242.105/19 brd 72.35.159.255 scope global eth1.2
valid_lft forever preferred_lft forever
inet6 fe80::9610:3fff:fe80:a0b/64 scope link
valid_lft forever preferred_lft forever
15: wireguard: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
link/none
inet 10.0.10.1/28 brd 10.0.10.15 scope global wireguard
valid_lft forever preferred_lft forever
21: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br-lan state UP group default qlen 1000
link/ether 94:10:3f:80:0a:0d brd ff:ff:ff:ff:ff:ff
inet6 fe80::9610:3fff:fe80:a0d/64 scope link
valid_lft forever preferred_lft forever
22: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br-lan state UP group default qlen 1000
link/ether 94:10:3f:80:0a:0c brd ff:ff:ff:ff:ff:ff
inet6 fe80::9610:3fff:fe80:a0c/64 scope link
valid_lft forever preferred_lft forever
23: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100
link/none
inet 192.168.8.1/24 brd 192.168.8.255 scope global tun0
valid_lft forever preferred_lft forever
inet6 fe80::3ff9:d4fd:f525:7617/64 scope link stable-privacy
valid_lft forever preferred_lft forever
for reference
root@Skittles:~# tc qdisc show dev eth0
qdisc mq 0: root
qdisc fq_codel 0: parent :8 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
qdisc fq_codel 0: parent :7 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
qdisc fq_codel 0: parent :6 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
qdisc fq_codel 0: parent :5 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
qdisc fq_codel 0: parent :4 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
qdisc fq_codel 0: parent :3 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
qdisc fq_codel 0: parent :2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
qdisc fq_codel 0: parent :1 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
root@Skittles:~# tc qdisc show dev eth0.1
qdisc noqueue 0: root refcnt 2
Yes so eth0.1 is the device that is in br-lan as part of your lan, I'd work on putting a netem on that interface. Since it's a virtual interface, you can just delete the netem afterwards and it will then show "noqueue" (and queueing will happen in eth0 instead)
1 Like
thank you
however i still do NOT notice any delay loading web pages
i did 100ms as your comment about ram use worried me (not sure that much is free)
but i would still think it should be noticeable if its on every request
since thats the br-lan does it add delay to external request or just lan request?
It adds delay from the time the packet comes in from WAN to go back to LAN, to the time that it exits the eth0.1 interface.
100ms is not that big a delay for web pages. It's a definitely noticeable delay for a VOIP call.
Delay is not the same as bandwidth limitation. If you have a gigabit connection between two machines, and you ask for a 1kB file... you will get it in delay + 8000/1e9 seconds. If you have a 2400 baud modem you'll get it in delay + 8000/2400 seconds
For delay = 0.1 the first quantity is 0.100008 for delay = 0.1 the second quantity is 3.43 seconds
Delay changes interactivity that is, the time from when you initiate something to the time when you see the observable consequences of that thing. For example, clicking a mouse to the time when a server registers that you've clicked the mouse (think shots in shooting games)
but even something crazy like this
tc qdisc add dev eth0.1 root netem delay 10000ms
has no effect on web page loading
maybe we are still using the wrong interface?
if it really is +10 seconds to every request from WAN to LAN it doesnt seem to be working
are these any other packages or configurations i can do that will make web pages very slow to load?
Yes, that is weird. You are using a wired client not a wifi client right?
1 Like
no sorry
i am using WIFI clients for my testing
ok, well there is your problem. Put netem on wlan1 or wlan0 or both, because those are the interfaces your packets are flowing through.
1 Like
o ya, that worked
thanks again!!!!
system
Closed
March 9, 2020, 6:27pm
17
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.