Thursday, 1 December 2011

Linux traffic Control (tc)

The world of Linux's Traffic control is a mysterious thing - you end up spending hours Googling or days reading source code.

For some nitty gritty on tc see an earlier post of mine on tc rate limiting and pitfalls.


TC Filters

Creating:
Here's some good info on the u32 filter (here and here). Some more with a quick overview from LARTC mail list (the source of most useful info on tc etc). Someone put together a tc manual.

Listing:
Run this command:
sudo tc filter show dev eth0 root

Here's some example output:
filter parent ffff: protocol ip pref 49152 u32

Deleting:
To delete the above example filter (bold section copied from filter show output):
sudo tc filter del dev eth0 parent ffff: protocol ip pref 49152 u32

[updated:17feb12, 5,6jul12: more explanations+archive.org link for 1st link as it's gone MIA, link to older article of mine]