4 ms·
I looked into doing something similar for testing various ActivityPub implementations in various network sizes and conditions. Turns out, I already had everyth
by diggan 3y ago
I looked into doing something similar for testing various ActivityPub implementations in various network sizes and conditions.
Turns out, I already had everything installed on my machine to do it, via `tc` (Explained a bit here: https://wiki.archlinux.org/title/advanced_traffic_control https://wiki.archlinux.org/title/advanced_traffic_control), which apparently came with the iproute2 package on my distribution.
With that, you'd be able to run something like this to add latency on a specific interface:
tc qdisc add dev eth0 root netem delay 100ms
Really easy to use, works well in docker container too, comes with a bunch of different conditions you can apply (delay, packet loss, duplication) and you might just have it installed already.
- lttlrck 3y agoThe nice thing about speedbump is the ability to modulate the impairments. tc cannot do that. That could be really useful for maybe simulating weather effects on satellite/RF over time?
- tussa 3y agotc can simulate various network issues: https://man7.org/linux/man-pages/man8/tc-netem.8.html https://man7.org/linux/man-pages/man8/tc-netem.8.html
- camtarn 3y agoYou could easily build something that could repeatedly call the tc command and feed it different levels of impairment. Doing so to simulate weather is a great idea. If you had a wave-rider buoy measuring wave height every half-second or so, you could even simulate the impairment of an RF connection over water due to waves.
- camtarn 3y agoYeah, tc/netem/tbf is amazing. I built a simple Python GUI over the top of it and ran it on a Pi in a touchscreen case - just a little black box with "Drop packets: [0%] [1%] [10%] [50%] / Corrupt packets: ..." etc. Clients were very impressed. I'm actually quite surprised that a similar frontend doesn't seem to exist as a commercial hardware product, unless we missed one in our search.
- BiteCode_dev 3y agoYou have a product here.
- lifeisstillgood 3y agoYeah - I was looking around this week and think there is a “gap” for a good simple proxy - speed bump is nice but I am thinking just let my application do it’s thing, then let me replay certain traffic, that JSON needs to I think a programmable proxy with simple hooks is what I want
- jandrese 3y agoThe downside of tc is that it is kinda weird and tricky to get it to operate on incoming packets. I had to write my own emulator once to simulate a specific commercial satellite terminal. The terminal had the behavior of queuing up packets until they hit a certain threshold or exceeded a time limit and then bursting them out in a big blob. It also "helpfully" reordered small packets to the front of the queue for better latency, which made TCP stacks very cross.
- bogomipz 3y agoI thought tc only worked on outbound. How did you get it to work on inbound packets?
- jandrese 3y agoThere is a way to do it by setting up another queue and redirecting inbound packets into that queue, but I don't remember the specifics. I do recall quite a bit of trouble getting it to work. If you search for it you should be able to find some topics on the subject.