e42.uk Circle Device

 

Quick Reference

Single Machine Traffic Control

Traffic Control (tc) on a single machine

The tc command configures the Linux packet filter to match packets and optionally delay, lose, prioritise or reorder them. This is great but tc only works on egress traffic (not quite true but we will pretend that it is for now). To simulate network conditions on a single machine that machine must transmit the packets that traffic control is to manipulate. This can be achieved through the use of an Intermediate Function Block (ifb).

Create the Interfaces

ip link add ifb0 type ifb
ip link set ifb0 up

Redirect All eth0 Traffic to ifb0

tc qdisc add dev eth0 handle ffff: ingress tc filter add dev eth0 parent ffff: protocol ip matchall action mirred egress redirect dev ifb0

At this point the traffic from eth0 is being redirected to ifb0 and connectivity is lost...

References

Quick Links: Techie Stuff | General | Personal | Quick Reference