#!/bin/sh -v
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: prio
tc qdisc add dev eth0 parent 1:1 handle 2: tbf limit 1600 burst 2600 rate 28800
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.1.2 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip prio 7 u32 match ip dst 192.168.1.4 classid 1:1

iptables -A PREROUTING -i eth0 -s 192.168.1.2 -t mangle -j MARK --set-mark 2
iptables -A PREROUTING -i eth0 -s 192.168.1.4 -t mangle -j MARK --set-mark 4

tc qdisc del dev ppp0 root
tc qdisc add dev ppp0 root handle 2: prio
tc qdisc add dev ppp0 parent 2:1 handle 3: tbf limit 1600 burst 2600 rate 28800
tc filter add dev ppp0 protocol ip parent 2:0 prio 1 handle 2 fw classid 2:1
tc filter add dev ppp0 protocol ip parent 2:0 prio 7 handle 4 fw classid 2:1
