Kiev1.org Карта сайта Файлы Фотографии Киева
  
Реклама:






???????
 
 Sysadmin
 ??????????????
 ????? ? ?????
 ??????????
 ???????????? ???????
 ?????????????
 ? ???????
 ? ???????????
 ???????? ? ??????
 ???????????
 ??????????? ???????
 ???????? ????? ?????? ?????? ???????? ??????????
 ??????
 ??????
 ?????? ?????? 1924-1994
 ??????? ?? ??????
 ???? ? ???????
 ????? ??????????
 ?????????


Внимание! Читая пророчества на этом сайте помните что достоверность трудно проверить и все может во времени изменяться - самое главное думать своей головой и не верить легкомысленно всему что говорят, особенно советское телевидение
"О дне же том, или часе, никто не знает, ни Ангелы небесные, ни Сын, но только Отец (Мк. 13, 32)"

?????????? ???????? ? Linux



?????? ???????? ??????? ?? ?????????? ???????????? ??????????, ??????? Linux Advanced Routing and Traffic Control HOWTO. ?????? ?? ????????? ????????? ? ????? ?????????.
??????? ? Linux ? ?????????? ????????.
?????: © ???? ?????


????????.

?????????? ???????? ??????? ?? ?????? ?????????? ? ???????? ? ??????? ??????? ?????? ???????????????? ? ??????? ??? ??????/???????? ????? ??????? ?????????. ???? ??????? ????????? -- ??????? ???????????, ?????????? ? ???????? ??????? ????????????? ??????? ?????????? ???????? ? ???????????? ??????? Linux.

???????? ???????????? ??? ??????? ??????????????? ? ?????? ?????????????, ??????? ?????? ???????? ????????????? ?? ?????????? ???????? ? ????? ? ????????, ????????? ??? ???? ???? ? ?? Linux.

?????????? ???????? -- ??? ??????, ???????????? ??????? ????????? ???????? ? ??????? ??????/???????? ??????? ? ??????????????. ??? ???????? ? ???? ????????? ???????? ???????, ????? ?????? ????????? ? ? ????? ????????? ?? ???????? ??????????, ??????????? ??????? ??? ????????, ?? ??????? ? ???????? ???????? ?? ????????? ??????????.

?????? "???????? ????????????" (Quality of Service, QoS) ????? ???????????? ??? ??????? ?????????? ????????.

?????? ???????? ??????? ?? ?????????? ???????????? ??????????, ??????? Linux Advanced Routing and Traffic Control HOWTO. ?????? ?? ????????? ????????? ? ????? ?????????.

????????????

??????? ???????? ?????? ????? ?????????? ???????? ? ???????? ???????????? ?????? ??????? ????????????. ? ????? ??? ???????? ???????? ?????, ??? ?????? (??? ?????? ??????? ??????) ??????? ???????? ???????????. ? ?????????? ?????? ?????? ?????????? ?? ???????? "?????? ?????? -- ?????? ????". ????? ???????? (??????????) ????????? ??????? ? ??????? ?????????????? ?????????? ???????????? ??? FIFO.

? ????? ?????????? ????????? ??????? ??? ??????? ?????????? ??? ?????????? ????????. ???, ??? ??? ????? ?????? -- ??? ???????? ?????? ? ??????? ? ????????? ?? ??????.

??????? ??????????, ????? ???????? ????????? ??????? ???????? ? ???? ????????? ???????? ???????, ????????? ???????, ????? ? ????????????? ??????? ? ?????????? ????????. ? ???????? ????? ???????????? ??????????, ??????? ???????? ??????????? ??????? ????????????.

????? -- ??? ????????? ?????????? ??? ?????? ????? ????? ???????. ????? ?????????? ????? ??????? ???????????? ????? ????? ??????? ????? ??????????????? ??? ?????. ? ????????? TCP ??????? ?????????? ? ??????????, ???????? ???????? ? ??????? ???????????? ????? ?????. ?????????? ????? ???? ?????????? ??????? ?????? ??? ????????? UDP.

??????? ?????? ????? ?????, ????? ?????? ??????????? ??????? ?? ?????? ????? ????? ?????????????? ????????????, ???????? ???? ????????? ?????????? ??????????? ??????? ??????? ?????????? ??????????.

??? ??? ??????????????? ??????? ??????? ?????????? ???????? -- ??? ?????? ? ??????.

??? ????, ????? ?????????????? ???????? ?????? ???????? ?? ???????, ???????? ????????? ????? ??????? ????? ??????? ??? ???? ? ??????????? ???????. ?? ???? ????? ??????? ??????? ??????????. ?????? ?????, ?????????? ??????? ??????????????? ? ?????????? ???????? -- ??? ????????? ??????? ? ???????????? ?????????, ? ?????????? ???????? ?? ??????? ???????????? ?????? ? ?????? ??????? ???????.

???????????? ?????????? ??????? ???????? ???????? ??????, ? ??????? ?????????? ??????????????? ??????. ??? ????????? ? ?????? ??????, ????? ???? ???????????? ??? ???????? ????????? ????????? ???????.

???????????? ???????? ??????? ?????????? ????????

??????????? ?????????? ??????? (shaping) -- ??? ????????, ? ??????? ???????? ?????? ????????????? ????? ????????? ? ???, ????? ???????? ???????? ??????????????? ????????. ??? ???? ?? ????? ????? ???????????? ?????????? ?????????? ????????. ??? ???????? ??????, ?????? ???????? ????????? ?????????? ?????????????? ??????.

???????????? (scheduling) -- ??? ????????, ??????? ????????? ????????????? ??? ????????????????? ??????? ????? ?????? ? ??????? ?????????? ???????. ????????? ???????????? ????? ????????? ????????? FIFO, SQF, WRR ? ??????.

????????????? (classifying) -- ????????, ??????????? ?????? ??? ????????? ?????????, ???????? ? ?????? ???????. ? ???????? ??????, ????????????? ? ???????? ???????, ??????? ?????????? ????? ??-??????? ?? ????????????????. ??? ????? ???? ????????????, ??????? ?????? ?????????? ?? ??????? ???? ? ?????? ??????????????????, ??? ?? ????? ??????????? ????????????? ?? ?????? ????????????? ????.

??????????? ????????? ??????? (policing) -- ????????? ??????? ??????? ???????? ????????????, ?????????????? ??????. ???? ???????? ????????? ?????? ?? ???????????? ????????, ? ??? ?????? ??????? ??????????? ???????? ????? ??????????? ???????????? ????????. ????????, ????? ?????????? ??????, ??? ???????????????????? ???. ?? ?????? ?? ??, ??? ? ?????? ?????? ???? ???????????? ????????? ?????? ???????, ?? ?? ???????????? ??????????? ???????? ??????? ? ??????? ?? ????????? ??????????? ?????????? ???????

??????????? (dropping) -- ????????, ???????????? ??????. ????????, ?? ???????????? ??? ???????????? ?????? ?????? ???????????? ?????????? ???????.

???????????? (marking) -- ???????? ????????? ??????. ???????? ????????, ??? ??? ?? fwmark. ???? MARK ? --mark ?????? iptables ? ipchains ??????????????, ???????????? ?????????? ??????, ? ?? ??? ?????.

?????????? ??????? ?????????? ???????? Linux

??????? ???????????? ????? ????????????? ??????????? ?????????? ???????? ? ?? ??????????? ? ?? Linux

???????????? ??????? ????????? Linux
??????????? ?????????? ??????? (shaping) ????? (class) ???????? ????????????? ?? ??????????? ?????????? ???????.
???????????? (scheduling) ???????? ????????? ??????? (qdisc) ????????? ????????????. ???????????? ????? ???? ???????, ???????? FIFO, ? ???????, ? ???????? ? ??????? ?????????? ????????? ???????, ???????? HTB.
????????????? (classifying) ?????? (filter) ????????? ????????????? ? ??????? ??????????????? (classifier). ?????? ??????, ?????????????? Linux ?? ????? ???????????? ??? ???????.
??????????? ????????? ??????? (policing) ???????????? ? Linux-?????????? ???????? ??????? ?????????? ?????? ??? ????????? ????? ???????.
??????????? (dropping) ??? ??????????? ??????? ????????? ?????? ? ?????????????, ??????? ?????????? ???????? "drop".
???????????? (marking) ??? ???????????? ???????????? ???????? ????????? ??????? dsmark.

