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/.
Ja już niwiem co mam z tym zrobić już 2 noc nieśpie :( mam nadzieje, że mi pomożecie. W iptables robie tak.
LAN_ETH='eth0'
iptables -t mangle -A PREROUTING -i $LAN_ETH -j IMQ --todev 1
iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark
iptables -t mangle -A PREROUTING -p tcp --dport 22 -j MARK --set-mark 0x2
# iptables -t mangle -A POSTROUTING -m layer7 --l7proto http -j DROP
iptables -t mangle -A PREROUTING -m mark --mark 0x2 -j CONNMARK --save-mark
iptables -t mangle -A POSTROUTING -m mark --mark 0x2 -j RETURN
# iptables -t mangle -A PREROUTING -m mark --mark 0x2 -j DROP
# iptables -t mangle -A PREROUTING -i $LAN2_ETH -j IMQ --todev 1
# DOWNLOAD
iptables -t mangle -A POSTROUTING -o $LAN_ETH -j IMQ --todev 0
# iptables -A OUTPUT -o $LAN_ETH -j IMQ --todev 0
# iptables -t mangle -A POSTROUTING -o $LAN_ETH -j IMQ --todev 0
[/quote]
Próbowałem najpierw po l7 jak wyzej ale to też niedziałało.
Potem dalej robie tak.ip link set imq0 up
ip link set imq1 up
tc qdisc del root dev imq1
tc qdisc del root dev imq0
tc qdisc add dev imq0 root handle 1:0 hfsc default 2
tc class add dev imq0 parent 1:0 classid 1:1 hfsc ls m2 99000kbit ul m2 99000kbit
tc class add dev imq0 parent 1:1 classid 1:2 hfsc ls m2 96000kbit ul m2 96000kbit
tc class add dev imq0 parent 1:1 classid 1:3 hfsc ls m2 2000kbit ul m2 2000kbit
tc class add dev imq0 parent 1:3 classid 1:100 hfsc ls m2 700kbit ul m2 700kbit
tc qdisc add dev imq0 parent 1:100 esfq perturb 5 hash dst
tc class add dev imq0 parent 1:100 classid 1:1001 hfsc ls m2 10kbit ul m2 10kbit
tc class add dev imq0 parent 1:100 classid 1:1002 hfsc ls m2 500kbit ul m2 500kbit
tc filter add dev imq0 protocol ip preference 1 parent 1:0 handle 0x2 fw flowid 1:1001
tc filter add dev imq0 protocol ip parent 1:0 u32 match ip dst 192.168.2.202 flowid 1:1002[/quote]
Czy robie coś źle ? niedostaje żadnego błędu podczas odpalania no niewiem jak dalej z tym ruszyć.
[url=http://s10.bitefight.pl/c.php?uid=89351]GRYZĘĘĘ[/url]Offline
a co chcesz osiagnac przez takie markowanie bo w tym momencie zbyt duzo nie wynika z tego
Offline
Ogólnie to nic poprostu chciałem to zrozumieć. Aktualnie wydaje mi się że to w miare opanowałem. Bo okazało się że jednak te pakiety markuje tylko trzeba nawiązać nowe połączenie.
A co chce osiągnąć ? Aktualnie mam neo i wifi na 5 osób i chciałbym puścić p2p przez wifi. Dlatego czytam teraz o routingu w linuxe. Jak skończe to może napisze coś na ten temat będzie do działu artów. Chce zrobić coś takiego jak skrypty baroo ale z dowolnym wyborem co którym łaczem ma iść. Na forum inet.one.pl jest rozwiązanie jak puścić squida innym łączem ale dns idą tym samym co p2p więc to nierozwiązało mojego problemu.
Jakby ktoś wiedział jak rozłączyć wszystkie połączenia sieciowe na raz bez ifdown i ifup :) byłbym wdzięczny.
Offline
przykladowo mozes tak zrbic
ip route add x.x.x.0/26 src x.x.x.1 via x.x.x.2 dev eth1 table p2p ip route add default via x.x.x.2 dev eth1 table p2p ip rule add fwmark 0x12 table p2p ip route flush cache
robisz jak wyzej tablice routingu dla dodatkowego lacza wiadomo zaodajesz wpis w [b]/etc/iproute2/rt_tables[/b] wpis przykladowy
252 p2p
no i markujesz pakiety ja to robie po portach
iptables -t mangle -A PREROUTING -p tcp --dport 2001:65535 -s 172.16.0.0/24 -j MARK --set-mark 0x12
no i jeszcze kkilka portow dodatkow na nie przekierowanych blokuje p2p no i po sprawie
PS
masz jaks sensowna dokumentacje do hfsc?
Offline
Sensowną raczej nie pare dni szukałem ale się poddałem bo ona chyba nieistnieje :) raczej przejrzałem skrypty baroo + przeczytałem troche innyc przykładów na necie + http://www.cs.cmu.edu/~hzhang/HFSC/main.html +
http://klaus.geekserver.net/hfsc/hfsc.html no i to by było na tyle.
[b]Biexi[/b] a markowanie p2p i wyrzucanie innym łączem się sprawdza ?
Przecież ten L7 dużo niełapie szczególnie jak te wszystkie dziwne sieci zaczynają udawać czymś czym niesą. Nie lepiej puścić wszystko defaultowym a potem przeżucić www,dns itp. na drugie łącze ?
//poprwaka zrozumiałem jak przeccytałem 2 raz Twojego posta
musze przemyśleć to Twoje rozwiązanie jest całkiem niezłe :)
Apropo umiem zamarkować i przerzucić na inne łącze dns od kompów z sieci lokalnej a jak zamarkować sam serwer ? Próbowałem w mangle output ale mi serwer zablokował ssh i dns wogóle :(
Ktoś odrazu się zapyta a po co Ci to :) Bo przekierowuje ruch dns na binda a on wychodzi łączem default i mam lipe. Bo jak zacznie ktoś zasysać to niby www idzie przez neo ale dns przez wifi i się przestoje robią :)
Co do samego hfsc widać poprawe w działaniu choćby samego ssh. W miare jak będe miał czas postaram się porobić testy bo chciałbym to ustawić tak żeby strony się szybko włączały.
Jeszcze mam pytanie czy robienie imq0 i imq1 dla lanu a potem po dwa imq dla łącz jest sensowne. Bo teoretycznie myśle że tak ale boje się że nadmiar kolejek może spowodować zbyt duże opóźnienia.
Offline
no moezsz ejszcze zobic u siebie cache dns'a i wtedy przynamniej to co jest naj czesciiej otwerane bedzie szybko tlumaczone
vo do imq to nie stosuje bo nie jest mi to w moim przypadku potrzebne wlasnie co do hfsc to bym se priorytety porobila dla poszczegulnych protokolow tak zeby przyspieszyc dzialanie sieci przynajmniej tych podstawowych uslug......
tylko nie lubie sie czyms zajmowac jak nie weim jak to dziala
Offline
Biexi mam problema z tym routingiem. Zamarkowałem ruch dns i puściłem do tablicy neostrada. Jak dam ping -I ip_neo wp.pl przechodzi. Widze że zapytanie DNS też wychodzi z dobrego eth ale niewraca :( za cholere niewiem czemu.
Offline
Ogólnie mam taki model:
NEOSTRADA — ROUTER — (eth1)DEBIAN(eth2) — JA
WIFI ------------------------ (eth0)DEBIAN(eth2) — JA
eth1 - 10.0.0.12
eth2 - 192.168.0.254
Router od neo ma adres 10.0.0.2
I mam markowanie dokładnie jak napisałaś ale po L7 dla DNS.
I żeby wrzucało to do table neostrada. I teraz coś czego nierozumiem.
Jeśli ustawie sobie dns'a na 10.0.0.2 to działa ale jeśli sobie ustawie na coś innego to widze że zapytania wychodzą z odpowiedzniego eth ale coś niewraca. Myślałem że to firewall więc dałem polityke wszystkiego na ACCEPT ale niepomogło. Sorry że zawracam głowe takimi pierdołami ale już ostatnio sie cieszyłem że rozumiem a tu się okazuje że jednak nie.
I teraz tablica neostrada wygląda tak:
192.168.2.0/24 dev eth2 scope link src 192.168.2.1
192.168.0.0/24 dev eth0 scope link src 192.168.0.246
10.0.0.0/8 dev eth1 scope link src 10.0.0.12
127.0.0.0/8 dev lo scope link
default via 10.0.0.2 dev eth1
[/quote]
A tablica main tak
192.168.2.0/24 dev eth2 proto kernel scope link src 192.168.2.1
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.246
10.0.0.0/8 dev eth1 proto kernel scope link src 10.0.0.12
default via 192.168.0.1 dev eth0
[/quote]
[url=http://s10.bitefight.pl/c.php?uid=89351]GRYZĘĘĘ[/url]Offline
Coś takiego znalazłem ostatnio co wedłuk mnie nieco mi rozjaśniło jeśli chodzi o hfsc.
#!/bin/bash # encoding: UTF-8 # # Maciej Bliziński, http://automatthias.wordpress.com/ # # References: # http://www.voip-info.org/wiki/view/QoS+Linux+with+HFSC # http://www.nslu2-linux.org/wiki/HowTo/EnableTrafficShaping # http://www.cs.cmu.edu/~hzhang/HFSC/main.html # Specify parameters of your xDSL. Give values slightly lower than the # nominal ones. For example, my line is 256/128, so I specify 240/100. # Uplink and downlink speeds DOWNLINK=$3 UPLINK=$4 # Device that connects you to the Internet DEV=$2 # Action to be performed ACTION=$1 # IP addresses of the VoIP phones, # if none, set VOIPIPS="" VOIPIPS="" # Interactive class: SSH Terminal, DNS and gaming (Quake) INTERACTIVEPORTS="22 23 53 3389 5900" # VoIP telephony #VOIPPORTS="5060:5100 10000:11000 5000:5059 8000:8016 5004 1720 1731" VOIPPORTS="" # WWW, jabber and IRC BROWSINGPORTS="80 443 8080" # The lowest priority traffic: eDonkey, Bittorrent, etc. P2PPORTS="110 25 21 143 445 137:139 4662 4664 6881:6999" ######################################################################## # Configuration ends here ######################################################################## function check_device() { if [ -z "$DEV" ] ; then echo "$0: stop requires a device, aborting." exit -1 fi } case "$ACTION" in status) check_device echo "[qdisc]" tc -s qdisc show dev $DEV echo "" echo "[class]" tc -s class show dev $DEV echo "" echo "[filter]" tc -s filter show dev $DEV echo "" echo "[iptables]" iptables -t mangle -L THESHAPER -v -x 2> /dev/null exit ;; stop) check_device # Reset everything to a known state (cleared) tc qdisc del dev $DEV root > /dev/null 2>&1 tc qdisc del dev $DEV ingress > /dev/null 2>&1 # Flush and delete tables iptables -t mangle --delete POSTROUTING -o $DEV -j THESHAPER > /dev/null 2>&1 iptables -t mangle --flush THESHAPER 2> /dev/null > /dev/null iptables -t mangle --delete-chain THESHAPER 2> /dev/null > /dev/null echo "Shaping removed on $DEV." exit ;; start) check_device if [ -z "$DOWNLINK" ] ; then echo "$0: start requires a downlink speed, aborting." exit -1 fi if [ -z "$UPLINK" ] ; then echo "$0: start requires an uplink speed, aborting." exit -1 fi # Traffic classes: # 1:2 Interactive (SSH, DNS, ACK, Quake) # 1:3 Low latency (VoIP) # 1:4 Browsing (HTTP, HTTPs) # 1:5 Default # 1:6 Low priority (p2p, pop3, smtp, etc) # add HFSC root qdisc tc qdisc add dev $DEV root handle 1: hfsc default 5 # add main rate limit class tc class add dev $DEV parent 1: classid 1:1 hfsc sc rate ${UPLINK}kbit ul rate ${UPLINK}kbit # Interactive traffic: guarantee realtime full uplink for 50ms, then # 5/10 of the uplink tc class add dev $DEV parent 1:1 classid 1:2 hfsc rt m1 ${UPLINK}kbit d 50ms m2 $((5*$UPLINK/10))kbit ls m1 ${UPLINK}kbit d 50ms m2 $((7*$UPLINK/10))kbit ul rate ${UPLINK}kbit # VoIP: guarantee full uplink for 200ms, then 3/10 tc class add dev $DEV parent 1:1 classid 1:3 hfsc sc m1 ${UPLINK}kbit d 200ms m2 $((3*$UPLINK/10))kbit ul rate ${UPLINK}kbit # Browsing: Don't guarantee anything for the first second, then # guarantee 1/10 tc class add dev $DEV parent 1:1 classid 1:4 hfsc sc m1 0 d 1s m2 $((1*$UPLINK/10))kbit ul rate ${UPLINK}kbit # Default traffic: don't guarantee anything for the first two seconds, # then guarantee 1/20 tc class add dev $DEV parent 1:1 classid 1:5 hfsc sc m1 0 d 2s m2 $((1*$UPLINK/20))kbit ul rate ${UPLINK}kbit # Default traffic: don't guarantee anything for the first 10 seconds, # then guarantee 1/20 tc class add dev $DEV parent 1:1 classid 1:6 hfsc sc m1 0 d 10s m2 $((1*$UPLINK/20))kbit ul rate ${UPLINK}kbit # add THESHAPER chain to the mangle table in iptables iptables -t mangle --new-chain THESHAPER iptables -t mangle --insert POSTROUTING -o $DEV -j THESHAPER # To speed up downloads while an upload is going on, put short ACK # packets in the interactive class: iptables -t mangle -A THESHAPER -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK ACK -m length --length :64 -j CLASSIFY --set-class 1:2 # put large (512+) icmp packets in browsing category iptables -t mangle -A THESHAPER -p icmp -m length --length 512: -j CLASSIFY --set-class 1:4 # ICMP (ip protocol 1) in the interactive class iptables -t mangle -A THESHAPER -p icmp -m length --length :512 -j CLASSIFY --set-class 1:2 setclassbyport() { port=$1 CLASS=$2 iptables -t mangle -A THESHAPER -p udp --sport $port -j CLASSIFY --set-class $CLASS iptables -t mangle -A THESHAPER -p udp --dport $port -j CLASSIFY --set-class $CLASS iptables -t mangle -A THESHAPER -p tcp --sport $port -j CLASSIFY --set-class $CLASS iptables -t mangle -A THESHAPER -p tcp --dport $port -j CLASSIFY --set-class $CLASS } for port in $INTERACTIVEPORTS; do setclassbyport $port 1:2; done for port in $VOIPPORTS; do setclassbyport $port 1:3; done for port in $BROWSINGPORTS; do setclassbyport $port 1:4; done for port in $P2PPORTS; do setclassbyport $port 1:6; done for VOIP in $VOIPIPS do iptables -t mangle -A THESHAPER --src $VOIP -j CLASSIFY --set-class 1:3 iptables -t mangle -A THESHAPER --dst $VOIP -j CLASSIFY --set-class 1:3 done # Try to control the incoming traffic as well. # Set up ingress qdisc tc qdisc add dev $DEV handle ffff: ingress # Filter everything that is coming in too fast # It's mostly HTTP downloads that keep jamming the downlink, so try to restrict # them to 6/10 of the downlink. tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 match ip protocol 6 0xff match ip sport 80 0xffff police rate $((6*${DOWNLINK}/10))kbit burst 10k drop flowid :1 tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 match ip protocol 6 0xff match ip dport 80 0xffff police rate $((6*${DOWNLINK}/10))kbit burst 10k drop flowid :1 ;; *) echo "$0 [ACTION] [device]" echo "ACTION := { start [downlink] [uplink] | stop | status }" exit ;; esac
Offline
Time (s) | Query |
---|---|
0.00010 | SET CHARSET latin2 |
0.00006 | SET NAMES latin2 |
0.00129 | SELECT u.*, g.*, o.logged FROM punbb_users AS u INNER JOIN punbb_groups AS g ON u.group_id=g.g_id LEFT JOIN punbb_online AS o ON o.ident='3.147.53.214' WHERE u.id=1 |
0.00073 | REPLACE INTO punbb_online (user_id, ident, logged) VALUES(1, '3.147.53.214', 1738500534) |
0.00058 | SELECT * FROM punbb_online WHERE logged<1738500234 |
0.00077 | DELETE FROM punbb_online WHERE ident='3.213.213.161' |
0.00046 | SELECT topic_id FROM punbb_posts WHERE id=53142 |
0.00011 | SELECT id FROM punbb_posts WHERE topic_id=6919 ORDER BY posted |
0.00054 | SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM punbb_topics AS t INNER JOIN punbb_forums AS f ON f.id=t.forum_id LEFT JOIN punbb_forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=6919 AND t.moved_to IS NULL |
0.00005 | SELECT search_for, replace_with FROM punbb_censoring |
0.00108 | SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM punbb_posts AS p INNER JOIN punbb_users AS u ON u.id=p.poster_id INNER JOIN punbb_groups AS g ON g.g_id=u.group_id LEFT JOIN punbb_online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=6919 ORDER BY p.id LIMIT 0,25 |
0.00110 | UPDATE punbb_topics SET num_views=num_views+1 WHERE id=6919 |
Total query time: 0.00687 s |