Freesco, NND, CDN, EOS

http://www.freesco.pl
Dzisiaj jest wtorek, 1 lipca 2025, 19:53

Strefa czasowa UTC+2godz.




Nowy temat Odpowiedz w temacie  [ Posty: 3 ] 
Autor Wiadomość
 Tytuł: htb :(
Post: poniedziałek, 6 grudnia 2004, 03:40 
Offline

Rejestracja: wtorek, 3 lutego 2004, 02:10
Posty: 35
witam mam pytanie jak zrobic zeby mi htb nie obcinalo transferu dl i up tylko zeby byly maxymalne wartosci dla lacza 1 mb. Łącząc sie z moim ftpem mam okolo 22 kilo powinno byc okolo 32 .

: [/] [] ()
#!/bin/bash
# rc.htb 0.1a.upl/down  Zciech
#
# 19.07.04
# wpisy hostow umiescic w pliku /etc/htb_config:
# Adres_IP max_download max_upload

# 192.168.1.2 128 64 #Jacek
# 192.168.1.2 256 128 #Agatka
# po ostatnim adresie enter, nie umieszczac pustych lini
# dopuszczalne komentarze '#"



htb_config=/etc/htb_config
#htb_config=./htb_config

# wpisac wartosci dla waszej sieci
# moze kiedys zrobie konfigurator :)
WANINT=eth0     # iterfejs do internetu
LANINT=eth1     # interfejs do Lanu
WANDOWN=1056    # Download w kbit/s
WANUP=256     # Upload w kbit/s
LANSPD=10000    # Predkoc Lanu w kbit/s

# Jesli tu dasz za duzo moze nic nie zostac dla userow :)
ICMPSPD=5   # Predkosc dla klasy ICMP kbit/s
SERVSPD=5   # Predkosc dla gosci kbit/s

PRIOPORT=22     # Port priorytetowy
SFQ="sfq perturb 10" #SFQ
STARTMRK=2      # Startowy MARK

h=/sbin/rchtb_tc
#h=echo
i=iptables
#i=echo

stop()
{
 $i -F -t mangle
 $i -X -t mangle
 $h qdisc del root dev $WANINT 2> /dev/null
 $h qdisc del root dev $LANINT 2> /dev/null
}

start()
{
 stop # dla bezpieczeństwa
 # obliczenia
 WANDOWN=$[$WANDOWN*100/100]
 WANUP=$[$WANUP*100/100]
 LANSPD=$[$LANSPD*95/100]
 LOCAL=$[$LANSPD-$WANDOWN]
 ACKSPD=$[$WANDOWN/20]   
 CNT=0
 for ii in `cat $htb_config| cut -d "#" -f1 |awk '{print $1}'`;do
    CNT=$[$CNT+1]
 done 
 if [ $CNT = 0 ]; then
    CNT=1
 fi   
 USERDOWN=$[$WANDOWN/$CNT]
 if [ $USERDOWN = 0 ]; then
    USERDOWN=1
 fi
 USERUP=$[$WANUP-$ACKSPD-$ICMPSPD-$SERVSPD]
 USERUP=$[$USERUP/$CNT]
 if [ $USERUP = 0 ]; then
      USERUP=1
 fi       
 # INTERFEJS LANINT (ruch przychodz±cy)
 $h qdisc add dev $LANINT root handle 1:0 htb default 3 r2q 1
 
 # Główna klasa dla LANINT
 $h class add dev $LANINT parent 1:0 classid 1:1 htb rate ${LANSPD}kbit ceil ${LANSPD}kbit
 
 # Podział na pasmo dla ł±cza internetowego i resztę
 $h class add dev $LANINT parent 1:1 classid 1:2 htb rate ${WANDOWN}kbit ceil ${WANDOWN}kbit
 $h class add dev $LANINT parent 1:1 classid 1:3 htb rate ${LOCAL}kbit ceil ${LOCAL}kbit prio 9
 $h qdisc add dev $LANINT parent 1:3 $SFQ

 # pasmo priorytetowe dla ICMP, TOS 0x10 (min. delay) oraz wybranego portu 22
 $h class add dev $LANINT parent 1:2 classid 1:4 htb rate ${USERDOWN}kbit ceil ${WANDOWN}kbit prio 1 quantum 1500
 $h qdisc add dev $LANINT parent 1:4 sfq perturb 10
 $h filter add dev $LANINT protocol ip prio 2 parent 1:0 u32 match ip sport 22 0xffff flowid 1:4
 $h filter add dev $LANINT protocol ip prio 1 parent 1:0 u32 match ip tos 0x10 0xff flowid 1:4
 $h filter add dev $LANINT protocol ip prio 1 parent 1:0 u32 match ip protocol 1 0xff flowid 1:4
 
 # transfer serwer->LAN
 $h filter add dev $LANINT protocol ip prio 4 parent 1:0 handle 1 fw flowid 1:3
   
 # INTERFEJS  (ruch wychodz±cy)
 $h qdisc add dev $WANINT root handle 2:0 htb default 11 r2q 1
     
 # główna klasa
 $h class add dev $WANINT parent 2:0 classid 2:1 htb rate ${WANUP}kbit ceil ${WANUP}kbit
       
 # klasa priorytetowa ACK
 $h class add dev $WANINT parent 2:1 classid 2:2 htb rate ${ACKSPD}kbit ceil ${WANUP}kbit prio 1 quantum 1500
 $h qdisc add dev $WANINT parent 2:2 sfq perturb 10
 $h filter add dev $WANINT 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:2 # ACK

 # klasa priorytetowa TOS 0x10 oraz ICMP i DNS
 $h class add dev $WANINT parent 2:1 classid 2:3 htb rate ${ICMPSPD}kbit ceil ${WANUP}kbit prio 2 quantum 1500
 $h qdisc add dev $WANINT parent 2:3 $SFQ
 $h filter add dev $WANINT parent 2:0 protocol ip prio 1 u32 match ip tos 0x10 0xff flowid 2:3 # TOS
 $h filter add dev $WANINT parent 2:0 protocol ip prio 2 u32 match ip dport 22 0xffff flowid 2:3 # port 22
 $h filter add dev $WANINT parent 2:0 protocol ip prio 2 u32 match ip sport 22 0xffff flowid 2:3 # port 22
 $h filter add dev $WANINT parent 2:0 protocol ip prio 1 u32 match ip dport 53 0xffff flowid 2:3 # port 53
 $h filter add dev $WANINT parent 2:0 protocol ip prio 1 u32 match ip protocol 1 0xff flowid 2:3 # ICMP
 
 # ruch dla gosci
 $h class add dev $WANINT parent 2:1 classid 2:4 htb rate ${SERVSPD}kbit ceil ${WANUP}kbit prio 2 quantum 1500
 $h qdisc add dev $WANINT parent 2:4 $SFQ
 $h filter add dev $WANINT parent 2:0 protocol ip prio 3 handle 1 fw flowid 2:4
 $i -t mangle -A OUTPUT -j MARK --set-mark 1     

 # Userzy
 CNT=1
 MARK=$STARTMRK
 grep "^" $htb_config | grep -v "^#"| while read IP USERDOWN1 USERUP1 REM; do
    if [ $USERDOWN -gt $USERDOWN1 ]; then
   USERDOWN=$USERDOWN1
    fi   
    if [ $USERUP -gt $USERUP1 ]; then
        USERUP=$USERUP1
    fi
    if [ $USERUP1 -gt $WANUP ]; then
        USERUP1=$WANUP
    fi
    if [ $USERDOWN1 -gt $WANDOWN ]; then
        USERDOWN1=$WANDOWN
    fi
    $h class add dev $LANINT parent 1:2 classid 1:$[10+$CNT] htb rate ${USERDOWN}kbit ceil ${USERDOWN1}kbit prio 2 quantum 1500
    $h qdisc add dev $LANINT parent 1:$[10+$CNT] $SFQ
    $h filter add dev $LANINT protocol ip prio 5 parent 1:0 u32 match ip dst $IP flowid 1:$[10+$CNT]
    $i -t mangle -A PREROUTING -s $IP -j MARK --set-mark $MARK
    $h class add dev $WANINT parent 2:1 classid 2:$[10+$CNT] htb rate ${USERUP}kbit ceil ${USERUP1}kbit prio 2 quantum 1500
    $h qdisc add dev $WANINT parent 2:$[10+$CNT] $SFQ
    $h filter add dev $WANINT parent 2:0 protocol ip prio 5 handle $MARK fw flowid 2:$[10+$CNT]
    MARK=$[$MARK+1]
    CNT=$[$CNT+1]
 done
 
 # reszta   
 $h filter add dev $WANINT parent 2:0 protocol ip prio 9 u32 match ip dst 0/0 flowid 2:4
}



Na górę
 Wyświetl profil  
 
 Tytuł:
Post: poniedziałek, 6 grudnia 2004, 17:57 
Offline
MODERATOR

Rejestracja: poniedziałek, 29 lipca 2002, 15:45
Posty: 1385
Lokalizacja: Polska
Może masz ograniczenie na serwerze ftp ?
Proftpd ma coś takiego ...

_________________
Określenie przy nicku to tylko dla 'jaj'; tytuł za ilość postów.
Ja ciągle się uważam za niewinne dziecię w sprawach linuksa; żaden guru czy inny moderator :-)


Na górę
 Wyświetl profil  
 
 Tytuł:
Post: poniedziałek, 6 grudnia 2004, 18:07 
Offline

Rejestracja: wtorek, 3 lutego 2004, 02:10
Posty: 35
ograniczenia na ftp nie mam , ale zrobilem to w ten sposob ze ustawilem mu upload wiekszy niz pozwala lacze i teraz chodzi dobrze


Na górę
 Wyświetl profil  
 
Wyświetl posty nie starsze niż:  Sortuj wg  
Nowy temat Odpowiedz w temacie  [ Posty: 3 ] 

Strefa czasowa UTC+2godz.


Kto jest online

Użytkownicy przeglądający to forum: Obecnie na forum nie ma żadnego zarejestrowanego użytkownika i 7 gości


Nie możesz tworzyć nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz dodawać załączników

Szukaj:
Przejdź do:  
cron
Technologię dostarcza phpBB® Forum Software © phpBB Group
Hosting: Compus-Net
RobertKonik.pl