???????? (??????????) ????????? ??????? -- ??? ???????? ????????????. ??????? ?????????? ?????????? ????????? ??? ??? ???? ???????? ????????????. ? Linux ?? ????????? ???????????? pfifo_fast, ????? ???????, ??? ???????????? ???????? FIFO. ?????? ????????? ?????????? ????????? ??????? ????????????????? ??????, ??????????? ? ??????? ? ???????????? ? ????????? ?????????.

????????? ????????? ??????? -- ??? ???????? ?????, ?? ??????? ???????? ?????????? ???????? ? Linux.

????????? ?????????? ????????? ??????? ????? ????????? ?????? ? ?????????? ???????????, ? ??????? ???????????? ???????. ????? ???????????? ????????? ??????????, ?? ??????? ???????, ?????? ??? ????? ??????????? ?????????????? ????????? ????????.

???????????? ?????????? ????????? ??????? ?? ????? ????????? ?????? ? ? ??? ?????? ?????????? ???????. ?????????????, ??? ????????????? ???????????? ????????? ????????????? ?? ????? ??????.

?????????? ???????? ???????? ????????????? ???????? "???????? ??????????" (root qdisc) ? "???????? ??????????" (ingress qdisc). ?? ????? ???? ??? ?? ?????????? ????????? ???????, ? ?????, ? ??????? ???????????? ??????????? ?????????? ???????? ??? ?????????? ????????? (egress) ? ???????? (ingress) ????????.

?????? ????????? ????? ??? ??? ?????. ???????? ? ???????? ???????????? ?????? ???????? egress, ??? ?????????? ???????, ??????? ????? ? ?????????? "???????? ??????????? ????????? ???????" (root qdisc). ??? ????? ????????? ????? ????????? ?????????? ????????? ??????? (qdisc). ? ??????????? ??????????? ???????????? ???????????? ?????? "???????? ??????????" ? ?? ???????. ???? ????????? ?????? ?????????? ???????? ????? ???????? ??????????.

???????? ??????, ? ???? ???????, ???????? ????? ???????? ?????????? (ingress qdisc). ??-?? ???????????? ????????????, ? ??? ?????? ????????? ??????, ????? ???? ?????????? ? ??? ??????. ?? ????????, ???????? ?????????? ???????????? ????? ??????, ? ???????? ???????????? ???????????? ??? ????????????? ???????? ????????? ??????? ?? ??????????.

?????? ?????????? ?????? ?????? ????????? ????????? ????????? ???????. ?????? -- ??? ????? ?????? ?????????, ??????? ?????? ????? ????????? ???? ????????? ??????????, ???? ?????????? ????????? ???????. ????? ????? ???? ????????? ????????? ?????????? ????????? ???????, ??? ????????? ????????? ????? ??????? ??????? ?? ?????????? ????????.

? ??????? ?????? ????? ???? ?????????? ???????????? ?????????? ????????, ??????? ????????? ???????????? ?? ??????????, ???????????????????? ? ?????????? ??????, ?????????? ????? ?????? ?????.

??????? ????? (leaf class) -- ??? ??????????? ????? ?????????? ????????? ???????. ??????? ????? ?? ????? ????????? ?????????, ?????? ?????????? ????????? ??????? (?? ????????? pfifo_fast). ????? ?????, ?????????? ?????????, ?????????? ?????????? (??? ????????, ???? ??? ????????????? ??????).

??????? (filters) ???????????? ???????? ??????? ?????????? ??????? ?????????? ???????? ? Linux. ??? ???????????? ??????? ???????? ?????????? ?????????? ????????? ?????????? ???????? ? ?????? ?????. ? ?????????? ?????? ?????? ???????????? ??? ????????????? ???????. ??????? ???????????? ???? ? ????????? ??????????? ????????? ????????, ???? ? ???????, ?????? ? ????? ?????? ?????, ?????????? ????? ?????????, ?????? ???????? ???????? ?????????? ? ???? ????? ????? ????? ???? ??????????????? ? ????????? ? ????????.

?????????????? (classifiers) -- ??? ???????????, ???????????? ????????? ??? ????????????? ????????????? ?????? ??? ?????????? ??????. ? Linux ?????????? ?????? ????????? ?????????????, ?? ???????? ???????????? ??????????????? ???????? u32. ?? ????????? ???????????????? ?????? ?? ????????? ?? ?????????.

???????????? (policer) ???????????? ? ??????? ?????????? ???????? Linux ??? ????? ???????. ???????????? ????????? ???? ?? ???? ???????? ???????? ? ??????????? ?? ???????? ???????, ????????? ??? ???????? ???????? ??? ???. ?? ?????? ?? ??, ??? ? ?????, ? ???????????? ???????? ??????????, ??????????????? ?????? ???????????, ???????????? ??????? ?? ??????????? ??????, ?? ???? ????????? ???????? ????????.

???????? ??????????? (drop) ??????? ????? ??????????? ? Linux-?????????? ??????? ?????????? ???????? ?????? ??? ????? ????????????. ????? ????????????, ???????????? ? ???????, ????? ????????? ???????????. ???????????? -- ??? ???????????? ????????? ??????? ?????????? ???????? Linux, ??? ???????? ?? ???? ?????? ?????? ??????????? ???????. ????????, ???????????? ????? ?????????? ???? ?????? ??????????????? ????????????? ???????.

??????, ? ?????? ??????? ?????? ???? ????? ????????????. ??? ????????????? ????????? ????????? ??????? GRED ??????????? ??????? ???????? ?????????? ?????????? ??????? ???????????. ????? ?????? ????? ???????????? ??? ???????????? ??????? ?????????????, ??? ????? ??????????? ? ??????? ?????????? ????????? ???????.

?????? ????? ? ????????? ?????????? ??????? ??????????? ?????????????? ? ???????????? ?????????? ????????. ???? ????????????? ?????????? ???????????? ? ??????? ?? ???? ?????, ???????? ? ???????? ??????. ??? ????? ???? ???????????? ?????, ???????? ????????????? ? ???????????? ?? ?????????? ?????????:

????????? ???????????? ??????? ? ????????? ????????? ????????

??????? ?????

??? ?????????? ???????????? ?????, ??????? ???????? ???????????? ? ???????????? ?? ????? ?????? ?????????. ??????, ??? ??????? ????????? ?????????? ???????? ? ??????? ???? ????? ???????? ?????? ????? ?????????? ??????? ????? ???????????.

??????? ?????

???? ??????? ????? ??????????? ????? ????, ?? ??? ?????????? ?????????????? ??????, ??? ?????????? ????????? ???????. ?????? ???????? ?????????? ??????. ? ???? ??????? ? ????? ????????? ?????? ???? ?????????? ??????? ??????

??????????? ?????????? ffff:0 ?????????????? ??? ???????? ??????????.

?????????? ???????????? ? ???????? ????????? ?????? classid ? flowid ????????.

???? ????????? ????? ??????????? ???????:

                                 ____      +---------------+
                            +->-| FW |---> | TCP, UDP, ... |
                            |   +----+     +---------------+
                            |                   |
                            ^                   v
                            |                  _|_
                            +----<----+       | FW |
                                      |       +----+
                                      ^         |
                                      |         Y
                                 ? IP-?????  ?? IP-?????
                                    ?????     ?????
                                      ^         |
                                      |_____    |
????????                                    ^   Y                          ?????????
??????????   ____    +----------+        +--|---|--+   ____   +----------+ ??????????
---->------>| FW |-->|??????????|-->---->| ??????- |->| FW |->|??????????|-->-->

            +----+   | ???????? |        |  ????   |  +----+  |????????? |
                     | ???????? |        +---------+          | ???????? |
                     +----------+                             +----------+
FW -- ??????????.

