musisz sam dobrać paramtery ceil dla klas typu ACK, TOS itd... to zależy od indywidualnych potrzeb. Priorytet ustawiony jest dla portu 80 czyli
. to daje pierwszeństwo przeglądarkom...
#!/bin/bash
# rc.htb 0.3.3-stable, (C)PriSM 2oo3, GNU GPL
# <http://www.rc.htb.prv.pl/>
# wygenerowano: 07/21/04 17:45:59
VER=0.3.3-stable
stop()
{
/usr/sbin/rchtb_tc qdisc del root dev eth0 2> /dev/null
/usr/sbin/rchtb_tc qdisc del root dev eth1 2> /dev/null
}
start()
{
stop # dla bezpieczeństwa
# INTERFEJS ETH1 (ruch przychodz±cy)
/usr/sbin/rchtb_tc qdisc add dev eth1 root handle 1:0 htb default 3 r2q 1
# Główna klasa dla eth1
/usr/sbin/rchtb_tc class add dev eth1 parent 1:0 classid 1:1 htb rate 90000kbit ceil 90000kbit
# Podział na pasmo dla ł±cza internetowego i resztę
/usr/sbin/rchtb_tc class add dev eth1 parent 1:1 classid 1:2 htb rate 630kbit ceil 630kbit
/usr/sbin/rchtb_tc class add dev eth1 parent 1:1 classid 1:3 htb rate 89370kbit ceil 89370kbit prio 9
/usr/sbin/rchtb_tc qdisc add dev eth1 parent 1:3 sfq perturb 10
# pasmo priorytetowe dla ICMP, TOS 0x10 (min. delay) oraz wybranego portu 80
/usr/sbin/rchtb_tc class add dev eth1 parent 1:2 classid 1:20 htb rate 30kbit ceil 630kbit prio 1 quantum 1500
/usr/sbin/rchtb_tc qdisc add dev eth1 parent 1:20 sfq perturb 10
/usr/sbin/rchtb_tc filter add dev eth1 protocol ip prio 3 parent 1:0 u32 match ip sport 80 0xffff flowid 1:20
/usr/sbin/rchtb_tc filter add dev eth1 protocol ip prio 2 parent 1:0 u32 match ip tos 0x10 0xff flowid 1:20
/usr/sbin/rchtb_tc filter add dev eth1 protocol ip prio 2 parent 1:0 u32 match ip protocol 1 0xff flowid 1:20
# Komputer_2
/usr/sbin/rchtb_tc class add dev eth1 parent 1:2 classid 1:21 htb rate 400kbit ceil 630kbit prio 2 quantum 1500
/usr/sbin/rchtb_tc qdisc add dev eth1 parent 1:21 sfq perturb 10
/usr/sbin/rchtb_tc filter add dev eth1 protocol ip prio 5 parent 1:0 u32 match ip dst 192.168.0.2 flowid 1:21
# Komputer_3
/usr/sbin/rchtb_tc class add dev eth1 parent 1:2 classid 1:22 htb rate 200kbit ceil 630kbit prio 2 quantum 1500
/usr/sbin/rchtb_tc qdisc add dev eth1 parent 1:22 sfq perturb 10
/usr/sbin/rchtb_tc filter add dev eth1 protocol ip prio 5 parent 1:0 u32 match ip dst 192.168.0.3 flowid 1:22
# transfer serwer->LAN
/usr/sbin/rchtb_tc filter add dev eth1 protocol ip prio 1 parent 1:0 handle 1 fw flowid 1:3
# INTERFEJS ETH0 (ruch wychodz±cy)
/usr/sbin/rchtb_tc qdisc add dev eth0 root handle 2:0 htb default 11 r2q 1
# główna klasa
/usr/sbin/rchtb_tc class add dev eth0 parent 2:0 classid 2:1 htb rate 150kbit ceil 150kbit
# klasa priorytetowa ACK
/usr/sbin/rchtb_tc class add dev eth0 parent 2:1 classid 2:10 htb rate 10kbit ceil 150kbit prio 1 quantum 1500
/usr/sbin/rchtb_tc qdisc add dev eth0 parent 2:10 sfq perturb 10
/usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 2 u32 match ip protocol 6 0xff \
match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 1 match u8 0x10 0xff at 33 flowid 2:10 # ACK
# klasa priorytetowa TOS 0x10 oraz ICMP
/usr/sbin/rchtb_tc class add dev eth0 parent 2:1 classid 2:9 htb rate 10kbit ceil 150kbit prio 2 quantum 1500
/usr/sbin/rchtb_tc qdisc add dev eth0 parent 2:9 sfq perturb 10
/usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 1 u32 match ip tos 0x10 0xff flowid 2:9 # TOS 0x10
/usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 2 u32 match ip dport 80 0xffff flowid 2:9 # port 80
/usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 1 u32 match ip protocol 1 0xff flowid 2:9 # ICMP
# ruch serwerowy (pasmo dla go¶ci z zewn±trz)
/usr/sbin/rchtb_tc class add dev eth0 parent 2:1 classid 2:11 htb rate 10kbit ceil 150kbit prio 2 quantum 1500
/usr/sbin/rchtb_tc qdisc add dev eth0 parent 2:11 sfq perturb 10
/usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 3 handle 1 fw flowid 2:11
# Komputer_2
/usr/sbin/rchtb_tc class add dev eth0 parent 2:1 classid 2:12 htb rate 40kbit ceil 150kbit prio 2 quantum 1500
/usr/sbin/rchtb_tc qdisc add dev eth0 parent 2:12 sfq perturb 10
/usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 5 handle 2 fw flowid 2:12
# Komputer_3
/usr/sbin/rchtb_tc class add dev eth0 parent 2:1 classid 2:13 htb rate 80kbit ceil 150kbit prio 2 quantum 1500
/usr/sbin/rchtb_tc qdisc add dev eth0 parent 2:13 sfq perturb 10
/usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 5 handle 3 fw flowid 2:13
/usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 9 u32 match ip dst 0/0 flowid 2:11
}
echo "rc.htb 0.3.3-stable, (C)PriSM 2oo3. Na licencji GNU GPL."
echo "Strona projektu:
http://www.rc.htb.prv.pl/"
case "$1" in
'start')
echo -n "Uruchamianie kolejkowania..."
start
echo " wykonano."
;;
'stop')
echo -n "Zatrzymywanie kolejkowania..."
stop
echo " wykonano."
;;
'restart')
echo -n "Restartowanie kolejkowania: stop"
stop
echo -n " start"
start
echo " wykonano."
;;
'status')
echo "Klasy na interfejsie eth1"
echo "================================"
tc class show dev eth1 | grep root
tc class show dev eth1 | grep -v root | sort | nl
echo "Klasy na interfejsie eth0"
echo "==================================="
tc class show dev eth0 | grep root
tc class show dev eth0 | grep -v root | sort | nl
;;
*)
echo -e "\nUżycie: rc.htb start|stop|restart|status"
;;
esac
P.S. jeśli używasz rozdzielczości ekranu niższej niż 1024x768 to niektóre linijki ze skryptu będą dzielone... uważaj na to... zwiększ je sobie a później ewentualnie kopiuj... aha no i możesz mić zwałę jak te skrypty stworzysz pod windowsem i później przeniesiesz na linuxa... różnica tkwi w innym znaku końca lini... prawdopodobnie będziesz musiał wszystkie końce lini w skrypcie zrobić od nowa.