I recommend reading the Linux Advanced Routing & Traffic Control HOWTO, in particular the examples on rate limiting a single host or netmask and a full nat solution with QoS.
Essentially you have to do the following:
- Mark packets from that particular host in the
PREROUTING chain of the
- Set up some prioritizing or rate limiting traffic control
- Make sure the market packets fall into the low priority resp. limited class
Untested, but something along these lines (feel free to edit if you notice a mistake):
iptables -t mangle -A PREROUTING -i eth0 -s 192.168.0.666 -j MARK --set-mark 1
tc qdisc add dev ppp0 root handle 1: cbq avpkt 1000 bandwidth 10mbit
tc class add dev ppp0 parent 1: classid 1:1 cbq rate 512kbit \
allot 1500 prio 5 bounded isolated
tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1 fw classid 1:1
Notice that you can't directly use
tc filter to filter on the IP of that host, since the tc filter applies after NAT, so it will see your public IP, which cannot be used to differentiate the packet.
Usually you'd rate-limit upstream packets, since there you have the most control, and since on a common ADSL link the upstream is more easily saturated by p2p traffic. If you want, you can also attempt to rate-limit the downstream by deliberately dropping packets. You'd do that using another traffic control setup, this time for packets forwarded over the local network device.