? ?????? ????? ????? ?????????? ????????? ????????:

          ++    ++                 +-----+   +------------+   ++     ++ .++
          || .  ||     +------+    |     |-->| ?????????? |-->||     ||  ||
          ||    ||---->|??????|--->|?????|   +------------+   ||-+   ||  ||
          ||    ||  |  +------+    |     +--------------------+| |   ||  ||
          || .  ||  |              +---------------------------+ |   || .||
          || .  ||  |  +------+                                  |   ||  ||
          ||    ||  +->|??????|-_  +-----+   +------------+   ++ |   || .||
          || -->||  |  +------+  ->|     |-->| ?????????? |-->|| |   ||->||
          || .  ||  |              |?????|   +------------+   ||-+-->|| .||
       -->||    ||  |  +------+ _->|     +--------------------+|     ||  ||
          ||    ||  +->|??????|-   +---------------------------+     || .||
          ||    ||     +------+                                      || .||
          || .  |+---------------------------------------------------+|  ||
          ||    |       ?????????? ?????????? ????????? ???????       | .||
          || .  +-----------------------------------------------------+ .||
          || . . .. . . .. . .                 . .. .. .. .           .. ||
          |+-------------------------------------------------------------+|
          |               ???????? ?????????? ????????? ???????           |
          |               (?????????? ? ?????????? ??????????)            |
          +---------------------------------------------------------------+

??????? ??????? ?????????? ???????? ? ?? Linux

? ?????? ???????????? ??????? Linux ?????? ????? iproute2. ?? ???????? ??????? ??? ?????? ?? ??????????? ????, ???????????? ? ???????????? ??????? ?????????. ??? ????? ???????????? ????? ???? ??????? ?? ????? ?????? -- tc. ??? ????????????? ??? ?????? ? ???????? ?????????? ???????.

????????? ?????? ??????? ???????? ???????? ? ?????, ??? ????????, ???????? ? ????????? ??????????? ?????????? ???????? ??? ?????? ????????? ????????? ???? ????????? ????????? ????????, ? ???????? ?? ?????? ????????. ? ?????????, ?? ?????? ??????????? ????????????? ????? iproute2 ?? ????? ????????? ????????? HTB, ?????? ???? ?? ?????? ? ??? ????????, ???, ????????, ???????? ???????? ???? ? ??????????? ????? iproute2.

??????? tc ????????? ??? ??????????? ???????? ??? ?????? ? ???????? ?????????? ???????. ??? ????????? ?????, ????????? ? ?????? ??????? ?????????? ???????, ?? ?????? ??????????????. ? ???????? ??????? ????????? (?? ?????) ??????? ??????? ???? ?? ???? ????????? ??????? ?????????? ????????: ?????????? (qdisc), ????? (class) ??? ?????? (filter).

????????? ??????? tc:

[root@eagle]# tc
Usage: tc [ OPTIONS ] OBJECT { COMMAND | help }
where  OBJECT := { qdisc | class | filter }
       OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] }
     

??? ??????? ???? ??????? ?????????? ???? ????? ?????, ??????? ???????? ?? ?????????? ? ???? ?????????.

??????? tc qdisc

[root@eagle]# tc qdisc add    (1)
>               dev eth0      (2)
>               root          (3)

>               handle 1:0    (4)
>               htb            (5)
     
(1)
????????? ?????????? ????????? ???????. ??? ???????? ???????????? del ?????? add.
(2)
????????? ??????????, ? ???????? ?? ?????????? ?????????? ????????? ???????.
(3)
?????????, ??? ??? ???????? ?????????? (?.?. ?????????). ? ????? ?? ?????????? ????? ?????????? ? ???????? ?????????? (ingress qdisc).
(4)
?????? ?????????? ? ????? ??????? ?????:??????? ?????. ??????? ????? ??? ????? ?????????? ????????? ??????? ?????? ????????? ????. ??????????? ?????????? ??????????? ?????????? ? ???? "1:". ????? ???????????????, ??? ??????? ????? ????? ????.
(5)
????????? ??? ?????????? ????????? ???????, ??????? ?? ????? ??????????. ????? ????? ??????????? ?????????, ????????????? ??? ?????? ??????????. ? ???? ???????, ?? ?? ?????? ??????? ?????????? ??????????.

????, ?? ??????????? ?????????? ?????? ????????????? ??????? tc ??? ?????????? ?????????? ????????? ??????? ??????????. ?????? ??????? ?????????, ??? ????????? ?????? ? ???????????? ???????.

??????? tc class:

[root@eagle]# tc class add    (1)
>               dev eth0      (2)
>               parent 1:1    (3)
>               classid 1:6   (4)

>               htb           (5)
>               rate 256kbit  (6)
>               ceil 512kbit   (7)
     
(1)
??????? ?????. ??????? ??? ????? ? ??????? ??????? del.
(2)
????????? ??????????, ? ???????? ?? ?????????? ????? ?????.
(3)
????????? ?????????? ????????, ? ???????? ?? ?????????? ?????? ?????.
(4)
?????? ?????????? ?????????? ??? ??????? ??????. ??????? ????? ?????? ???? ???????? ?? ????.
(5)
????????? ?????????? ????????? ???????? ???????, ????? ??? ????????? ???? ?????? ???? ? ??????????. ?????? ? ?????????? ????????? ??????? HTB ?????? ????? ???? HTB.
(6)(7)
????????????? ????????? ??????.

??????? tc filter

[root@eagle]# tc filter add               (1)
>               dev eth0                  (2)
>               parent 1:0                (3)
>               protocol ip               (4)

>               prio 5                    (5)
>               u32                       (6)
>               match ip port 22 0xffff   (7)
>               match ip tos 0x10 0xff    (8)

>               flowid 1:6                (9)
>               police                    (10)
>               rate 32000bps             (11)
>               burst 10240               (12)

>               mpu 0                     (13)
>               action drop/continue       (14)
     
(1)
????????? ??????. ??????? ??? ????? ???????? del.
(2)
????????? ??????????, ? ???????? ?? ?????????? ??????.
(3)
????????? ?????????? ????????, ? ???????? ?? ?????????? ??????.
(4)
?????? ????????, ? ??????? ????? ???????? ??????.
(5)
???????? prio ????????? ????????? ??????????????????? ???? ???????? ??????? ?????????. ???????? pref ???????? ?????????.
(6)
?????? ?????????????, ? ?????? ?????? ??? u32.
(7)(8)
????????? ??????????????. ????? ?????????? ?????? ??????????????? 22-?? ????? ? ?? ????????? 0x10 ? ???? TOS (?????????? ????????????? ??????).
(9)
???? flowid ?????? ?????????? ??????, ???? ???????????? ?????? ??????????????? ????????? ???????.
(10)
?????????? ? ??????? ????????????.
(11)
?????? ????????? ???????? ??? ???????? ???????: ?? ???? ???????? ???????????? ????? ????????? ???? ????????, ????? -- ??????.
(12)
?????? ?????? ???????.
(13)
??????????? ?????? ??????????????? ???????. ??? ????? ????? ??????? mpu ?????? ????????? ????.
(14)
???? action ?????? ???????? ??????????? ?????????????. ?????? ???????? ????? ??????????? ??? ?????????? ????????? ????????, ?????? -- ?? ??????????.

??? ???????? ????, ??????? tc ????? ??????? ?????????, ???? ??? ???????? ??????? ????????. ??????, ?????????? ???????, ??????????? ????????? ????????? ??????? ??????. ????????: CBQ.init, HTB.init, tcng

???????????? ?????????? ????????? ????????

??? ?????????? ????? ???? ????? ?????????????? ? ??? ???????? ?????????? ??? ????? ??????????, ??? ? ?????? ???????? ?????? ????????? ?????????? ????????? ???????. ??? ???????? ????????????, ???????????? ? Linux. ?? ????????? ???????????? ?????????? pfifo_fast.

pfifo ? bfifo

???????? FIFO ???????? ?????????? ?????????? pfifo_fast, ???????????? ?? ????????? ?? ???? ??????????? Linux. ?? ?? ????????? ??????????? ????????? ??????? ? ?????????????????? ???????. ?? ?????? ???????????? ?? ???????? "?????? ??????, ?????? ????".

??????, ??? ??????? ???? FIFO ????? ???????? ?????? ?????? ??? ?????????????? ????????????, ???? ?????? ????????? ? ??????? ???????, ??? ????????? ?? ???. ? ?? Linux ??????????? ??? ???????? ?????????? FIFO -- ???? ???????? ?? ??????, ?????? -- ?? ???????. ??? ??????????? ?? ????, ????? ??????? ????????????, ??? ??????? ??????? ?????? ??????????? ???????? limit. ??? ?????????? pfifo ??? ???????? ???????? ?????, ? ??? bfifo -- ????.

???????? ??????? ?????? ??? ???????? pfifo ? bfifo

bfifo:
[root@eagle]# tc qdisc add dev eth0 handle 1:0 root dsmark indices 1 default_index 0
[root@eagle]# tc qdisc add dev eth0 handle 2:0 parent 1:0 bfifo limit 10240
pfifo:
[root@eagle]# tc qdisc add dev eth0 handle 1:0 root dsmark indices 1 default_index 0
[root@eagle]# tc qdisc add dev eth0 handle 2:0 parent 1:0 pfifo limit 30

pfifo_fast, ?????????? ????????? ??????? ???????????? ?? ?????????

?????? ?????????? ????????? ??????? ???????? ???????? ??? ???? ??????????? Linux. ??? ???????? ?? ??????? ????????? FIFO, ?? ???????? ?????????? ????????? ?????????????. pfifo_fast ???????? ??? ?????? (bands) ??? ?????????? ???????. ?????? ????? ???????????? ????? ??????? ??????? FIFO. ?????????????????? ?????? ?????????? ? ??????? ????? ? ?????? ?????????????? ? ?????? ???????. ??????????, ??????, ?????????? ? ?????? ?????, ?????????????? ????? ?????? ???????.

?? ??????? ??? ??????? ???????????? ?????????? ? ????????? PRIO. ?? ?????? ?? ??, ??? ??? ?????????? ??????????? ???????, pfifo_fast ???????? ???????????? ? ?? ????? ????????? ????????? ? ?????? ?????????? ????????? ????????.

?? ?? ?????? ???????? ????????? ???? ??????????, ????????? ??? "??????" ? ????.

SFQ, Stochastic Fair Queuing

?????????? ????????? ??????? SFQ ???????? ???????????? ??????? ??????????? ?????????? ?????? ????? ???????????? ??????????? ???????. ??? ??????????? ?????????????? ???-??????? ??? ?????????? ??????? ?? ????????? ??????? ???? FIFO, ??????? ????? ?????????? ??????????????. ????????? ?????????? ??????????? ?????????? ???????? ???-???????, ??? ???????????? ??????????. ???????? perturb ?????? ???????? ? ????????, ????? ??????? ?????????? ????????? ???????. ???? ???????? ?? ?????, ??????? ?????????? ?? ?????, ??? ?????? ?? ?????????????. ???????? 10 ???????? ? ??????????? ???????.

?????????? ?????? ?????????????? ?? ?????? ?????? ?? ???? ????? ???????? ?????????? quantum. ?? ????????? ????? ?????? ????????????? ??????? ????????. ?? ?????????????? ?????? ?????? ????? ????????.

?????? ????????????? SFQ

[root@eagle]# tc qdisc add dev ppp0 root sfq perturb 10
[root@eagle]# tc -s -d qdisc ls
qdisc sfq 800c: dev ppp0 quantum 1514b limit 128p flows 128/1024 perturb 10sec 
 Sent 4812 bytes 62 pkts (dropped 0, overlimits 0)

????? 800c: -- ??? ????????????? ??????????? ??????????, limit ????????, ??? ? ?????? ??????? ????? ??????? ????????? 128 ???????. ????? ???????? 1024 "?????????????" (?? ??????? ??????????? ??????), ?? ??????? 128 ????? ???? ??????? ???????????? (?????? ??????? ?? ?????????? ? ???????!). ???? ??? ? ?????? ?????? ?????????? ???.

ESFQ, Extended Stochastic Fair Queuing

?????????????, ??? ?????????? ????????? ??????? ????? ?? ?????????? ?? SFQ, ?? ???? ?????? ???????????? ?? ????????? ???????. ???? ??????????? ????????? ???????????? ?????????? ????, ???????????? ????? ??????? ????? ???????????? ????????????? ?????? ???????????. ????????? ?????? ??????????, ????? ??????? ?????? ????????? depth (??????????? ????????? ?????????? "??????-????????", ? SFQ ?????? ?????? ???????? 1024), limit (?????????? ??????? ?????????? ? ??????, ? SFQ ????????? 128), hash (??? ????: classic -- ??????????? ????????????? ? SFQ, src -- ?? ?????? ????????? ? dst -- ?? ?????? ??????????) ? divisor (????? ???? ? ?????, ? SFQ ????? 10).

??????? ?????????? SFQ ?????????? ?????????????, ???? ???????????? ???????? ? ???????????, ??????????????? ????????? ???????. ? ???? ?????? SFQ ?? ???????? ??????? ????????? ????? ????? ??????????????. ?????? ?????? ? ?????????????? ?????????? ?????????, ?????????????? ??????????? ????????? ??????? ESFQ ????????? ?????? ????????? ???????? ?????????????? ??????? ????, ????????, ?? ????????? ??????.

?????? ????????????? ESFQ

[root@eagle]# tc qdisc add dev eth0 root esfq limit 128 depth 128 divisor 10 hash classic perturb 15
[root@eagle]# tc qdisc add dev eth0 root esfq limit 64 depth 64 divisor 11 hash dst

???????? ?????? ??????????, ??????? ???????, ??? ???????? ????????? limit ?????? ???? ?????? ??? ????? ????????? depth, ? ???????? ????????? divisor -- ?????? 15.

Random Early Detection (RED)

?????????? RED ????????????? ???????? ?????????????? ?????????? ?? ???? ??????????? ????????? ??????? ?? ???????????? ???????. ??????????? ?????? ??? ?????????? ????????????? ??????, ????? ??? TCP, ??????? ???????????? ????? ??????? ? ??????????????? ??????? ??? ???????????? -- ????????? ?????? ????, ????????? ? ????? ?????????? ??????, ????????? ?? ????????? ????? ????????, ????? ???? ???????? ???????? ???????? ??????. ?????????? RED ???????????? ?????? ??????? ? ??? ?? ?????????? ???????? ????????? ??????? ????????? TCP-?????? ? ???????? ?????????? ??????, ? ????? ????????? ???????? ????????.

????????????? ????????? RED ????????????? ?? ???????????????? ???????????, ??? ?????? ??????????? ?????????? ??????? ???????, ??? ??????? ?????? ????????, ?????? ???????????? ????????? ?????????? ??????.

??????? ????????? ???????? ??????????????? ? Internet ?????????? "?????????? ???????" (tail-drop). ??? ???? ?????? ?? ??????-?? ?????? ?????????? ? ???????, ????? ???? ??? ????????? ?????? ???????? ????????????. ????? ????????? ?? ???????? ?????? ????????? ? ????? ? ????????? ????????? ? ????????? ????????????? ??????????. ?????? ????? ?????????? ???????????? ?????????? ????????? ???? ????? ?????? ???????? ??????? ?????????????? ? ?????????? ??????????.

?? ????????? ????? ???????? ?? ????????????? ??????????????? ????? ?????? ???????? ???????. ??? ????????????? ???????? ??????????? ??????? ? ???????????? ??????? ?????????? ???????????, ?? ??? ???? ????? ?????? ????????????? ????????.

???????? ? ?????????? "????????? ???????" ? Internet ?????????? ??? ????? ?????????? ??-?? ?????????? ?????????? ?????????? ?????????? ???????????? ????. Linux ????????????? ? ??????????? ?????????? ????????? ??????? RED, ?????????? ?? Random Early Detect.

RED ?? ???????????? ????? ??????? ???? ???????; ??????????, ??????? ?? ????????? ?????????? ????????? ?????????? ????? ???????? ??????? ????? ?????? ???????????, ?? ??? ?? ????? ???????????? ?????? ?? ?????? ??????????? ? ???????? ?????? ???????.

RED ????????????? ?????????? ?????? ?? ??????? ?? ????, ??? ???????? ?????? ????????? ??????? ???????. ??? ????????? ????? ???????? ???????? ???????? ?? ????????????? ?????? ? ???????? ????????? ??????????. ????? ????, ??? ????????????? ????? ?????????? ???????? TCP ????? "?????" ??????????? ????????, ??? ??????? ?????? ??? ?? ????????????, ? ???????? ????????? ? ???????? ????????. ??????????? ??????????? ?????? ?? ????????????? ?????????? ??????????????? ????????????? ?????? ???????????, ? ?? ?????????? ???????????? ???????

?????????? RED ?????? ??????????? ?? ????????????????? ????????????? ???????, ??? ?? ?????????? ? ?????? ???????? ?????? ????????? ???????????? ?????? ??????????, ??????????? ??? ???????? ???? SFQ.

??? ????????????? ?????????? ????????? ??????? RED ??? ????? ????? ?????????? ??? ?????????: min, max ? burst. ???????? min ?????? ??????????? ????? ??????? ? ??????, ??? ??????? ?????????? ??????????? ???????, max -- ??? ?????? ???????, ? ???????? ??????? ???????? ????? ???????? ??????????. ??????? burst ?????? ???????????? ????? ???????, ??????? ????? "??????????".

??? ??????????? ????????? min ????? ????????? ????? ??????????: ????? ??????????? ?????????? ???????? ? ???????? ?? ?? ?????? ???????????. ????????, ???? ??? 64 ??????????? (8 ????????) ?????? ?? ????? ??????? ???????? ? 200?? (0.2 ?), ???????? min ????????? ?????? 1600 ?????? ( 8192 * 0.2 = 1638,4 ~ 1600 ). ????????? ???????? ????????? min ????????? ?????????? ???????????, ??????? -- ??????????? ????????. ??????? ?????????? ???????? min ?? ???? ?????, ??? ?????????? ???????? MTU ?? ????????? ??????? ??? ?????????? ???????????????.

???????? max ?????? ???? ??? ??????? ? ??? ???? ?????? ????????? min ??? ????????? ????????? ??????????. ?? ????????? ??????? ? ????????? ????????? min ????? ????? ????? ????????????? ???????? max ? ??????, ???? ??? ??????.

???????? burst ???????????? ??????? ????????? RED ?? ?????? ?????????? ???????. ???????? ??????? ????????? ?????? ???? ?????? ????????? min/avpkt. ???? ???????????? ???????????? ??????? (min+min+max)/(3*avpkt).

????????????? ????? ??????? ????????? limit ? avpkt. ???????? limit ?????? ????? ???????, ????????? RED ? ???????? "????????? ???????". ?????? ???????? -- avpkt ?????????? ??????????? ?????? ??????. ??? ethernet-??????????? ????? ??????? ??? ?????? 1000 ???? ??? MTU ?????? 1500 ??????.

TBF, Token Bucket Filter

?????? ?????????? ????????? ??????? ???????????? ?? ???????. ??? ?????? ???????????? ???????? ?????????? ?????? ?? ?????????? ? ???????????? ????? ???????? ??????? ? ???????, ????? ????? ?????????? ???????? ????????.

?????? ?????????? ?????? ? ?????? ??????? ???????????? ?????????? ???????. ??? ?????????? ???????, ?????? ???????? ?????????? ? ?????, ? ????? ??? ?????????? -- ????????????.

??????? ?????????? ????????? ???????????????? ????????? ?????????? TBF:

limit ??? latency

??? ????????? ????????? ????????? ?????????? ????????? ????? ??????? ???????, ????????? ??????. ???????? limit ?????? ?????? ?????? ? ??????, latency -- ???????????? ????? ?????????? ?????? ? ?????? TBF.

burst/buffer/maxburst

?????? ?????? ???????, ? ??????. ?????? ???????????? ?????????? ???? ??????, ??? ??????? ???????? ?????? ? ???? ?????? ???????. ? ?????, ??? ???? ???????? ???????????, ??? ?????? ?????? ???? ????? ???????. ????????, ??? ??????? ??????????? 10 ??????? ?? ????????? x86, ??? ????? ????? ???? ?? 10-?? ??????????? ????? ??????? ??? ??????????? ????? ????????!

???? ?? ??????????????? ??????? ????????? ?????, ?????? ???????? ??????, ??? ??? ?????????? ???????????? ??????? ?? ??? ????? ??????, ??? ?????????? ? ?????? ???????.

mpu

????? ??? ???????? ?????? ("??????? ?????") ??? ????? ???????? ????? ?????? ???????????. ? ?????????? ethernet ??????????? ?????? ?????? ????? 64 ??????. ???????? mpu (Minimum Packet Unit) ?????????? ??????????? ?????????? ??????? ??????????? ??? ???????? ??????.

rate

???? ???????? ?????? ??????????? ?????? ???????????

?????? ????????????? TBF

[root@eagle]# tc qdisc add dev eth0 root tbf rate 180kbit latency 20ms buffer 1540
[root@eagle]# tc -s qdisc ls
qdisc tbf 8004: dev eth0 rate 180Kbit burst 1539b lat 24.4ms
Sent 80949 bytes 107 pkts (dropped 42, overlimits 112)

???? ?????? ????? ???????. ???? ? ??? ???? ??????? ?????????? ? ??????? ????????, ???????? DSL ??? ????????? ????? ? ???????????????? ??????????? ???? ethernet, ?? ?????????? ??? ???????? ????? ???? ???????? ?????? ?????? ?????????? ?????????? ??????????? ?????? ? ?????????????? ???????? ????????????, ???????? ssh.

??? ?????????? ??-?? ?????????? ???? ??????? ?????? ??? ????????, ? ???, ?????? ?????, ????? ???????, ??? ??? ??? ???????????? ??????? ?????????????????? ??????. ?? ??? ?? ????????, ??? ?????? ?????? ????????? ????????? ??????, ????? ?????? ???????. ??? ? ?????? ?????????? ?????? ????????????? ??????????.

????? ??????????????? ??????, ?? ???????????? ???????? ???????? ?????? ? ?? ????????? ??????????? ??????? ??????.

????????? ?????????? ????????? ???????

????????? ?????????? ????????? ??????? ???????????? Linux ??????? ???????? ? ?????????? ????????. ??? ????????? ?????????? ??????? ???????????????? ?????? ? ???????????? ??? ? ???????????? ?????????.

??? ??????????? ???????, ???????????? ? ???????? ?????????? ? ????????? ??????? ???????????? ??????????? ???????. ???????? ??????? ???????? ?????, ???????????? ? ???????? ??????????. ????????? ???????? ??????? ?????????? ??????????? ????????. ???????? ?????? ?????????? ???????? ? ?? ???????? ??????????? ????????.

HTB, Hierarchical Token Bucket

?????????? HTB ?????????? ???? ???????. ????????? ???????????, ????????? ?????????? ????? ?????? ???????????, HTB ????????? ?????????????? ??????? ? ?????? ?????????? ????????. ???? ?? ???????? ??????? ?????????? ?????? ?????????? -- ??? ??????? ??????????? ????????.

???? ??????? ??????????? ?????? ??????????? ??????????? ? ??????? ???????. ?????????? ?????? ????????????? ??? ?????????? ????????? ????? ?????????? ???????????.

?????? ???????????? ?????????? HTB ???????? ???????? ????? ?????? ???????????. ????????? ???????? ???????? ????? ?????? ??????????? ? ????? ???????????? ???????, ?????? ????? ?????? ????????? ????????, ???????? ?????????? rate. ????????? ????? ???????? ?????? ???????????, ?????? ???? ????? ????? ?????? ??????????? ????????. ???????????? ???????? ?????? ???????????, ?? ???????? ????? ???????? ?????, ???????????? ?????????? ceil, ?? ?????????? ???????? ?????? ???????? ?????????? ? ?????, ?????? ??????. ?????????? HTB ????????? ????????? ?????? ???? ?????, ????????? ??????? ??? ????????? ????????? ????????? rate ????????? ???? ? ???????

????????? ??????? HTB ? ??????????????? ????????? ??????????

??? ?????? ????????? ?????? ?????????? ????????? HTB ?????????
??????? < rate HTB_CAN_SEND ??????? ????? ????? ?????????? ??????, ???? ???? ????????? ??????
??????? > rate, < ceil HTB_MAY_BORROW ??????? ????? ?????????? ?????? ?????? ??? ???????? ?????? ? ????????????? ??????.
??????? > ceil HTB_CANT_SEND ?????? ?? ????? ???????????? ?? ??? ???, ???? ?? ????? ???????????? ?????????? ???????.
??????????, ???????? < rate HTB_CAN_SEND ?????????? ????? ????? ?????????? ?????? ????? ??????????.
??????????, ???????? > rate, < ceil HTB_MAY_BORROW ?????????? ????? ?????????? ?????? ?????? ? ????????????? ?????? ? ???????? ?? ????? ??????????.
??????????, ???????? > ceil HTB_CANT_SEND ?????????? ????? ?? ????? ???????? ?????? ?????? ? ????????????? ?????? ? ?? ????? ?????????? ?????? ????? ??????????.

??????? ?????? ?????????? ????????? ?????????? HTB

default

?????????????? ???????? ???????????? HTB default ?????? ?????????? ?????????, ???? ???????????? ???? ???????????????????? ??????. ?? ????????? ????? ????, ?????????????, ???????????????????? ?????? ?????? ??? ?????? ? ?????????????? ? ???????????? ?????????.

rate

????????, ???????????? ??????????? ???????? ????????. ????? ????????????? ??? ??????????????? ?????? ??????????? ??? ??????? ???????? ??????.

ceil

?????? ??????????? ????????? ???????? ???????? ???????. ??? ??????? ????????? ?????? ??????????? ? ?????? ???????, ????? ??????????? ?? ???? ?? ??????? ????????

burst

?????????? ?????? ?????? ???????. ?????????? ???????????? ????? ????, ??? ??????? ????? ???? ???????? ?????? ? ???? ?????? ???????.

prio

?????? ?????????? ????????? ??????? ????????? ???????? ?????????? ???????. ??????? ???????? ????????? prio ?????? ??????? ?????????. ?????? ? ??????? ??????????? ?? ??????????????, ???? ???? ?????? ? ??????? ? ??????? ???????????.

????????? HTB ???????????? ???????? ?????? ? ??????? ???????, ????? ???????? ?????????? rate ??????? ??????? ?? ?????? ????????? ???????? ceil ????????????? ??????. ????? ?????, ????? ??? ????? ????? ????????? rate ????????????? ??????.

?????? ????????????? ?????????? HTB

[root@eagle]# tc qdisc add dev eth0 root handle 1: htb default 12
[root@eagle]# tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps
[root@eagle]# tc class add dev eth0 parent 1:1 classid 1:10 htb rate 30kbps ceil 100kbps
[root@eagle]# tc class add dev eth0 parent 1:1 classid 1:11 htb rate 10kbps ceil 100kbps
[root@eagle]# tc class add dev eth0 parent 1:1 classid 1:12 htb rate 60kbps ceil 100kbps [root@eagle]# tc qdisc add dev eth0 parent 1:10 handle 20: pfifo limit 5
[root@eagle]# tc qdisc add dev eth0 parent 1:11 handle 30: pfifo limit 5
[root@eagle]# tc qdisc add dev eth0 parent 1:12 handle 40: sfq perturb 10 [root@eagle]# tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32
match ip src 1.2.3.4 match ip dport 80 0xffff flowid 1:10
[root@eagle]# tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32
match ip src 1.2.3.4 flowid 1:11
[root@eagle root]# tc -s qdisc
qdisc sfq 40: dev eth0 quantum 1514b perturb 10sec
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
 qdisc pfifo 30: dev eth0 limit 5p
                 Sent 3910 bytes 32 pkts (dropped 0, overlimits 0)
 qdisc pfifo 20: dev eth0 limit 5p
                 Sent 56664 bytes 264 pkts (dropped 0, overlimits 0)
 qdisc htb 1: dev eth0 r2q 10 default 12 direct_packets_stat                  0
                 Sent 60574 bytes 296 pkts (dropped 0, overlimits 0)
              

CBQ, Class-Based Queue

?????????? ????????? ??????? CBQ ???????? ???????? ??????? ??????????? ?? ???? ????????? ? ?? Linux, ???????? ?????????, ???????? ???????? ?, ???????, ????? ??????? ? ?????????.

????? ????, ??? CBQ ???????? ????????? ???????????, ??? ????? ???????????? ?????????? ???????????. ?????? ?????????? ??? ????? ?????????? ??????. ????????, ???? ?? ?????? ?????????? 10 ?????????? ?????????? ?? 1 ????????, ????? ?????? ??????????? 90% ???????. ???? ??? ?? ???, ?? ????? ??????? ????? ?? ??? ???????? 90% ???????.

????????? ??? ?????? ?????? ??????????, ???????? CBQ ???????? ????? ??????? ?? ?????????? ??????????? ????????? ????? ????????? ?? ???????? ??????. ?? ????????? ???? ?????? ???????? ?????????????? ????????????? ??????.

?????? ????? ?????? ?? ?????? ???? ?????????? ??????????. ????????, ????????, ??? ????????? ?? ????? ?????????? ?????? ?? ???????????? ???????? ? 100 ??????? ??-?? ????? ????????????? ?????????. ? ??????? ????? PCMCIA ???? ??????? ?? ????????? ???????? ???????? 100 ??????? ??-?? ????????????? ???????.

??, ???-????, ? ??????????? ??????? CBQ ???????? ?????? ?????????????????.

????, ???? ?????? CBQ ??????????? ? ??????????? ??????????? ?????? ?? ?????, ??????????????? ????????? ??????????? ?????? ???????????. ??? ????? ?????????? ???????????? ????????? ?????????, ??????? ?????? ????????????? ????? ????????? ???????.

? ???????? ?????? ???????? ????? ??????? ?????? ??????????? ?????????? ??????????????? ??????????? ??????????? ???????? (exponential weighted moving average, EWMA), ??????? ????????, ??? ???????? ?????? ???????-??????????????? ??????? ???????? ??????. ???????? ??????? ???????? UNIX (loadave) ?????????????? ????? ?? ???????.

??????????? ??? ???????????? ????????? ??????????? ????? ??????? ?????????? ???????????? ????????? (EWMA) ??????? ???????, ?????????? ???????? ?????????? avgidle. ??? ??????? ???????? ??????? ????????? ??????????? ?????????? ????????????? ?????? -- ?????? ????????? ? ??????????, ????? ??????????????? ??????????. ?? ???????? ?????? ??????????? ??????? ?? ??????.

????????????? ????? ????? ????????????? ???????? avgidle ? ????? ??? ????????? ???????????? ?????, CBQ ????????????? ???????? ?? ?????? ?? ????????? ????? ? ?????????? ???????? overlimit.

????????, ????? ?????????? ????? ???????, ????? ????? ???????? ??????? ???????? avgidle, ??????? ???????? ?????????? ??????????? ?????? ???????????. ??? ????????? ????? ???????? ???????? avgidle ?????????? ????????? maxidle.

??? ??????????, ???????????? CBQ ?????? ???????????????? ???????? ?? ??????????? ????????? ????????, ????? ???????? ????????? ?????? ?????? ? ????? ????????????. ?? ? ??????????? ?????? ????????? ?????? ???? ??????, ???????? ???? ???????? ????????? minburst.

??????? ?????????? ????????? ?????????? CBQ, ??????????? ????????? ??????????? ?????? ???????????:

avpkt

??????????? ?????? ?????? ? ??????. ?????? ? ?????????? maxburst ???????????? ??? ?????????? ???????? maxidle.

