Freesco, NND, CDN, EOS http://forum.freesco.pl/ |
|
htb i przekroczone ograniczenia http://forum.freesco.pl/viewtopic.php?f=22&t=16207 |
Strona 1 z 3 |
Autor: | tomii [ piątek, 9 listopada 2007, 16:47 ] |
Tytuł: | htb i przekroczone ograniczenia |
nam moj htb: #!/bin/sh # shaper.sh -- prosty i Ĺ‚atwy skrypt do zarzÄ…dzania pasmem if [ "$1" == "stop" ] then echo "Zatrzymujemy shapera" tc qdisc del root dev eth2 2>/dev/null tc qdisc del root dev eth0 2>/dev/null iptables -t mangle -D POSTROUTING -o eth0 -j MYSHAPER-OUT 2>/dev/null iptables -t mangle -F MYSHAPER-OUT 2>/dev/null iptables -t mangle -X MYSHAPER-OUT 2>/dev/null exit fi if [ "$1" == "start" ] then # To co byĹ‚o wczeĹ›niej -- do pieca! :) echo "Uruchamiamy shapera" tc qdisc del root dev eth2 2>/dev/null tc qdisc del root dev eth0 2>/dev/null iptables -t mangle -D POSTROUTING -o eth0 -j MYSHAPER-OUT 2>/dev/null iptables -t mangle -F MYSHAPER-OUT 2>/dev/null iptables -t mangle -X MYSHAPER-OUT 2>/dev/null ########## DOWNLOAD tc qdisc add dev eth2 root handle 1:0 htb tc class add dev eth2 parent 1:0 classid 1:1 htb rate 90000kbit ceil 90000kbit tc class add dev eth2 parent 1:1 classid 1:2 htb rate 1400kbit ceil 1400kbit tc class add dev eth2 parent 1:1 classid 1:3 htb rate 85000kbit ceil 85000kbit tc class add dev eth2 parent 1:2 classid 1:4 htb rate 300kbit ceil 1400kbit tc class add dev eth2 parent 1:2 classid 1:5 htb rate 300kbit ceil 1400kbit tc class add dev eth2 parent 1:2 classid 1:6 htb rate 300kbit ceil 1400kbit tc class add dev eth2 parent 1:2 classid 1:7 htb rate 300kbit ceil 1400kbit tc filter add dev eth2 protocol ip preference 1 parent 1:0 u32 match ip \ src 192.168.1.1 flowid 1:3 tc filter add dev eth2 protocol ip preference 1 parent 1:0 u32 match ip \ dst 192.168.1.2 flowid 1:4 tc filter add dev eth2 protocol ip preference 1 parent 1:0 u32 match ip \ dst 192.168.1.3 flowid 1:5 tc filter add dev eth2 protocol ip preference 1 parent 1:0 u32 match ip \ dst 192.168.1.4 flowid 1:6 tc filter add dev eth2 protocol ip preference 1 parent 1:0 u32 match ip \ dst 192.168.1.5 flowid 1:7 tc qdisc add dev eth2 parent 1:3 handle 3:0 sfq perturb 10 tc qdisc add dev eth2 parent 1:4 handle 4:0 sfq perturb 10 tc qdisc add dev eth2 parent 1:5 handle 5:0 sfq perturb 10 tc qdisc add dev eth2 parent 1:6 handle 6:0 sfq perturb 10 tc qdisc add dev eth2 parent 1:7 handle 7:0 sfq perturb 10 ########## UPLOAD tc qdisc add dev eth0 root handle 1:0 htb tc class add dev eth0 parent 1:0 classid 1:1 htb rate 192kbit ceil 192kbit #quantum 15 #tc class add dev eth0 parent 1:1 classid 1:2 htb rate 48kbit ceil 48kbit #quantum 16 tc class add dev eth0 parent 1:1 classid 1:9 htb rate 32kbit ceil 32kbit #quantum 15 tc class add dev eth0 parent 1:1 classid 1:3 htb rate 40kbit ceil 40kbit #quantum 16 tc class add dev eth0 parent 1:1 classid 1:4 htb rate 40kbit ceil 40kbit #quantum 16 tc class add dev eth0 parent 1:1 classid 1:5 htb rate 40kbit ceil 40kbit #quantum 16 tc class add dev eth0 parent 1:1 classid 1:6 htb rate 40kbit ceil 40kbit #quantum 16 # tc qdisc add dev eth0 parent 1:2 handle 2:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:3 handle 3:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:4 handle 4:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:5 handle 5:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:6 handle 6:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:9 handle 9:0 sfq perturb 10 #tc filter add dev eth0 protocol ip preference 1 parent 1:0 handle 20 fw flowid 1:2 # tc filter add dev eth0 parent 1:0 protocol ip handle 1 fw flowid 1:9 tc filter add dev eth0 protocol ip preference 1 parent 1:0 handle 1 fw flowid 1:9 tc filter add dev eth0 protocol ip preference 1 parent 1:0 handle 21 fw flowid 1:3 tc filter add dev eth0 protocol ip preference 1 parent 1:0 handle 22 fw flowid 1:4 tc filter add dev eth0 protocol ip preference 1 parent 1:0 handle 23 fw flowid 1:5 tc filter add dev eth0 protocol ip preference 1 parent 1:0 handle 24 fw flowid 1:6 iptables -t mangle -A OUTPUT -o eth0 -j MARK --set-mark 1 iptables -t mangle -N MYSHAPER-OUT iptables -t mangle -I POSTROUTING -o eth0 -j MYSHAPER-OUT iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.2 -j MARK --set-mark 21 iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.3 -j MARK --set-mark 22 iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.4 -j MARK --set-mark 23 iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.5 -j MARK --set-mark 24 iptables -t mangle -A MYSHAPER-OUT -m mark --mark 0 -j MARK --set-mark 20 exit fi if [ "$1" == "status" ] then echo "eth2: " tc -s qdisc show dev eth2 echo "eth0: " tc -s qdisc show dev eth0 exit fi echo "$0 start|stop|status" ## KONIEC wiem ze taki sobie. I mam problem bo ostatnio jak serwer duzo wysyła to w mrtg pokazuje ze upload przekroczył 192kbit(24kB/s)-moje ograniczenie i dochodzi momentami(przez kilka minut ) do 28 kB/s Chyżbym nie zamarkował całego ruchu? |
Autor: | -MW- [ środa, 21 listopada 2007, 13:58 ] |
Tytuł: | |
powiedz mi do ktorej klasy trafi ruch udp od hostow? zamarkowany jest i nic po za tym. z Cytuj: iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.2 -j MARK --set-mark 21 iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.3 -j MARK --set-mark 22 iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.4 -j MARK --set-mark 23 iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.5 -j MARK --set-mark 24 pozbadz sie Cytuj: -p tcp i bedzie ok
|
Autor: | tomii [ środa, 21 listopada 2007, 15:12 ] |
Tytuł: | |
wlasnie dostrzeglem ze niebardzo mam kontroli nad udp. ale mówisz ze mam go zamarkowanego- w którym miejscu? Jak zastosowac u32 do ul. Ps wybaczcie ze zawracam głowe |
Autor: | zciech [ środa, 21 listopada 2007, 17:58 ] |
Tytuł: | |
Tu nie markujesz ruchu udp iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.2 -j MARK --set-mark 21 iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.3 -j MARK --set-mark 22 iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.4 -j MARK --set-mark 23 iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.5 -j MARK --set-mark 24 W nastepnej lini ruch udp ![]() iptables -t mangle -A MYSHAPER-OUT -m mark --mark 0 -j MARK --set-mark 20 ale to zwazywszy ze masz zaplotkowany filtr na mark 20 #tc filter add dev eth0 protocol ip preference 1 parent 1:0 handle 20 fw flowid 1:2 powoduje ze caly ruch udp idzie klasa 1:1 Tak to widze: iptables -t mangle -A MYSHAPER-OUT -s 192.168.1.2 -j MARK --set-mark 21 iptables -t mangle -A MYSHAPER-OUT -s 192.168.1.3 -j MARK --set-mark 22 iptables -t mangle -A MYSHAPER-OUT -s 192.168.1.4 -j MARK --set-mark 23 iptables -t mangle -A MYSHAPER-OUT -s 192.168.1.5 -j MARK --set-mark 24 Musialbys to zrobic na interfejsach imq |
Autor: | -MW- [ środa, 21 listopada 2007, 18:29 ] |
Tytuł: | |
Cytuj: Jak zastosowac u32 do ul.
|
Autor: | tomii [ środa, 21 listopada 2007, 20:54 ] |
Tytuł: | |
chodzi o wylapanie udp bez imq, jest to możliwe? |
Autor: | -MW- [ środa, 21 listopada 2007, 21:12 ] |
Tytuł: | |
tak - spokojnie mozna skierowac pakiety udp do osobnej klasy na eth tylko moze zanim zaczniesz robic zastanow sie i zapytaj sam siebie co chcesz osiagnac? jak ma wygladac podzial ruchu, ze wzgledu na co? na ip, rodzaj pakietow czy uslugi, a moze w/g mark, a moze wszystko razem ![]() |
Autor: | tomii [ środa, 21 listopada 2007, 21:33 ] |
Tytuł: | |
chciałbym poprostu nauczyc sie troche htb. chciałbym podział po ip dla up i down bez imq jak zmienie iptables -t mangle -A MYSHAPER-OUT -p tcp -s 192.168.1.4 -j MARK --set-mark 23 na Cytuj: iptables -t mangle -A MYSHAPER-OUT -s 192.168.1.4 -j MARK --set-mark 23
to bedzie dzieliło po ip? |
Autor: | -MW- [ środa, 21 listopada 2007, 21:51 ] |
Tytuł: | |
tak gdzie masz eth1? |
Autor: | tomii [ środa, 21 listopada 2007, 22:14 ] |
Tytuł: | |
eth1 gdzies zniknelo. Nie próbowałem robić tego bez markowania, może później spróbuje. Wielkie dzięki za pomoc. |
Autor: | zciech [ środa, 21 listopada 2007, 22:15 ] |
Tytuł: | |
Nie. |
Autor: | tomii [ środa, 21 listopada 2007, 22:24 ] |
Tytuł: | |
zciech nie bedzie dzieliło po ip? o to chodzi? |
Autor: | zciech [ środa, 21 listopada 2007, 22:28 ] |
Tytuł: | |
Tak. |
Autor: | tomii [ środa, 21 listopada 2007, 22:32 ] |
Tytuł: | |
to jak podzielic po ip lub wylapac udp?(bez imq) |
Autor: | -MW- [ środa, 21 listopada 2007, 23:01 ] |
Tytuł: | |
markowanie ruchu udp iptables -t mangle -A MYSHAPER-OUT -p udp -j MARK --set-mark 2222 ruch udp tc filter add dev eth0 parent 1:0 protocol ip prio 5 match ip protocol 17 0xff flowid 1:2 a niby dlaczego? ![]() |
Autor: | tomii [ środa, 21 listopada 2007, 23:07 ] |
Tytuł: | |
MW tak jak piszesz musialbym karzdemu userowi tak zamarkowac udp? W sumie to troche mi namieszaliscie, które rozwiązanie bedzie dobre i bedzie działać? iptables -t mangle -A MYSHAPER-OUT -p udp -j MARK --set-mark 22 (znaczenie - nawet tym samym markiem userowi udp ) czy iptables -t mangle -A MYSHAPER-OUT -s 192.168.1.4 -j MARK --set-mark 22 (jako zaznaczenie wszystkich pakietów z danego ip) ?? |
Autor: | -MW- [ środa, 21 listopada 2007, 23:09 ] |
Tytuł: | |
po co masz markowac od kazdego hosta skoro i tak trafiaja do jednej klasy? bezsesu. mozna tylko zamarkowac poprostu pakiety udp, od kogo one beda pochodzily to nie istotne. gdybys kierowal puch udp od kazdego hosta w osobna klase to mialoby ses wowczas. |
Autor: | tomii [ środa, 21 listopada 2007, 23:11 ] |
Tytuł: | |
karzdemu userowi po to rzeby limit jaki mu przydziele obowiązywał na wszystkie paiety? myle się? (ale wtedy to udp po ip) właściwie to co idzie przez udp? |
Autor: | -MW- [ czwartek, 22 listopada 2007, 00:22 ] |
Tytuł: | |
a moze poprostu kazdego hosta do osobnej klasy - czyli tak jak masz tylko + pakiety udp. w tym skrypcie co zamiesciles kierujesz tylko ruch tcp od hostow do klas. a zeby zamieszac bardziej zapytam co z innymi typami pakietow? ![]() ps. masz moje pliki? |
Autor: | zciech [ czwartek, 22 listopada 2007, 00:36 ] |
Tytuł: | |
-MW- pisze: a niby dlaczego?
A dlatego ze maskarada zmienia adres src i na interfejsie wyjciowym (eth0) wszystkie pakiety jako adres src maja adres tegoż interfejsu |
Strona 1 z 3 | Strefa czasowa UTC+2godz. |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |