LINUX.ORG.RU
решено ФорумAdmin

Пакеты улетают не в ту очередь по fwmark...


0

1

Привет.

Сам скрипт показан в моем старом топике: вкратце, он с помощью L7-модуля для iptables маркирует трафик, который потом идет по очередям HTB/SFQ. Ссылка - Сколько очередей для счастья нужно? (комментарий)

А вот его статистика, на которую я удосужился взглянуть! Как видим, все пакеты пошли на очередь 26, хотя в таблице mangle статистика маркировки, вроде бы, не врет. Прошу помочь советом, где я накосячил?!

# /etc/init.d/shaper.init status
[qdisc]
qdisc htb 1: root r2q 10 default 26 direct_packets_stat 1
 Sent 1580274100233 bytes 1897946686 pkt (dropped 27761148, overlimits 2371280112 requeues 0)
 rate 0bit 0pps backlog 0b 95p requeues 0
qdisc sfq 20: parent 1:20 limit 127p quantum 1514b perturb 10sec
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc sfq 21: parent 1:21 limit 127p quantum 1514b perturb 10sec
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc sfq 22: parent 1:22 limit 127p quantum 1514b perturb 10sec
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc sfq 23: parent 1:23 limit 127p quantum 1514b perturb 10sec
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc sfq 24: parent 1:24 limit 127p quantum 1514b perturb 10sec
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc sfq 25: parent 1:25 limit 127p quantum 1514b perturb 10sec
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc sfq 26: parent 1:26 limit 127p quantum 1514b perturb 10sec
 Sent 1580274098645 bytes 1897946683 pkt (dropped 27761148, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 131344b 94p requeues 0
[class]
class htb 1:22 parent 1:1 leaf 22: prio 2 rate 1462Kbit ceil 10240Kbit burst 1599b cburst 1599b
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 8549 ctokens: 1220

class htb 1:23 parent 1:1 leaf 23: prio 3 rate 1462Kbit ceil 10240Kbit burst 1599b cburst 1599b
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 8549 ctokens: 1220

class htb 1:1 root rate 10240Kbit ceil 10240Kbit burst 1599b cburst 1599b
 Sent 1578812184133 bytes 1897946592 pkt (dropped 0, overlimits 0 requeues 0)
 rate 9383Kbit 998pps backlog 0b 0p requeues 0
 lended: 1126507195 borrowed: 0 giants: 0
 tokens: -1127 ctokens: -1127

class htb 1:20 parent 1:1 leaf 20: prio 0 rate 1462Kbit ceil 10240Kbit burst 1599b cburst 1599b
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 8549 ctokens: 1220

class htb 1:21 parent 1:1 leaf 21: prio 1 rate 1462Kbit ceil 10240Kbit burst 1599b cburst 1599b
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 8549 ctokens: 1220

class htb 1:26 parent 1:1 leaf 26: prio 6 rate 1462Kbit ceil 10240Kbit burst 1599b cburst 1599b
 Sent 1580274101727 bytes 1897946687 pkt (dropped 27761148, overlimits 0 requeues 0)
 rate 9392Kbit 1000pps backlog 0b 95p requeues 0
 lended: 771439397 borrowed: 1126507195 giants: 0
 tokens: -4178 ctokens: -1127

class htb 1:24 parent 1:1 leaf 24: prio 4 rate 1462Kbit ceil 10240Kbit burst 1599b cburst 1599b
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 8549 ctokens: 1220

class htb 1:25 parent 1:1 leaf 25: prio 5 rate 1462Kbit ceil 10240Kbit burst 1599b cburst 1599b
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 8549 ctokens: 1220

class sfq 26:d2 parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 10p requeues 0
class sfq 26:d4 parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 9p requeues 0
class sfq 26:105 parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 8p requeues 0
class sfq 26:114 parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 9p requeues 0
class sfq 26:18a parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 2p requeues 0
class sfq 26:1d8 parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 13p requeues 0
class sfq 26:241 parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 8p requeues 0
class sfq 26:28d parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 7p requeues 0
class sfq 26:2ad parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 5p requeues 0
class sfq 26:2c0 parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 1p requeues 0
class sfq 26:301 parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 6p requeues 0
class sfq 26:30d parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 6p requeues 0
class sfq 26:316 parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 1p requeues 0
class sfq 26:334 parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 2p requeues 0
class sfq 26:35d parent 26:
 (dropped 0, overlimits 0 requeues 0)
 backlog 0b 8p requeues 0
[filter]
filter parent 1: protocol ip pref 49151 fw
filter parent 1: protocol ip pref 49151 fw handle 0x1a classid 1:26
filter parent 1: protocol ip pref 49151 fw
filter parent 1: protocol ip pref 49151 fw handle 0x19 classid 1:25
filter parent 1: protocol ip pref 49151 fw
filter parent 1: protocol ip pref 49151 fw handle 0x18 classid 1:24
filter parent 1: protocol ip pref 49151 fw
filter parent 1: protocol ip pref 49151 fw handle 0x17 classid 1:23
filter parent 1: protocol ip pref 49151 fw
filter parent 1: protocol ip pref 49151 fw handle 0x16 classid 1:22
filter parent 1: protocol ip pref 49151 fw
filter parent 1: protocol ip pref 49151 fw handle 0x15 classid 1:21
filter parent 1: protocol ip pref 49152 fw
filter parent 1: protocol ip pref 49152 fw handle 0x14 classid 1:20
[iptables]
Chain MYSHAPER-OUT (1 references)
    pkts      bytes target     prot opt in     out     source               destination
332191581 211360746716 MARK       all  —  any    any     anywhere             anywhere            protocol Bittorrent  MARK set 0x1a
       0        0 MARK       all  —  any    any     anywhere             anywhere            protocol eDonkey  MARK set 0x1a
       0        0 MARK       all  —  any    any     anywhere             anywhere            protocol Gnutella  MARK set 0x1a
       0        0 MARK       all  —  any    any     anywhere             anywhere            protocol Kazaa/Fasttrack  MARK set 0x1a
       0        0 MARK       all  —  any    any     anywhere             anywhere            protocol FTP  MARK set 0x19
     206   143860 MARK       tcp  —  any    any     anywhere             anywhere             tcp dpt:5190 MARK set 0x17
       0        0 MARK       all  —  any    any     anywhere             anywhere            protocol SSH  MARK set 0x16
    2001  2315839 MARK       all  —  any    any     anywhere             anywhere            protocol Telnet  MARK set 0x16
400013264 19092884832 MARK       tcp  —  any    any     anywhere             anywhere             length 0:64 MARK set 0x15
266164190 355261671819 MARK       tcp  —  any    any     anywhere             anywhere             tcp spt:http MARK set 0x15
24895283 16557141366 MARK       tcp  —  any    any     anywhere             anywhere             tcp spt:https MARK set 0x15
     536    37744 MARK       all  —  any    any     anywhere             anywhere            protocol DNS  MARK set 0x15
    1681   858642 MARK       tcp  —  any    any     anywhere             anywhere             tcp spt:domain MARK set 0x15
15472968 1423395748 MARK       icmp —  any    any     anywhere             anywhere             MARK set 0x14
   69439 37305748 MARK       all  —  any    any     anywhere             anywhere            protocol SIP  MARK set 0x14
 3052599 799328278 MARK       all  —  any    any     anywhere             anywhere            protocol RTP  MARK set 0x14
1925431007 1586569852338 MARK       all  —  any    any     anywhere             anywhere             MARK set 0x1a

#

уменьшь количество фильтров и классов/очередей для отладки(допустим 2 - приоритетная и неприоритетная), покури выхлоп tc -s qdisc/filter/class. Ну и покажи как добавляется qdisc/class и фильтры на интерфейс. И, я надеюсь, ты шейпишь ИСХОДЯЩИЙ трафик?

Pinkbyte ★★★★★
()

стоп! Ты делаешь MARK в mangle/POSTROUTING(судя по ссылки в 1 посте)? Сдаеться мне что это надо делать в mangle/FORWARD ну или mangle/OUTPUT в зависимости от типа трафика.

Pinkbyte ★★★★★
()
Ответ на: комментарий от Pinkbyte

Переместил в FORWARD, - совершенно эквипенисуально: они же в моем случае подряд идут. И маркируется в обоих случаях верно - листинг iptables показывает все цепи. А вот на чем висит сам очередятор - я не вполне себе понимаю. Вообще, есть слухи, что на вилан-ифейсах шейперы косячат. Попробовать прибиться к реальному ифейсу, что ли...

billy
() автор топика
Ответ на: комментарий от billy

Косяк нашелся.

-j MARK совершенно не означает выхода из цепочки, поэтому пакеты сперва маркировались 20-24, а ПОТОМ 26. Я - дебил. Удаляем последнюю строчку, всё молотит как часики.

billy
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.