bandwidth

?????????? ?????????? ??????????? ?????? ??????????; ?????????? ??? ?????????? ??????? ???????.

cell

?????, ??????????? ?? ???????? ?????? ????? ????????? ????? ?????????? ?????????????. ????????, ???????? 800- ? 806 ???????? ??????? ?????? ???? ? ???? ?????, ? 810-???????? ????? -- ??????? ??????. ?????? ???????? ?????? ?????? ????, ? ??????? ????????????? ????????? ????? ????????. ???? ????? ??????????????? ???????? '8'. ???????? ?????? ???? ????? ???????? 2.

maxburst

???????? ???????????? ??? ?????????? ???????? maxidle. ?? ?????? ?????????? ??????????? ???????, ??????? ????? ?????????? ?? ????, ??? ???????? avgidle ?????? ?????. ???????? maxidle ?????? ????? ??????, ?????? ????????, ? ??????? ????? ?????????.

minburst

??? ??? ??????????, ??? ?????????? CBQ ????????? ?????????? ??????. ????????? ???????? ???????? ???????? ? ??????? ???????????? ?????????? ???????, ???????? ?????? ? ????? ????????. ??????, ? ???? ?? Unix ?????????? ????????? ? ????????????? ???????, ?????? 10 ??, ?????? ????? ????????? ?????????? ????????, ????? ???????? ?????????? ?? ???? ?????, ? ??????????, ???????????? ?????????? minburst. ??????????????, ?????????? ???????? ????? ????????? ??????? ????????????? ??????????????? ???????? ??????? ?????????.

?????????? ??????? ????? ????????? ??????? ?????????? offtime. ??????? ???????? ????????? minburst ????????? ????? ????? ?????????? ?????? ??????????? ? ?????????? ????????? ??????????, ?? ? ????????? ????????? ?????? ????? ????? ???? ?????????????.

minidle

????????????? ???????? avgidle ?????????, ??? ????? ??????????, ? ????? ?????????? ???????? ?? ?????, ???? avgidle ?? ?????????? ?????????? ??? ???????? ?????????? ??????. ??????, ??? ????? ??????? ?????????? ??????? ???????? ????? ??????????? ????????? ???????. ? ????? ??????? avgidle ????????????? ???????? ????????? minidle.

Minidle ???????? ? ????????????? ?????????????, ????????????? ???????? "10" ???????????? ???????? avgidle -10 ??????????????.

mpu

??????????? ?????? ?????? -- ?????????, ????????? ???? ??????? ????? ??????????? ?? 64 ???? ??? ???????? ?? ???? ethernet, ? ??? ??? ???????? ???????????? ?????. ???????? CBQ ?????? ????? ??????????? ?????? ?????? ??? ??????????? ?????????? ??????? ???????.

rate

???????? ???????????? ???????? ???????? ??????? ??? ?????? ??????????.

????? ??????????? ?????? ???????????, CBQ ????? ????? ???????????? ?????? ?? ??????? ? ?????????? ???????????? ? ??????????????? ??????? ?? ????????????.

?????? ???, ????? ????? ???????? ?????, ???????????? ??????????? ??????? ('WRR') ??????, ??????? ? ??????????????????? ??????.

????????? ????????? ????????? ?????????? ??????????? ????????? ??????:

allot

????? ???????????? ????? ?????? ??? ????????, CBQ ???????? ?????????? ???? ????????? ? ???????????? ? ?? ???????????. ????? ?????? ??????????????? ??????????? ????????, ?????????? ???????????? ????? ??????. ??????? ??????? ????? ?????? ???????????? ?????????? allot.

prio

?????????? CBQ ????? ??????????? ??????? ??????????. ??????? ???????? ???????? ??????? ?????????. ???? ?? ????? ????????? ?????? ? ?????? ???????????, ?????? ? ??????? ??????????? ?? ??????????????.

weight

?????? ????? ???????? ??????????? ???????? ??????. ???? ? ??? ???? ??????, ??????????? ???????????? ??????? ???????????, ????? ????? ????????? ??????? ? ??????? ?????????? ???????????? ???????? ?? ??? ?????? ??????, ??? ?????? ? ????????? ?????????? ????????????

?????????? CBQ ??????????? ??????? ??? ? ????????? ??, ?????? ????? ???????????? ????? ????????: ????? ????????? ???? ????????. ?????? ???????????? ??????? ???????: ??? = ?????? ??????????? / 10. ??? ??????????? ?????????? ??????, ?????????? ??????? ?? ???, ????????????? ???????? ?????????? ?? allot.

????? ???????? ??????????? ?????? ??????????? ??? ???????????? ????? ???????, ????? ?????? ??????????? ??????? ???????? ????? ?????? ??????????? ? ?????? ???????.

isolated/sharing

? ??????, ?????????? ? ?????????? isolated, ?????? ???????? ?????? ???????????. ?? ???? ?????? ??????, ??????????? ?? ???? ????????? ?????? ??????????? ??????? ?? ?????? ?????? ?????? ????? ??????, ???? ???? ??? ????? ?????????.

????????, ????? ????????? ? ?????????? sharing ????? ????????????? ???? ????????? ????? ???????????? ??????????? ?????? ???????.

bounded/borrow

??? ??? ????????? ??????????, ????? ?? ????? ???????? ???????????? ??????????? ?????? ???????. ???????? bounded ?????????, ? borrow ????????? ???????? ????????? ?????? ??????????? ???????, ?????????????????? ? ?????????? sharing.

????????, ????? ???????????? bounded ? isolated ?????, ????? ????????? ???????? ????????????? ?????? ?????? ????? ?????????????. ? ???? ?????? ??? ????? ????????????? ?????????? ?????????????????? ?????????.

?????? ??????? ?????? ?????? ????? ?????????? ????????? ? ??????? sharing ? borrow. ???? ????? ??????????? ? ???????? ????????????? ?????? ??? ?????? ???????????.

?????? ???????????? ?????????? CBQ

?????????? ?????????? ?????????? ????????. ??? ????? ?????????? ?????? ??????????? ???-??????? ?? 5 ???????, ? SMTP -- ?? 3 ???????. ????????? ?????? ??????????? ?? ?????? ????????? 6 ???????. ?? ??????? ????? 100-?????????? ??????? ?????, ?????? ????? ???????? ?????????? ??????????? ???? ? ?????.

??????? ???????? ?????????? ? ?????, ???? ????? ???????????? HTTP ? SMTP ??????. ???????? bounded ????????? ????? ?????? ???????? ?????? ???????????.

[root@eagle]# tc qdisc add dev eth0 root handle 1:0 cbq bandwidth 100Mbit         
  avpkt 1000 cell 8
[root@eagle]# tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 100Mbit  
  rate 6Mbit weight 0.6Mbit prio 8 allot 1514 cell 8 maxburst 20      
  avpkt 1000 bounded

??? ?????, CBQ ??????? ????? ?????? ???????? ?? ????????? ? HTB.

?????? ?????? ??? ?????? ??????????????? ??? ??? ? ????????? ???????. ?? ??????? ????????? borrow ? sharing, ??? ????????? ???????? ??????? ?????? ??????????? ???? ????? ? ???????? ????????????? ?????? 1:1.

[root@eagle]# tc class add dev eth0 parent 1:1 classid 1:3 cbq bandwidth 100Mbit  
  rate 5Mbit weight 0.5Mbit prio 5 allot 1514 cell 8 maxburst 20      
  avpkt 1000 borrow sharing                     
[root@eagle]# tc class add dev eth0 parent 1:1 classid 1:4 cbq bandwidth 100Mbit  
  rate 3Mbit weight 0.3Mbit prio 5 allot 1514 cell 8 maxburst 20      
  avpkt 1000 borrow sharing

??? ????? ???????????? ????????????? ?????????? ??????????? ????? ????????????, ??????????? ? ??????? ?????? ?????????? ????????? ??????? SFQ

[root@eagle]# tc qdisc add dev eth0 parent 1:3 handle 30: sfq perturb 10
[root@eagle]# tc qdisc add dev eth0 parent 1:4 handle 40: sfq perturb 10

