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/.
Witam
Ostatnio miałem problem z uplodem ,poniewaz ludzie zaczynali sporo pakować do netu :/
Szybko sie zorientowałem ze mój podział był dziurawy na upload a teraz postanowiłem to poprawić i trzeba było pomarkować pakiety - zrobiłem niby lepiej ale nei jestem pewien czy rzeczywiscie do konca.
MOJA PROŚBA sprawdzcie mi ten skrypcik :
#!/bin/bash ################## DOWNLOAD # czyszczenie tc qdisc del root dev eth1 2>/dev/null tc qdisc del root dev eth0 2>/dev/null iptables -t mangle -D POSTROUTING -o eth0 -j upload 2>/dev/null iptables -t mangle -F upload 2>/dev/null iptables -t mangle -X upload 2>/dev/null #reszta tc qdisc add dev eth1 root handle 1:0 htb tc class add dev eth1 parent 1:0 classid 1:1 htb rate 90000kbit ceil 90000kbit tc class add dev eth1 parent 1:1 classid 1:2 htb rate 1000kbit ceil 1000kbit tc class add dev eth1 parent 1:1 classid 1:3 htb rate 8500kbit ceil 8500kbit #Userzy tc class a dev eth1 parent 1:2 classid 1:4 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:5 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:6 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:7 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:8 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:9 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:10 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:11 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:12 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:13 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:14 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:15 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:16 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:17 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:18 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:19 htb rate 96kbit ceil 512kbit tc class a dev eth1 parent 1:2 classid 1:20 htb rate 96kbit ceil 512kbit #Filtry tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip src 192.168.1.1 flowid 1:3 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.2 flowid 1:4 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.3 flowid 1:5 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.4 flowid 1:6 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.5 flowid 1:7 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.6 flowid 1:8 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.7 flowid 1:9 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.8 flowid 1:10 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.9 flowid 1:11 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.10 flowid 1:12 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.11 flowid 1:13 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.12 flowid 1:14 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.13 flowid 1:15 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.14 flowid 1:16 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.15 flowid 1:17 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.16 flowid 1:18 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.17 flowid 1:19 tc filter add dev eth1 protocol ip preference 2 parent 1:0 u32 match ip dst 192.168.1.19 flowid 1:20 #rowny podzial tc qdisc add dev eth1 parent 1:3 handle 3:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:4 handle 4:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:5 handle 5:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:6 handle 6:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:7 handle 7:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:8 handle 8:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:9 handle 9:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:10 handle 10:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:11 handle 11:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:12 handle 12:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:13 handle 13:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:14 handle 14:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:15 handle 15:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:16 handle 16:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:17 handle 17:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:18 handle 18:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:19 handle 19:0 sfq perturb 10 tc qdisc add dev eth1 parent 1:20 handle 20: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 40kbit ceil 80kbit #userzy tc class add dev eth0 parent 1:1 classid 1:3 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:4 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:5 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:6 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:7 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:8 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:9 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:10 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:11 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:12 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:13 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:14 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:15 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:16 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:17 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:18 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:19 htb rate 20kbit ceil 40kbit tc class add dev eth0 parent 1:1 classid 1:20 htb rate 20kbit ceil 40kbit #rowny podzial 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:7 handle 7:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:8 handle 8:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:9 handle 9:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:10 handle 10:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:11 handle 11:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:12 handle 12:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:13 handle 13:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:14 handle 14:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:15 handle 15:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:16 handle 16:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:17 handle 17:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:18 handle 18:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:19 handle 19:0 sfq perturb 10 tc qdisc add dev eth0 parent 1:20 handle 20:0 sfq perturb 10 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 24 fw flowid 1:3 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 25 fw flowid 1:4 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 26 fw flowid 1:5 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 27 fw flowid 1:6 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 28 fw flowid 1:7 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 29 fw flowid 1:8 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 30 fw flowid 1:9 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 31 fw flowid 1:10 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 32 fw flowid 1:11 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 33 fw flowid 1:12 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 34 fw flowid 1:13 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 35 fw flowid 1:14 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 36 fw flowid 1:15 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 37 fw flowid 1:16 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 38 fw flowid 1:17 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 39 fw flowid 1:18 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 40 fw flowid 1:19 tc filter add dev eth0 protocol ip preference 2 parent 1:0 handle 41 fw flowid 1:20 #iptables iptables -t mangle -N upload iptables -t mangle -I POSTROUTING -o eth0 -j upload iptables -t mangle -A upload -s 192.168.1.2 -j MARK --set-mark 25 iptables -t mangle -A upload -s 192.168.1.3 -j MARK --set-mark 26 iptables -t mangle -A upload -s 192.168.1.4 -j MARK --set-mark 27 iptables -t mangle -A upload -s 192.168.1.5 -j MARK --set-mark 28 iptables -t mangle -A upload -s 192.168.1.6 -j MARK --set-mark 29 iptables -t mangle -A upload -s 192.168.1.7 -j MARK --set-mark 30 iptables -t mangle -A upload -s 192.168.1.8 -j MARK --set-mark 31 iptables -t mangle -A upload -s 192.168.1.9 -j MARK --set-mark 32 iptables -t mangle -A upload -s 192.168.1.10 -j MARK --set-mark 33 iptables -t mangle -A upload -s 192.168.1.11 -j MARK --set-mark 34 iptables -t mangle -A upload -s 192.168.1.12 -j MARK --set-mark 35 iptables -t mangle -A upload -s 192.168.1.13 -j MARK --set-mark 36 iptables -t mangle -A upload -s 192.168.1.14 -j MARK --set-mark 37 iptables -t mangle -A upload -s 192.168.1.15 -j MARK --set-mark 38 iptables -t mangle -A upload -s 192.168.1.16 -j MARK --set-mark 39 iptables -t mangle -A upload -s 192.168.1.17 -j MARK --set-mark 40 iptables -t mangle -A upload -s 192.168.1.19 -j MARK --set-mark 41 iptables -t mangle -A upload -m mark --mark 0 -j MARK --set-mark 24 # END
Offline
Qrna i źle dzieli :/
GDZIE JEST BŁĄD ? :(
Offline
najprawdopodobniej problem jest w markowaniu pakietow, mianowice robisz to juz za pozno. kiedy pakiety przechodza przez eth0 to sa po NAT'owaniu czyli wszyskie maja jako adres zrodlowy adres karty eth0 ( zew ip ). musisz je markowac jak trafiaja do serwera czyli na interfejsie eth1
...
iptables -t mangle -N upload
[b]iptables -t mangle -I PREROUTING -i eth1 -j upload[/b]
iptables -t mangle -A upload -s 192.168.1.2 -j MARK --set-mark 25
...
jednoczesnie polecam IMQ, jest to znacznie wygodniejsze i wg. mnie stabilniejsze rozwiazanie
radzil bym ci jeszcze zmienic wartos rate dla kazdej kolejki i zastosowac regole ze suma rate klas potomnych musi byc mniejsza nic ceil klasy nadrzednej czyli jak masz 18 kolejek dla uploadu to zrob dla kazdej rate w wielkosci max 80/18 ( gdzie 80 to jest oczywisce kbit ceil dla kolejki nadrzednej) [/b]
Offline
Zrebootowałem serwer (jeszcze wczoraj - wywaliły się pierdoły z iptables) zapuściłem teraz ten skrypt i jest pięknie :)
Jak będą problemy skorzystam z Twojej rady i wrzuce to markowanie jeszcze do firewall'a :D
Ale niby działa ...
Offline
Time (s) | Query |
---|---|
0.00010 | SET CHARSET latin2 |
0.00004 | SET NAMES latin2 |
0.00134 | 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.148.108.33' WHERE u.id=1 |
0.00077 | REPLACE INTO punbb_online (user_id, ident, logged) VALUES(1, '3.148.108.33', 1738353277) |
0.00050 | SELECT * FROM punbb_online WHERE logged<1738352977 |
0.00081 | DELETE FROM punbb_online WHERE ident='18.227.52.200' |
0.00081 | DELETE FROM punbb_online WHERE ident='3.135.195.180' |
0.00073 | DELETE FROM punbb_online WHERE ident='3.135.207.254' |
0.00057 | DELETE FROM punbb_online WHERE ident='3.137.200.45' |
0.00244 | DELETE FROM punbb_online WHERE ident='3.15.5.211' |
0.00054 | SELECT topic_id FROM punbb_posts WHERE id=26024 |
0.00031 | SELECT id FROM punbb_posts WHERE topic_id=3304 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=3304 AND t.moved_to IS NULL |
0.00025 | SELECT search_for, replace_with FROM punbb_censoring |
0.00083 | 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=3304 ORDER BY p.id LIMIT 0,25 |
0.00060 | UPDATE punbb_topics SET num_views=num_views+1 WHERE id=3304 |
Total query time: 0.01118 s |