Kod: Zaznacz cały
#!/bin/sh
echo "£adowanie modułów"
modprobe sch_htb
modprobe sch_sfq
modprobe cls_u32
echo "Kasownanie wszystkich reguł"
tc qdisc add dev eth1 root handle 1:0 htb
tc qdisc add dev eth0 root handle 2:0 htb
tc qdisc del root dev eth1
tc qdisc del root dev eth0
echo "Główna kolejka"
tc qdisc add dev eth1 root handle 1:0 htb
tc qdisc add dev eth0 root handle 2:0 htb
echo "Główne klasy"
tc class add dev eth1 parent 1:1 classid 1:2 htb rate 1000kbit ceil 1000kbit
tc class add dev eth1 parent 1:1 classid 1:3 htb rate 500kbit ceil 500kbit
tc class add dev eth0 parent 2:1 classid 2:2 htb rate 100kbit ceil 100kbit
tc class add dev eth0 parent 2:1 classid 2:3 htb rate 60kbit ceil 60kbit
echo "przypisanie ip do klasy"
tc filter add dev eth1 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.1.19 flowid 1:2
tc filter add dev eth1 protocol ip parent 1:0 prio 100 u32 match ip dst 192.168.1.20 flowid 1:2
tc filter add dev eth1 protocol ip parent 1:0 u32 match ip dst 192.168.1.21 flowid 1:3
tc filter add dev eth0 protocol ip parent 2:0 u32 match ip dst 192.168.1.21 flowid 2:3
tc filter add dev eth0 parent 2:0 protocol ip prio 1 handle 1 fw flowid 2:3
tc filter add dev eth0 parent 2:0 protocol ip prio 1 handle 2 fw flowid 2:2
echo "Priorytety dla portów"
tc filter add dev eth1 parent 1:0 prio 500 protocol ip u32 match ip dport 80 0xffff flowid 1:2
tc filter add dev eth1 parent 1:0 prio 500 protocol ip u32 match ip dport 8080 0xffff flowid 1:2
tc filter add dev eth1 parent 1:0 prio 0 protocol ip u32 match ip dport 5060 0xffff flowid 1:2
tc filter add dev eth1 parent 1:0 prio 0 protocol ip u32 match ip dport 5061 0xffff flowid 1:2
Kod: Zaznacz cały
iptables -A PREROUTING -i eth0 -t mangle -p tcp --dport 80 \
-j MARK --set-mark 1
iptables -A PREROUTING -i eth0 -t mangle -p tcp --dport 8080 \
-j MARK --set-mark 2
Co tu jest źle??
Do zastosowania htb skłoniła mnie sytuacja że gdy rozmawiając przez bramke voip zaczynam ogladać jakiś filmik na youtube.com to przycina rozmowe.