???????, ?????????????? ?????? ? ??????? ???????? ? ?????????? ??? ? ?????? ??????:

[root@eagle]# tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip 
  sport 80 0xffff flowid 1:3
[root@eagle]# tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip 
  sport 25 0xffff flowid 1:4

???????? ????????, ??? ??????? ?? ?????????? ? ???????? ?????????? ????????? ???????. ?????? ?? ??????????????? ??? ???????? ????? ?????????????? ? ??????????? ????????? ?????????.

???? ???????? ?? ??????? ????? ?????????? ???????? ??????, ??? ??????????????????, ?? 6 ??????? ?????????? ????? ???????? ? ????????? 5/3, ?????????????? ???? ???????.

?????????????, ? ????? ???????????? ??????????????? ?????? ??????????? ??? ???-??????? ????? ????? 5/8 * 6 ????= 3.75 ???????.

IMQ, Intermediate queueing device

?????????? IMQ ?? ???????? ??????????? ????????? ???????, ?? ????? ? ???? ???????. ? ?? Linux ?????????? ????????? ???????? ???????????? ? ??????? ??????????? ? ???, ??? ?????????? ? ??????? ? ??????????, ???????? ??????? ? ??????? ?????????? ????????? ???????. ??-?? ????? ??????? ?????????? ??? ???????????:

1. ??????????? ?????????? ??????????? ???????? ?????? ??? ?????????? ??????? (?????????? ????????? ????????? ??????? ??????????, ?? ?? ??????????? ??????? ?? ????????? ? ????????????? ????????????).

2. ?????????? ????????? ??????? ???????????? ?????? ?????? ?????? ??????????, ??? ??????????? ???????? ?????????? ???????????.

?????????? IMQ ???????? ?????? ??? ????????. ? ??????? ?????????? ?????????? ?? Linux ????? ???????????? ?????? ?????????? ????? ???? ??????-?????????, ? ???????? ???????????? ????????? ?????????? ????????? ????????. ????? ???????, ????? ????????? ??????? ???????????, ??? ?????????, ??? ? ?????? ???????.

??????? ????????????? IMQ

??????, ?????????????? ??????????????? ?????? ??????????? ??? ?????? 10.0.0.230:

[root@eagle]# tc qdisc add dev imq0 root handle 1: htb default 20

[root@eagle]# tc class add dev imq0 parent 1: classid 1:1 htb rate 2mbit burst 15k

[root@eagle]# tc class add dev imq0 parent 1:1 classid 1:10 htb rate 1mbit
[root@eagle]# tc class add dev imq0 parent 1:1 classid 1:20 htb rate 1mbit

[root@eagle]# tc qdisc add dev imq0 parent 1:10 handle 10: pfifo
[root@eagle]# tc qdisc add dev imq0 parent 1:20 handle 20: sfq

[root@eagle]# tc filter add dev imq0 parent 10:0 protocol ip prio 1 u32 match 
                ip dst 10.0.0.230/32 flowid 1:10

? ???? ??????? ??????????? ????????????? u32, ????????? ?????????????? ???? ????? ??????????? ? ?????? ? imq.

[root@eagle]# iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 0

[root@eagle]# ip link set imq0 up

???? IMQ ??????? iptables ???????? ? ???????? PREROUTING ? POSTROUTING ??????? mangle table. ?????????:

IMQ [ --todev n ], n -- ????? ?????????? imq

???? ????????? ? ??????? ip6tables.

????????, ??? ?????? ???????? ?? ????????? ?? ? ??? ??????, ????? ????????? ? ???? IMQ, ? ????? ????????? ??????????????? ???????. ?????? ????? ????? ?? ?????????? imq ??????? ?? ???? ??????? (????????/?????????).

??? ????????? ??????? imq ?????????????? ? ??????????? NF_IP_PRI_MANGLE + 1. ??? ????????, ??? ?????? ???????? ?? ?????????? ????? ????? ??????????? ??????? PREROUTING.

??? ?????????? ???????, imq ?????????? ????????? NF_IP_PRI_LAST, ??????? ???????????, ??? ??????, ???????????? ???????? ???????? ?? ????? ???????? ?????? ??????????? ??????????.

??? ???? ??????, ?????? ??????????? ?????????? ??? ??????? ?? 100???? ?? ????????, ?? ???? ???????????:

[root@eagle]# modprobe imq numdevs=1
[root@eagle]# tc qdisc add dev imq0 handle 1: root htb default 1
[root@eagle]# tc cladd add dev imq0 parent 1: classid 1:1 htb rate 100kbit
[root@eagle]# tc qdisc add dev imq0 parent 1:1 handle 10: htb default 10
[root@eagle]# tc class add dev imq0 parent 10: classid 10:10 htb rate 100kbit
[root@eagle]# tc qdisc add dev imq0 parent 10:10 handle 20: sfq
[root@eagle]# iptables -t mangle -A POSTROUTING -p tcp --dport 80 -j IMQ
[root@eagle]# ip link set imq0 up

????? ??????? ??????? ?????????? ????????

???? ????????? ????? ?????? ??????? ?????????? ???????? ? ?? Linux.

  • ?????????????, ??????????? ??????????? ?????? ??????????? ?????? ???? ????? ?????? ?????? ? ?????? ???????????? ????? ?? ???????? ??????? ??????? ???????? ?????????? ??????????? ??????. ??? ????????????? ??????????? ???????? ? ?????? ??????????????? ? ???????????? ???????????? ???????? ??? ??????? ?????? ?????? ??????????????.

  • ?????????? ???????? ????? ?????? ? ?????????? ???????. ???????? ?????? ??? ?????? ? ???, ?????? ?? ?? ????? ??????????????? ?????????? ???????? ??? ???????????. ???????????? ???????? ???????? ????????????? ????????????, ?????? ??? ?? ???? ?????? ???????, ???? ???????????? ??? ????????? ??????, ??????? ?????? ????? ????? ?????? ???????????. ?????? ???????? ???????? ????????????? IMQ.

  • ?????? ????????? ?????? ????? ?????????? ????????? ???????. ?? ????????? ???????????? ?????????? pfifo_fast.

  • ????????????? ????????? ????????? ????????? ???????? ??? ?????????? ?? ????? ?????? ? ?????????? ??? ??????? ???????.

  • ????????? ????? ?? ????????? ???????? ?????????? fifo. ?? ????? ???????? ????? ?????? ??????????? ????????? ???????.

  • ??????? ????? ???????????? ? ??????? ??? ????????? ??????????? ????????? ???????

????? ???? ????????? ????????????

??? ????????? ????????????, ????? ??? ??????? ???????????? ? ????????? ?????????.

  • ??? ??????????? ?????????? ???????, ??? ??????? ?? ???????, ??????????? ?????????? TBF. ??? ??????????? ? ???????? ??????????, ??? ??????????????? ????????? ??????? ?????? ???????.

  • ??? ??????????? ?????????? ???????, ? ???????? ?? ???????, ??????????? ?????????? HTB. ??? ??????? ??????????? ????????? ?????????? ???????? ? ??????????? ??????????? ???????.
  • ???? ????? ??? ????? ????????? ?????????, ? ?? ?????? ?? ????????? ????????????? ????? ?????????? ??? ??????? -- ??????????? SFQ ??? ESFQ.

  • ??? ?????? ? ?????????????? ???????? ??????????? ?????????? RED.

  • ??? ??????????? ????????? ??????? ??????????? ???????????? (Ingress Policer).

  • ???? ?? ?????????? ???????? ??????, ?? ????? ??????????? ??????????? ?????????? ??????? ?? ????????? ???????????, ??? ?????????? IMQ.

??????

? ?????? ????????? ???? ???????????? ????????? ?? ????????? ??????????:


Copyright © 2003, Ivan Pesin






Внимание! Читая пророчества на этом сайте помните что достоверность трудно проверить и все может во времени изменяться
"О дне же том, или часе, никто не знает, ни Ангелы небесные, ни Сын, но только Отец (Мк. 13, 32)"