3

I'm working on a school project in which I try to simulate the network phenomenon of Buffer Bloating. This essentially is latency as a consequence of buffers in routers getting larger and larger in time because of the cheap prices of memory.

Now, to start on this project, I have already done some research on the linux "tc"-command and how to use it, but I fail to see how to set the right configuration for my needs. The situation is as follows; I have 3 computers. PC1 is connected to PC2, and PC2 is connected to PC3. In this configuration, PC2 is acting as the router in which a large buffer is used. Traffic is send from PC1 to PC3 over PC2. Now, my intention is to limit the bandwidth PC2 can use to send the incoming data from PC1 to PC3.

I was planning on doing this by setting a large buffer on PC2 with a delay on fetching the packets from the buffer to simulate a slower link. This should cause the large buffer to fill up and introduce latencies.

Now, I want to ask this community on ideas on how to configure this by using the "tc"-command, or maybe other tools that are suitable for the job. Or if you have other ideas on how to simulate buffer bloating, those are welcome too.

Thanks for your patience.

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
Jan Discart
  • 167
  • 1
  • 1
  • 13
  • 2
    Already read LARTC (Linux Advanced Routing & Traffic Control HOWTO) http://lartc.org/howto/lartc.cookbook.ultimate-tc.html ? – dAm2K Mar 18 '12 at 11:43
  • Hi, thank you for the link. I have read it, but it seems pretty advanced for what I'm looking for. I was hoping to find about 2 or 3 lines that would set the thing up. It did point me in other directions to search for other queueing disciplines. I will have a look at the token bucket. – Jan Discart Mar 19 '12 at 13:17

1 Answers1

3

I think there are two ways to simulate bloating, and it depends on the kernel and/or the version of iproute that you are using. TBF and NETEM allow to set the rate and the queue size.

tc qdisc add dev eth0 root tbf rate Xmbit limit Y burst 1500

or

tc qdisc add dev eth0 root netem Xmbit limit Y

where X is the bandwidth and Y the queue size. The first one should work in any 2.6 kernel and ay be in some newer version of 2.4. The later one requires a new version of the Linux kernel and the Iproute tool.

Regards, Diego

Neysor
  • 3,893
  • 11
  • 34
  • 66
Diego Woitasen
  • 32,892
  • 1
  • 18
  • 20
  • Thank you for the commands. I found that the token bucket would serve my purpose indeed. I will try it in a few days (I don't have the equipment here to test it) and will report back. The second command looks promising in terms of simplicity and elegance. Thank you. – Jan Discart Mar 19 '12 at 13:18
  • 1
    I have used your first solution and it worked like a charm. With a little tweaking and tuning, I have found the exact thing I needed. Thank you for your answer. – Jan Discart Mar 21 '12 at 18:16