Simulating Network Latency?
ixmo asks: "I've just come around an interesting problem: to simulate low-bandwidth network links without buying expensive WAN simulators, I can connect two old Cisco routers back to back with serial cables, and control the bandwidth via the 'clock rate' IOS command, but how can I simulate network latency? Is there some OS tool or patch (for Linux/OpenBSD) that allows for tuning of network delay? Any hints?"
FreeBSD's dummynet can quite easily do it. I suspect the same of openbsd and linux.
What kind of question is this for ask slashdot?
Use a longer cable.
This may be the oddest use for this yet- but any large file would work >200MB. Set up your Serial port for a slow connection, say 110 baud, then start an ftp transfer in the background of SP2 from one machine to the other. That ought to simulate latency errors just fine.
SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
You can get m0n0wall and stick it on random hardware. I think you then have to recompile the kernel to enable dummynet.
We use a Soekris 4501. It'll only bridge upto about 50mbit of traffic, but if you want to simulate T1 speeds it'll be fine. Beefier hardware (the soekris box is roughly a 133MHz 486) will probably let you max out at wire speed.
Stand next to the router and simulate rough conditions... ... yank out the wire a couple times. ... play kick the router. ... simulate lightening by plugging a network cable into a 220V plug ... paint sunspots on your face and spew out some EMF pulses like the sun.
"Can of worms? The can is open... the worms are everywhere."
It's good fun telling people who come down here to visit (New Zealand) that the twists in our cat 5 go the other way - because the earth's magnetic field is reversed.
Made all the better when they discover that southern hemisphere monitors actually *are* different for exactly the same reason.
Dave
I write a blog now, you should be afraid.
Sign up with Comcast.
Network emulator
CONFIG_NET_SCH_NETEM:
Say Y if you want to emulate network delay, loss, and packet re-ordering. This is often useful to simulate networks when testing applications or protocols.
For openbsd you can throttle bandwidth right in PF.
Just cap whichever queue you want at whatever rate you want.
The NIST ATM simulator (public domain) might be useful. You need to provide some personal info to download it, but that isn't verified.
Nistnet is another tool that simulates delay.
-jim
Connect the machines using PPP over a pair of Ricochet modems, available on eBay for a song. They include a neat little command for developers:
AT~I13 -- WAN Simulation Command and Information Display
This command enables the Ricochet modem's WAN simulation feature.
Syntax:
AT~I13
You can use this function to test various transport protocols in the presence of network delay and packet loss. This simulation only affects the modem's transport modes, i.e., LIGHT/PPP/SLIP/STREAM. If you are going to reset the WAN simulation values, then you should reboot the modem because it is not built to reset and process incoming packets at the same time. WAN simulation affects the processing of received packet, therefore, when testing the simulation needs to be set at both ends of the connection.
The incoming packets are processed in the following order. First, the drop percentage value is checked and the modem drops that N% immediately. Second, the base delay is added to a random percentage of the variable delay. Then the packet is inserted on a time ordered delivery queue. If the variable delay component is great enough, a large number of incoming packets will be reordered.
Note:
In WAN simulation, there are fewer (Time to Live) TTL expirations than in an real network because packets ending up on the delivery queue is not expiring based on the TTL value.
Article: http://groups.google.ca/groups?hl=en&lr=&ie=UTF-8& selm=ucggua1ghi9ic1%40corp.supernews.com&rnum= 12
Sometimes the "writing on the wall" is blood spatter...
I'm shocked no-one has posted this!
It's been in the kernel for while, though I don't know much about using it. I never bothered even looking at it (had no need) until a coworker wanted to use it (on Thursday) to do some testing and asked me about it.
Here's the chunk of Kconfig:
config NET_SCH_DELAY
tristate "Delay simulator"
depends on NET_SCHED
help
Say Y if you want to delay packets by a fixed amount of
time. This is often useful to simulate network delay when
testing applications or protocols.
To compile this driver as a module, choose M here: the module
will be called sch_delay.
Please reply to this if you have been able to get this working... the tuning parameters to tc we found give errors (and yes, we built installed the latest iproute2 tarball).
Then again, we only spent a few minutes playing with it (he had to leave).
- Preferences: Solaris 10 (servers), Ubuntu (desktops), Solaris 11 (personal servers) -
1. I put a linux box acting as router, firewall, apache server and internet connection on the network.
2. Then I post a story on slashdot with a link to the apache server.
3. ???
4. Instant latency!
(And by carefully choosing the size of the documents/jpegs/mpegs I can actually simulate different kinds of latency!!!)