To | Debian CZ/SK project discussion list <czdebian-l zavinac debian bod cz> |
From | Bob - konfery <bob_konfery zavinac kanguru bod org> |
Date | Sat, 01 Jul 2006 12:14:16 +0200 |
User-agent | Thunderbird 1.5.0.4 (Windows/20060516) |
Prosim napsal(a):
Bobe! Myslíš, že už je večer? Někteří z nás by moc rádi dostali ten script na HTB. Popř. ještě nějakou tu radu do začátku.Děkujeme ================================----- Original Message ----- From: "taz" <mila bod zajicek zavinac gmail bod com>To: "Debian CZ/SK project discussion list" <czdebian-l zavinac debian bod cz> Sent: Friday, June 30, 2006 4:11 PM Subject: Re: HTB Jéé tak ten funkční script pro inspiraci dej pls sem. Budu si s tím hrát zítra taky. On 6/30/06, Bob - konfery <bob_konfery zavinac kanguru bod org> wrote:Kdyz se mi pripomenes vecer, poslu ti funkcni script pro inspiraci. Podle tohohle jsem take zacinal a nejelo to stejne jako tobe. Jinak se to nepise do terminalu, ale udela se bash script. Bob Prosim napsal(a):Zdravím, dostal jsem se k nastavení HTB. Postupiji podle návodů nawww.root.cz/clanky/htb-jemny-uvod, ale uvízl jsem hned na druhém řádku.Jestli to dobře chápu, tak ty příkazy mám psát do terminálu.?. Když opíšu první řádek (tc qdisc del dev eth0 root), tak to nevypíšenic.U druhého řádku (tc qdisc add dev eth0 root handle 1:0 htb default14) to vypíše: "HTB init, kernel part version 3.16".To je to poslední co mi jde. U dalšího řádku (tc class add dev eth0 parent 1:0 classid 1:1 htbrate 256kbit) to vypíše chybu: " Error: Qdisc "parnet" is classless ".Tuto chybu to vyhazuje i když zadám 4-7 řádek. Chci se zeptat co dělám špatně? Když zadám ten příkaz bez parnet, tak to vypíše: " Error: Qdisc "1:0" isclassless "Když zadám ten příkaz bez parnet i bez 1:0, tak to vypíše prozměnu: "RTNETLINK answers: No such file or directory "Poraďte mi prosím někdo jak mám pokračovat dále... Děkuji ________________________________________________ CZdebian-l maillist - CZdebian-l zavinac debian bod cz http://www.debian.cz/mailman/listinfo/czdebian-l E-mail (un)subscriptions: czdebian-l-request zavinac debian bod cz __________ Informace od NOD32 1.1634 (20060630) __________ Tato zprava byla proverena antivirovym systemem NOD32. http://www.nod32.cz________________________________________________ CZdebian-l maillist - CZdebian-l zavinac debian bod cz http://www.debian.cz/mailman/listinfo/czdebian-l E-mail (un)subscriptions: czdebian-l-request zavinac debian bod cz________________________________________________ CZdebian-l maillist - CZdebian-l zavinac debian bod cz http://www.debian.cz/mailman/listinfo/czdebian-lE-mail (un)subscriptions: czdebian-l-request zavinac debian bod cz________________________________________________ CZdebian-l maillist - CZdebian-l zavinac debian bod cz http://www.debian.cz/mailman/listinfo/czdebian-l E-mail (un)subscriptions: czdebian-l-request zavinac debian bod cz __________ Informace od NOD32 1.1635 (20060630) __________ Tato zprava byla proverena antivirovym systemem NOD32. http://www.nod32.cz
#!/bin/bash ###################### # Definice promenych # ###################### RATE=3072 ALL=2944 U1MIN=64 # 172.16.20.32 a 172.16.3.13 U1MAX=128 U2MIN=64 # 192.168.230.28 a 172.16.20.13 U2MAX=256 DEFAULT=3 U1=1 U2=2 U1IP=172.16.20.32 U2IP=172.16.20.47 U3IP=172.16.3.13 U4IP=172.16.20.13 U5IP=172.16.240.3 U6IP=172.16.240.4 #################### # Oznaceni provozu # #################### iptables -t mangle -F FORWARD iptables -t mangle -A FORWARD -j MARK --set-mark ${DEFAULT} iptables -t mangle -A FORWARD -d ${U1IP} -j MARK --set-mark ${U1} iptables -t mangle -A FORWARD -s ${U1IP} -j MARK --set-mark ${U1} iptables -t mangle -A FORWARD -d ${U3IP} -j MARK --set-mark ${U1} iptables -t mangle -A FORWARD -s ${U3IP} -j MARK --set-mark ${U1} iptables -t mangle -A FORWARD -d ${U2IP} -j MARK --set-mark ${U2} iptables -t mangle -A FORWARD -s ${U2IP} -j MARK --set-mark ${U2} iptables -t mangle -A FORWARD -d ${U4IP} -j MARK --set-mark ${U2} iptables -t mangle -A FORWARD -s ${U4IP} -j MARK --set-mark ${U2} iptables -t mangle -A FORWARD -d ${U5IP} -j MARK --set-mark ${U2} iptables -t mangle -A FORWARD -s ${U5IP} -j MARK --set-mark ${U2} iptables -t mangle -A FORWARD -d ${U6IP} -j MARK --set-mark ${U2} iptables -t mangle -A FORWARD -s ${U6IP} -j MARK --set-mark ${U2} iptables -t mangle -F OUTPUT iptables -t mangle -A OUTPUT -p tcp --sport 3128 -j MARK --set-mark ${DEFAULT} iptables -t mangle -A OUTPUT -p tcp --sport 3128 -d ${U1IP} -j MARK --set-mark ${U1} iptables -t mangle -A OUTPUT -p tcp --sport 3128 -d ${U3IP} -j MARK --set-mark ${U1} iptables -t mangle -A OUTPUT -p tcp --sport 3128 -d ${U2IP} -j MARK --set-mark ${U2} iptables -t mangle -A OUTPUT -p tcp --sport 3128 -d ${U4IP} -j MARK --set-mark ${U2} iptables -t mangle -A OUTPUT -p tcp --sport 3128 -d ${U5IP} -j MARK --set-mark ${U2} iptables -t mangle -A OUTPUT -p tcp --sport 3128 -d ${U6IP} -j MARK --set-mark ${U2} ######################################### # Omezeni downloadu (vnitrni interface) # ######################################### tc qdisc del dev eth0 root tc qdisc add dev eth0 root handle 1:0 htb default 1${DEFAULT} tc class add dev eth0 parent 1:0 classid 1:1 htb rate ${RATE}kbit tc class add dev eth0 parent 1:1 classid 1:1${U1} htb rate ${U1MIN}kbit ceil ${U1MAX}kbit tc class add dev eth0 parent 1:1 classid 1:1${U2} htb rate ${U2MIN}kbit ceil ${U2MAX}kbit tc class add dev eth0 parent 1:1 classid 1:1${DEFAULT} htb rate ${ALL}kbit ceil ${RATE}kbit tc qdisc add dev eth0 parent 1:1${U1} handle 1${U1}:0 sfq perturb 1 tc qdisc add dev eth0 parent 1:1${U2} handle 1${U2}:0 sfq perturb 1 tc qdisc add dev eth0 parent 1:1${DEFAULT} handle 1${DEFAULT}:0 sfq perturb 1 tc filter add dev eth0 parent 1:0 protocol ip handle ${U1} fw flowid 1:1${U1} tc filter add dev eth0 parent 1:0 protocol ip handle ${U2} fw flowid 1:1${U1} tc filter add dev eth0 parent 1:0 protocol ip handle ${DEFAULT} fw flowid 1:1${DEFAULT} tc qdisc del dev eth3 root tc qdisc add dev eth3 root handle 1:0 htb default 1${DEFAULT} tc class add dev eth3 parent 1:0 classid 1:1 htb rate ${RATE}kbit tc class add dev eth3 parent 1:1 classid 1:1${U1} htb rate ${U1MIN}kbit ceil ${U1MAX}kbit tc class add dev eth3 parent 1:1 classid 1:1${U2} htb rate ${U2MIN}kbit ceil ${U2MAX}kbit tc class add dev eth3 parent 1:1 classid 1:1${DEFAULT} htb rate ${ALL}kbit ceil ${RATE}kbit tc qdisc add dev eth3 parent 1:1${U1} handle 1${U1}:0 sfq perturb 1 tc qdisc add dev eth3 parent 1:1${U2} handle 1${U2}:0 sfq perturb 1 tc qdisc add dev eth3 parent 1:1${DEFAULT} handle 1${DEFAULT}:0 sfq perturb 1 tc filter add dev eth3 parent 1:0 protocol ip handle ${U1} fw flowid 1:1${U1} tc filter add dev eth3 parent 1:0 protocol ip handle ${U2} fw flowid 1:1${U2} tc filter add dev eth3 parent 1:0 protocol ip handle ${DEFAULT} fw flowid 1:1${DEFAULT} ##################################### # Omezeni uploadu (vnejsi rozhrani) # ##################################### tc qdisc del dev eth2 root tc qdisc add dev eth2 root handle 1:0 htb default 1${DEFAULT} tc class add dev eth2 parent 1:0 classid 1:1 htb rate ${RATE}kbit tc class add dev eth2 parent 1:1 classid 1:1${U1} htb rate ${U1MIN}kbit ceil ${U1MAX}kbit tc class add dev eth2 parent 1:1 classid 1:1${U2} htb rate ${U2MIN}kbit ceil ${U2MAX}kbit tc class add dev eth2 parent 1:1 classid 1:1${DEFAULT} htb rate ${ALL}kbit ceil ${RATE}kbit tc qdisc add dev eth2 parent 1:1${U1} handle 1${U1}:0 sfq perturb 1 tc qdisc add dev eth2 parent 1:1${U2} handle 1${U2}:0 sfq perturb 1 tc qdisc add dev eth2 parent 1:1${DEFAULT} handle 1${DEFAULT}:0 sfq perturb 1 tc filter add dev eth2 parent 1:0 protocol ip handle ${U1} fw flowid 1:1${U1} tc filter add dev eth2 parent 1:0 protocol ip handle ${U2} fw flowid 1:1${U2} tc filter add dev eth2 parent 1:0 protocol ip handle ${DEFAULT} fw flowid 1:1${DEFAULT}