Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
Strony: 1
w wyniku moich dluugich meczarni narodzil sie taki twor jak ponizej. Dziala w zasadzie poprawnie: przydziela wszystkim userom na ppp oraz na lan poprawne down/up z/do netu, ale jest jeden problem: polaczenia do/z serwera rowniez wrzuca do limitowaych klas a nie to tej 10Mbit... baaardzo mi na tym zalezy aby klient<-->serwer mieli polaczenia 10Mbit a nie takie jak do neta. W tym celu dalem dwie klasy
#Server->client $tc class add dev imq0 parent 1:1 classid 1:3 htb rate 10000kbit ceil 10000kbit $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip src 192.168.1.1 flowid 1:3 $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip src xx.xx.xx.xx flowid 1:3 #Server<-Client $tc class add dev imq1 parent 2:1 classid 2:3 htb rate 10000kbit ceil 10000kbit $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip dst 192.168.1.1 flowid 2:3 $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip dst xx.xx.xx.xx flowid 2:3 ##
i dalej cham nie dziala ! skonczyly mi sie juz pomysly, zwlaszcza ze to jest dokladnie tak jak mam opracowane (przepisalem to zywcem z pdf'a).
Calosc arcydziela wyglada tak:
IPTABLES="/usr/local/sbin/iptables" tc="/sbin/tc" ip="/sbin/ip" #Gwarantowane d="133kbit" u="16kbit" #Maxymalne dm="1500kbit" um="190kbit" $tc qdisc del root dev imq0 $tc qdisc del root dev imq1 $IPTABLES -t mangle -A POSTROUTING -o eth1 -j IMQ --todev 0 $IPTABLES -t mangle -A PREROUTING -i eth1 -j IMQ --todev 1 for ((i=0; i<=15; i++)); do $IPTABLES -t mangle -A POSTROUTING -o ppp$i -j IMQ --todev 0 done for ((i=0; i<=15; i++)); do $IPTABLES -t mangle -A PREROUTING -i ppp$i -j IMQ --todev 1 done $ip link set imq0 up $ip link set imq1 up $tc qdisc add dev imq0 root handle 1:0 htb default 10 $tc qdisc add dev imq1 root handle 2:0 htb default 10 $tc class add dev imq0 parent 1:0 classid 1:1 htb rate 11000kbit ceil 11000kbit $tc class add dev imq1 parent 2:0 classid 2:1 htb rate 11000kbit ceil 11000kbit #Server->client $tc class add dev imq0 parent 1:1 classid 1:3 htb rate 10000kbit ceil 10000kbit $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip src 192.168.1.1 flowid 1:3 $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip src 83.19.46.155 flowid 1:3 #Server<-Client $tc class add dev imq1 parent 2:1 classid 2:3 htb rate 10000kbit ceil 10000kbit $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip dst 192.168.1.1 flowid 2:3 $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip dst 83.19.46.155 flowid 2:3 ## #Net Download/upload $tc class add dev imq0 parent 1:1 classid 1:2 htb rate 2000kbit ceil 2000kbit $tc class add dev imq1 parent 2:1 classid 2:2 htb rate 250kbit ceil 250kbit ## #192.168.1.5 - 5 $tc class add dev imq0 parent 1:2 classid 1:5 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.5 flowid 1:5 $tc qdisc add dev imq0 parent 1:5 handle 5:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:5 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.5 flowid 2:5 $tc qdisc add dev imq1 parent 2:5 handle 5:0 sfq perturb 10 #192.168.1.6 - 6 $tc class add dev imq0 parent 1:2 classid 1:6 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.6 flowid 1:6 $tc qdisc add dev imq0 parent 1:6 handle 6:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:6 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.6 flowid 2:6 $tc qdisc add dev imq1 parent 2:6 handle 6:0 sfq perturb 10 #192.168.1.7 - 7 $tc class add dev imq0 parent 1:2 classid 1:7 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.7 flowid 1:7 $tc qdisc add dev imq0 parent 1:7 handle 7:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:7 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.7 flowid 2:7 $tc qdisc add dev imq1 parent 2:7 handle 7:0 sfq perturb 10 #192.168.1.110 - 110 $tc class add dev imq0 parent 1:2 classid 1:110 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.110 flowid 1:110 $tc qdisc add dev imq0 parent 1:110 handle 110:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:110 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.110 flowid 2:110 $tc qdisc add dev imq1 parent 2:110 handle 110:0 sfq perturb 10 #192.168.1.111 - 111 $tc class add dev imq0 parent 1:2 classid 1:111 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.111 flowid 1:111 $tc qdisc add dev imq0 parent 1:111 handle 111:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:111 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.111 flowid 2:111 $tc qdisc add dev imq1 parent 2:111 handle 111:0 sfq perturb 10 #192.168.1.112 - 112 $tc class add dev imq0 parent 1:2 classid 1:112 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.112 flowid 1:112 $tc qdisc add dev imq0 parent 1:112 handle 112:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:112 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.112 flowid 2:112 $tc qdisc add dev imq1 parent 2:112 handle 112:0 sfq perturb 10 #192.168.1.113 - 113 $tc class add dev imq0 parent 1:2 classid 1:113 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.113 flowid 1:113 $tc qdisc add dev imq0 parent 1:113 handle 113:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:113 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.113 flowid 2:113 $tc qdisc add dev imq1 parent 2:113 handle 113:0 sfq perturb 10 #192.168.1.114 - 114 $tc class add dev imq0 parent 1:2 classid 1:114 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.114 flowid 1:114 $tc qdisc add dev imq0 parent 1:114 handle 114:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:114 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.114 flowid 2:114 $tc qdisc add dev imq1 parent 2:114 handle 114:0 sfq perturb 10 #192.168.1.115 - 115 $tc class add dev imq0 parent 1:2 classid 1:115 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.115 flowid 1:115 $tc qdisc add dev imq0 parent 1:115 handle 115:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:115 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.115 flowid 2:115 $tc qdisc add dev imq1 parent 2:115 handle 115:0 sfq perturb 10 #192.168.1.116 - 116 $tc class add dev imq0 parent 1:2 classid 1:116 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.116 flowid 1:116 $tc qdisc add dev imq0 parent 1:116 handle 116:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:116 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.116 flowid 2:116 $tc qdisc add dev imq1 parent 2:116 handle 116:0 sfq perturb 10 #192.168.1.117 - 117 $tc class add dev imq0 parent 1:2 classid 1:117 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.117 flowid 1:117 $tc qdisc add dev imq0 parent 1:117 handle 117:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:117 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.117 flowid 2:117 $tc qdisc add dev imq1 parent 2:117 handle 117:0 sfq perturb 10 #192.168.1.118 - 118 $tc class add dev imq0 parent 1:2 classid 1:118 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.118 flowid 1:118 $tc qdisc add dev imq0 parent 1:118 handle 118:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:118 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.118 flowid 2:118 $tc qdisc add dev imq1 parent 2:118 handle 118:0 sfq perturb 10 #192.168.1.120 - 120 $tc class add dev imq0 parent 1:2 classid 1:120 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.120 flowid 1:120 $tc qdisc add dev imq0 parent 1:120 handle 120:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:120 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.120 flowid 2:120 $tc qdisc add dev imq1 parent 2:120 handle 120:0 sfq perturb 10 #192.168.1.130 - 130 $tc class add dev imq0 parent 1:2 classid 1:130 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.130 flowid 1:130 $tc qdisc add dev imq0 parent 1:130 handle 130:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:130 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.130 flowid 2:130 $tc qdisc add dev imq1 parent 2:130 handle 130:0 sfq perturb 10 #192.168.1.131 - 131 $tc class add dev imq0 parent 1:2 classid 1:131 htb rate $d ceil $dm $tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.1.131 flowid 1:131 $tc qdisc add dev imq0 parent 1:131 handle 131:0 sfq perturb 10 $tc class add dev imq1 parent 2:2 classid 2:131 htb rate $u ceil $um $tc filter add dev imq1 protocol ip parent 2:0 u32 match ip src 192.168.1.131 flowid 2:131 $tc qdisc add dev imq1 parent 2:131 handle 131:0 sfq perturb 10
Offline
Ja mam coś takiego jak poniżej i niby też działa poprawnie, ale ... jak wrzucam na serwer, przez total comandera, to idzie 10mbit, a jak ściagam z serwera to idzie z taką prędkością jak normalny internet :-( Czy mógłby mi ktoś pomóc ?
#!/bin/bash # rc.htb 0.3.3-stable, (C)PriSM 2oo3, GNU GPL # <http://www.rc.htb.prv.pl/> # wygenerowano: 06/06/06 23:04:42 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 ##DOWNLOAD## # 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 99Mbit ceil 99Mbit # Podział na pasmo dla ł±cza internetowego i resztę /usr/sbin/rchtb_tc class add dev eth1 parent 1:1 classid 1:2 htb rate 506kbit ceil 506kbit /usr/sbin/rchtb_tc class add dev eth1 parent 1:1 classid 1:3 htb rate 98494kbit ceil 98294kbit 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 22 /usr/sbin/rchtb_tc class add dev eth1 parent 1:2 classid 1:20 htb rate 64kbit ceil 64kbit 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 2 parent 1:0 u32 match ip sport 22 0xffff flowid 1:20 /usr/sbin/rchtb_tc filter add dev eth1 protocol ip prio 1 parent 1:0 u32 match ip tos 0x10 0xff flowid 1:20 /usr/sbin/rchtb_tc filter add dev eth1 protocol ip prio 1 parent 1:0 u32 match ip protocol 1 0xff flowid 1:20 # laptop /usr/sbin/rchtb_tc class add dev eth1 parent 1:2 classid 1:21 htb rate 64kbit ceil 128kbit prio 5 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.5 flowid 1:21 # pyc /usr/sbin/rchtb_tc class add dev eth1 parent 1:2 classid 1:22 htb rate 64kbit ceil 400kbit 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.2 flowid 1:22 # stachowiak /usr/sbin/rchtb_tc class add dev eth1 parent 1:2 classid 1:23 htb rate 64kbit ceil 192kbit prio 3 quantum 1500 /usr/sbin/rchtb_tc qdisc add dev eth1 parent 1:23 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:23 # wozniak /usr/sbin/rchtb_tc class add dev eth1 parent 1:2 classid 1:24 htb rate 64kbit ceil 256kbit prio 4 quantum 1500 /usr/sbin/rchtb_tc qdisc add dev eth1 parent 1:24 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.4 flowid 1:24 # transfer serwer->LAN /usr/sbin/rchtb_tc filter add dev eth1 protocol ip prio 4 parent 1:0 handle 1 fw flowid 1:3 ##UPLOAD## # 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 506kbit ceil 506kbit # klasa priorytetowa ACK /usr/sbin/rchtb_tc class add dev eth0 parent 2:1 classid 2:10 htb rate 10kbit ceil 10kbit 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 64kbit ceil 64kbit 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:10 # TOS 0x10 /usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 2 u32 match ip dport 22 0xffff flowid 2:10 # port 22 /usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 1 u32 match ip protocol 1 0xff flowid 2:10 # 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 64kbit ceil 506kbit 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 # laptop /usr/sbin/rchtb_tc class add dev eth0 parent 2:1 classid 2:12 htb rate 64kbit ceil 128kbit prio 6 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 # pyc /usr/sbin/rchtb_tc class add dev eth0 parent 2:1 classid 2:13 htb rate 64kbit ceil 320kbit prio 3 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 # stachowiak /usr/sbin/rchtb_tc class add dev eth0 parent 2:1 classid 2:14 htb rate 64kbit ceil 128kbit prio 4 quantum 1500 /usr/sbin/rchtb_tc qdisc add dev eth0 parent 2:14 sfq perturb 10 /usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 5 handle 4 fw flowid 2:14 # wozniak /usr/sbin/rchtb_tc class add dev eth0 parent 2:1 classid 2:15 htb rate 64kbit ceil 128kbit prio 5 quantum 1500 /usr/sbin/rchtb_tc qdisc add dev eth0 parent 2:15 sfq perturb 10 /usr/sbin/rchtb_tc filter add dev eth0 parent 2:0 protocol ip prio 5 handle 5 fw flowid 2:15 /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
Offline
Strony: 1