DUMMYNET и ~ 1500 юзеров

Настройка сетевых служб, маршрутизации, фаерволлов. Проблемы с сетевым оборудованием.
Правила форума
Убедительная просьба юзать теги [code] при оформлении листингов.
Сообщения не оформленные должным образом имеют все шансы быть незамеченными.
Lord3D
проходил мимо
Сообщения: 2
Зарегистрирован: 2010-11-23 20:25:33

DUMMYNET и ~ 1500 юзеров

Непрочитанное сообщение Lord3D » 2010-11-23 21:08:13

Код: Выделить всё

#!/bin/sh

ipfw -f flush
ipfw -f table all flush
ipfw -f nat flush
ipfw -f pipe flush
ipfw nat 100 config ip 77.94.166.106
ipfw add 1 nat 100 all from 10.64.0.0/15,10.254.100.0/29 to any via vlan1 out
ipfw add 2 nat 100 all from any to 77.94.166.106 via vlan1 in

echo ' #####   Наполняем таблицу исключений'

ipfw table 127 add 62.122.192.0/21 65000
ipfw table 127 add 10.0.0.0/8 65001
ipfw table 127 add 192.168.0.0/16 65002
ipfw table 127 add 172.16.0.0/12 65003
ipfw table 127 add 81.26.153.0/24 65004
ipfw table 127 add 84.47.191.40/30 65005
ipfw table 127 add 77.94.166.104/30 65006

echo ' #####   Добавляем классы PIPE'

ipfw pipe 101 config bw 80kbit/s
ipfw pipe 102 config bw 160kbit/s
ipfw pipe 103 config bw 240kbit/s
ipfw pipe 104 config bw 320kbit/s
ipfw pipe 105 config bw 400kbit/s
ipfw pipe 106 config bw 480kbit/s
ipfw pipe 107 config bw 560kbit/s
ipfw pipe 108 config bw 640kbit/s
ipfw pipe 109 config bw 720kbit/s
ipfw pipe 110 config bw 800kbit/s
ipfw pipe 111 config bw 880kbit/s
ipfw pipe 112 config bw 960kbit/s
ipfw pipe 113 config bw 1040kbit/s
ipfw pipe 114 config bw 1120kbit/s
ipfw pipe 115 config bw 1200kbit/s
ipfw pipe 116 config bw 1250kbit/s
ipfw pipe 117 config bw 2500kbit/s
ipfw pipe 118 config bw 3750kbit/s
ipfw pipe 119 config bw 5000kbit/s
ipfw pipe 120 config bw 6250kbit/s
ipfw pipe 121 config bw 7500kbit/s
ipfw pipe 122 config bw 10000kbit/s
ipfw pipe 123 config bw 12500kbit/s
ipfw pipe 124 config bw 17500kbit/s
ipfw pipe 125 config bw 25000kbit/s
ipfw pipe 126 config bw 62500kbit/s
ipfw pipe 127 config bw 100mbit/s

ipfw pipe 501 config bw 80kbit/s
ipfw pipe 502 config bw 160kbit/s
ipfw pipe 503 config bw 240kbit/s
ipfw pipe 504 config bw 320kbit/s
ipfw pipe 505 config bw 400kbit/s
ipfw pipe 506 config bw 480kbit/s
ipfw pipe 507 config bw 560kbit/s
ipfw pipe 508 config bw 640kbit/s
ipfw pipe 509 config bw 720kbit/s
ipfw pipe 510 config bw 800kbit/s
ipfw pipe 511 config bw 880kbit/s
ipfw pipe 512 config bw 960kbit/s
ipfw pipe 513 config bw 1040kbit/s
ipfw pipe 514 config bw 1120kbit/s
ipfw pipe 515 config bw 1200kbit/s
ipfw pipe 516 config bw 1250kbit/s
ipfw pipe 517 config bw 2500kbit/s
ipfw pipe 518 config bw 3750kbit/s
ipfw pipe 519 config bw 5000kbit/s
ipfw pipe 520 config bw 6250kbit/s
ipfw pipe 521 config bw 7500kbit/s
ipfw pipe 522 config bw 10000kbit/s
ipfw pipe 523 config bw 12500kbit/s
ipfw pipe 524 config bw 17500kbit/s
ipfw pipe 525 config bw 25000kbit/s
ipfw pipe 526 config bw 62500kbit/s
ipfw pipe 527 config bw 100mbit/s

ipfw queue 101 config weight 5 pipe 101 queue 64 mask dst-ip 0xffffffff
ipfw queue 102 config weight 5 pipe 102 queue 64 mask dst-ip 0xffffffff
ipfw queue 103 config weight 5 pipe 103 queue 64 mask dst-ip 0xffffffff
ipfw queue 104 config weight 5 pipe 104 queue 64 mask dst-ip 0xffffffff
ipfw queue 105 config weight 5 pipe 105 queue 64 mask dst-ip 0xffffffff
ipfw queue 106 config weight 5 pipe 106 queue 64 mask dst-ip 0xffffffff
ipfw queue 107 config weight 5 pipe 107 queue 64 mask dst-ip 0xffffffff
ipfw queue 108 config weight 5 pipe 108 queue 64 mask dst-ip 0xffffffff
ipfw queue 109 config weight 5 pipe 109 queue 64 mask dst-ip 0xffffffff
ipfw queue 110 config weight 5 pipe 110 queue 64 mask dst-ip 0xffffffff
ipfw queue 111 config weight 5 pipe 111 queue 64 mask dst-ip 0xffffffff
ipfw queue 112 config weight 5 pipe 112 queue 64 mask dst-ip 0xffffffff
ipfw queue 113 config weight 5 pipe 113 queue 64 mask dst-ip 0xffffffff
ipfw queue 114 config weight 5 pipe 114 queue 64 mask dst-ip 0xffffffff
ipfw queue 115 config weight 5 pipe 115 queue 64 mask dst-ip 0xffffffff
ipfw queue 116 config weight 5 pipe 116 queue 64 mask dst-ip 0xffffffff
ipfw queue 117 config weight 5 pipe 117 queue 64 mask dst-ip 0xffffffff
ipfw queue 118 config weight 5 pipe 118 queue 64 mask dst-ip 0xffffffff
ipfw queue 119 config weight 5 pipe 119 queue 64 mask dst-ip 0xffffffff
ipfw queue 120 config weight 5 pipe 120 queue 64 mask dst-ip 0xffffffff
ipfw queue 121 config weight 5 pipe 121 queue 64 mask dst-ip 0xffffffff
ipfw queue 122 config weight 5 pipe 122 queue 64 mask dst-ip 0xffffffff
ipfw queue 123 config weight 5 pipe 123 queue 64 mask dst-ip 0xffffffff
ipfw queue 124 config weight 5 pipe 124 queue 64 mask dst-ip 0xffffffff
ipfw queue 125 config weight 5 pipe 125 queue 64 mask dst-ip 0xffffffff
ipfw queue 126 config weight 5 pipe 126 queue 64 mask dst-ip 0xffffffff
ipfw queue 127 config weight 5 pipe 127 queue 64 mask dst-ip 0xffffffff

ipfw queue 201 config weight 50 pipe 101 queue 12 mask dst-ip 0xffffffff
ipfw queue 202 config weight 50 pipe 102 queue 12 mask dst-ip 0xffffffff
ipfw queue 203 config weight 50 pipe 103 queue 12 mask dst-ip 0xffffffff
ipfw queue 204 config weight 50 pipe 104 queue 12 mask dst-ip 0xffffffff
ipfw queue 205 config weight 50 pipe 105 queue 12 mask dst-ip 0xffffffff
ipfw queue 206 config weight 50 pipe 106 queue 12 mask dst-ip 0xffffffff
ipfw queue 207 config weight 50 pipe 107 queue 12 mask dst-ip 0xffffffff
ipfw queue 208 config weight 50 pipe 108 queue 12 mask dst-ip 0xffffffff
ipfw queue 209 config weight 50 pipe 109 queue 12 mask dst-ip 0xffffffff
ipfw queue 210 config weight 50 pipe 110 queue 12 mask dst-ip 0xffffffff
ipfw queue 211 config weight 50 pipe 111 queue 12 mask dst-ip 0xffffffff
ipfw queue 212 config weight 50 pipe 112 queue 12 mask dst-ip 0xffffffff
ipfw queue 213 config weight 50 pipe 113 queue 12 mask dst-ip 0xffffffff
ipfw queue 214 config weight 50 pipe 114 queue 12 mask dst-ip 0xffffffff
ipfw queue 215 config weight 50 pipe 115 queue 12 mask dst-ip 0xffffffff
ipfw queue 216 config weight 50 pipe 116 queue 12 mask dst-ip 0xffffffff
ipfw queue 217 config weight 50 pipe 117 queue 12 mask dst-ip 0xffffffff
ipfw queue 218 config weight 50 pipe 118 queue 12 mask dst-ip 0xffffffff
ipfw queue 219 config weight 50 pipe 119 queue 12 mask dst-ip 0xffffffff
ipfw queue 220 config weight 50 pipe 120 queue 12 mask dst-ip 0xffffffff
ipfw queue 221 config weight 50 pipe 121 queue 12 mask dst-ip 0xffffffff
ipfw queue 222 config weight 50 pipe 122 queue 12 mask dst-ip 0xffffffff
ipfw queue 223 config weight 50 pipe 123 queue 12 mask dst-ip 0xffffffff
ipfw queue 224 config weight 50 pipe 124 queue 12 mask dst-ip 0xffffffff
ipfw queue 225 config weight 50 pipe 125 queue 12 mask dst-ip 0xffffffff
ipfw queue 226 config weight 50 pipe 126 queue 12 mask dst-ip 0xffffffff
ipfw queue 227 config weight 50 pipe 127 queue 12 mask dst-ip 0xffffffff

ipfw queue 501 config weight 5 pipe 501 queue 64 mask src-ip 0xffffffff
ipfw queue 502 config weight 5 pipe 502 queue 64 mask src-ip 0xffffffff
ipfw queue 503 config weight 5 pipe 503 queue 64 mask src-ip 0xffffffff
ipfw queue 504 config weight 5 pipe 504 queue 64 mask src-ip 0xffffffff
ipfw queue 505 config weight 5 pipe 505 queue 64 mask src-ip 0xffffffff
ipfw queue 506 config weight 5 pipe 506 queue 64 mask src-ip 0xffffffff
ipfw queue 507 config weight 5 pipe 507 queue 64 mask src-ip 0xffffffff
ipfw queue 508 config weight 5 pipe 508 queue 64 mask src-ip 0xffffffff
ipfw queue 509 config weight 5 pipe 509 queue 64 mask src-ip 0xffffffff
ipfw queue 510 config weight 5 pipe 510 queue 64 mask src-ip 0xffffffff
ipfw queue 511 config weight 5 pipe 511 queue 64 mask src-ip 0xffffffff
ipfw queue 512 config weight 5 pipe 512 queue 64 mask src-ip 0xffffffff
ipfw queue 513 config weight 5 pipe 513 queue 64 mask src-ip 0xffffffff
ipfw queue 514 config weight 5 pipe 514 queue 64 mask src-ip 0xffffffff
ipfw queue 515 config weight 5 pipe 515 queue 64 mask src-ip 0xffffffff
ipfw queue 516 config weight 5 pipe 516 queue 64 mask src-ip 0xffffffff
ipfw queue 517 config weight 5 pipe 517 queue 64 mask src-ip 0xffffffff
ipfw queue 518 config weight 5 pipe 518 queue 64 mask src-ip 0xffffffff
ipfw queue 519 config weight 5 pipe 519 queue 64 mask src-ip 0xffffffff
ipfw queue 520 config weight 5 pipe 520 queue 64 mask src-ip 0xffffffff
ipfw queue 521 config weight 5 pipe 521 queue 64 mask src-ip 0xffffffff
ipfw queue 522 config weight 5 pipe 522 queue 64 mask src-ip 0xffffffff
ipfw queue 523 config weight 5 pipe 523 queue 64 mask src-ip 0xffffffff
ipfw queue 524 config weight 5 pipe 524 queue 64 mask src-ip 0xffffffff
ipfw queue 525 config weight 5 pipe 525 queue 64 mask src-ip 0xffffffff
ipfw queue 526 config weight 5 pipe 526 queue 64 mask src-ip 0xffffffff
ipfw queue 527 config weight 5 pipe 527 queue 64 mask src-ip 0xffffffff

ipfw queue 601 config weight 50 pipe 501 queue 12 mask src-ip 0xffffffff
ipfw queue 602 config weight 50 pipe 502 queue 12 mask src-ip 0xffffffff
ipfw queue 603 config weight 50 pipe 503 queue 12 mask src-ip 0xffffffff
ipfw queue 604 config weight 50 pipe 504 queue 12 mask src-ip 0xffffffff
ipfw queue 605 config weight 50 pipe 505 queue 12 mask src-ip 0xffffffff
ipfw queue 606 config weight 50 pipe 506 queue 12 mask src-ip 0xffffffff
ipfw queue 607 config weight 50 pipe 507 queue 12 mask src-ip 0xffffffff
ipfw queue 608 config weight 50 pipe 508 queue 12 mask src-ip 0xffffffff
ipfw queue 609 config weight 50 pipe 509 queue 12 mask src-ip 0xffffffff
ipfw queue 610 config weight 50 pipe 510 queue 12 mask src-ip 0xffffffff
ipfw queue 611 config weight 50 pipe 511 queue 12 mask src-ip 0xffffffff
ipfw queue 612 config weight 50 pipe 512 queue 12 mask src-ip 0xffffffff
ipfw queue 613 config weight 50 pipe 513 queue 12 mask src-ip 0xffffffff
ipfw queue 614 config weight 50 pipe 514 queue 12 mask src-ip 0xffffffff
ipfw queue 615 config weight 50 pipe 515 queue 12 mask src-ip 0xffffffff
ipfw queue 616 config weight 50 pipe 516 queue 12 mask src-ip 0xffffffff
ipfw queue 617 config weight 50 pipe 517 queue 12 mask src-ip 0xffffffff
ipfw queue 618 config weight 50 pipe 518 queue 12 mask src-ip 0xffffffff
ipfw queue 619 config weight 50 pipe 519 queue 12 mask src-ip 0xffffffff
ipfw queue 620 config weight 50 pipe 520 queue 12 mask src-ip 0xffffffff
ipfw queue 621 config weight 50 pipe 521 queue 12 mask src-ip 0xffffffff
ipfw queue 622 config weight 50 pipe 522 queue 12 mask src-ip 0xffffffff
ipfw queue 623 config weight 50 pipe 523 queue 12 mask src-ip 0xffffffff
ipfw queue 624 config weight 50 pipe 524 queue 12 mask src-ip 0xffffffff
ipfw queue 625 config weight 50 pipe 525 queue 12 mask src-ip 0xffffffff
ipfw queue 626 config weight 50 pipe 526 queue 12 mask src-ip 0xffffffff
ipfw queue 627 config weight 50 pipe 527 queue 12 mask src-ip 0xffffffff

echo ' #####   Создаём класс для пинга и DNS'

ipfw pipe 1000 config bw 200mbit/s
ipfw queue 1000 config weight 1 pipe 1000 queue 96 mask dst-ip 0xffffffff mask src-ip 0xffffffff

echo ' #####   Загоняем адреса в таблицы'

ipfw table 22 add 62.122.195.62/32 1
ipfw table 27 add 192.168.200.9/32 2
ipfw table 27 add 192.168.200.0/32 3
ipfw table 20 add 62.122.192.120/32 4
ipfw table 27 add 81.26.153.14/32 5
ipfw table 8 add 10.65.5.188/32 6
ipfw table 23 add 10.65.100.98/32 7
ipfw table 8 add 10.65.100.30/32 8
ipfw table 23 add 62.122.192.39/32 9
..............................................
ipfw table 27 add 192.168.201.58/32 3648
ipfw table 27 add 192.168.201.51/32 3649
ipfw table 27 add 192.168.201.6/32 3650
ipfw table 27 add 10.65.2.173/32 3651
ipfw table 26 add 62.122.193.55/32 3652
ipfw table 16 add 10.65.110.100/32 3653
ipfw table 27 add 10.65.1.79/32 3654
ipfw table 27 add 10.65.1.82/32 3655
ipfw table 27 add 10.65.7.143/32 3656
ipfw table 27 add 10.65.1.75/32 3657
ipfw table 27 add 10.65.1.195/32 3658
ipfw table 17 add 10.65.1.254/32 3659
ipfw table 27 add 62.122.193.137/32 3660
ipfw table 27 add 10.65.1.76/32 3661

echo ' #####   Применяем класс для пинга и DNS'

ipfw add queue 1000 icmp from any to any
ipfw add queue 1000 tcp from any to any 53
ipfw add queue 1000 tcp from any 53 to any
ipfw add queue 1000 udp from any to any 53
ipfw add queue 1000 udp from any 53 to any

echo ' #####   Загоняем таблицы в правила'

ipfw add queue 101 tcp from not "table(127)" to "table(1)" via igb1 out
ipfw add queue 102 tcp from not "table(127)" to "table(2)" via igb1 out
ipfw add queue 103 tcp from not "table(127)" to "table(3)" via igb1 out
ipfw add queue 104 tcp from not "table(127)" to "table(4)" via igb1 out
ipfw add queue 105 tcp from not "table(127)" to "table(5)" via igb1 out
ipfw add queue 106 tcp from not "table(127)" to "table(6)" via igb1 out
ipfw add queue 107 tcp from not "table(127)" to "table(7)" via igb1 out
ipfw add queue 108 tcp from not "table(127)" to "table(8)" via igb1 out
ipfw add queue 109 tcp from not "table(127)" to "table(9)" via igb1 out
ipfw add queue 110 tcp from not "table(127)" to "table(10)" via igb1 out
ipfw add queue 111 tcp from not "table(127)" to "table(11)" via igb1 out
ipfw add queue 112 tcp from not "table(127)" to "table(12)" via igb1 out
ipfw add queue 113 tcp from not "table(127)" to "table(13)" via igb1 out
ipfw add queue 114 tcp from not "table(127)" to "table(14)" via igb1 out
ipfw add queue 115 tcp from not "table(127)" to "table(15)" via igb1 out
ipfw add queue 116 tcp from not "table(127)" to "table(16)" via igb1 out
ipfw add queue 117 tcp from not "table(127)" to "table(17)" via igb1 out
ipfw add queue 118 tcp from not "table(127)" to "table(18)" via igb1 out
ipfw add queue 119 tcp from not "table(127)" to "table(19)" via igb1 out
ipfw add queue 120 tcp from not "table(127)" to "table(20)" via igb1 out
ipfw add queue 121 tcp from not "table(127)" to "table(21)" via igb1 out
ipfw add queue 122 tcp from not "table(127)" to "table(22)" via igb1 out
ipfw add queue 123 tcp from not "table(127)" to "table(23)" via igb1 out
ipfw add queue 124 tcp from not "table(127)" to "table(24)" via igb1 out
ipfw add queue 125 tcp from not "table(127)" to "table(25)" via igb1 out
ipfw add queue 126 tcp from not "table(127)" to "table(26)" via igb1 out
ipfw add queue 127 tcp from not "table(127)" to "table(27)" via igb1 out

ipfw add queue 201 udp from not "table(127)" to "table(1)" via igb1 out
ipfw add queue 202 udp from not "table(127)" to "table(2)" via igb1 out
ipfw add queue 203 udp from not "table(127)" to "table(3)" via igb1 out
ipfw add queue 204 udp from not "table(127)" to "table(4)" via igb1 out
ipfw add queue 205 udp from not "table(127)" to "table(5)" via igb1 out
ipfw add queue 206 udp from not "table(127)" to "table(6)" via igb1 out
ipfw add queue 207 udp from not "table(127)" to "table(7)" via igb1 out
ipfw add queue 208 udp from not "table(127)" to "table(8)" via igb1 out
ipfw add queue 209 udp from not "table(127)" to "table(9)" via igb1 out
ipfw add queue 210 udp from not "table(127)" to "table(10)" via igb1 out
ipfw add queue 211 udp from not "table(127)" to "table(11)" via igb1 out
ipfw add queue 212 udp from not "table(127)" to "table(12)" via igb1 out
ipfw add queue 213 udp from not "table(127)" to "table(13)" via igb1 out
ipfw add queue 214 udp from not "table(127)" to "table(14)" via igb1 out
ipfw add queue 215 udp from not "table(127)" to "table(15)" via igb1 out
ipfw add queue 216 udp from not "table(127)" to "table(16)" via igb1 out
ipfw add queue 217 udp from not "table(127)" to "table(17)" via igb1 out
ipfw add queue 218 udp from not "table(127)" to "table(18)" via igb1 out
ipfw add queue 219 udp from not "table(127)" to "table(19)" via igb1 out
ipfw add queue 220 udp from not "table(127)" to "table(20)" via igb1 out
ipfw add queue 221 udp from not "table(127)" to "table(21)" via igb1 out
ipfw add queue 222 udp from not "table(127)" to "table(22)" via igb1 out
ipfw add queue 223 udp from not "table(127)" to "table(23)" via igb1 out
ipfw add queue 224 udp from not "table(127)" to "table(24)" via igb1 out
ipfw add queue 225 udp from not "table(127)" to "table(25)" via igb1 out
ipfw add queue 226 udp from not "table(127)" to "table(26)" via igb1 out
ipfw add queue 227 udp from not "table(127)" to "table(27)" via igb1 out

ipfw add queue 501 tcp from "table(1)" to not "table(127)" via igb1 in
ipfw add queue 502 tcp from "table(2)" to not "table(127)" via igb1 in
ipfw add queue 503 tcp from "table(3)" to not "table(127)" via igb1 in
ipfw add queue 504 tcp from "table(4)" to not "table(127)" via igb1 in
ipfw add queue 505 tcp from "table(5)" to not "table(127)" via igb1 in
ipfw add queue 506 tcp from "table(6)" to not "table(127)" via igb1 in
ipfw add queue 507 tcp from "table(7)" to not "table(127)" via igb1 in
ipfw add queue 508 tcp from "table(8)" to not "table(127)" via igb1 in
ipfw add queue 509 tcp from "table(9)" to not "table(127)" via igb1 in
ipfw add queue 510 tcp from "table(10)" to not "table(127)" via igb1 in
ipfw add queue 511 tcp from "table(11)" to not "table(127)" via igb1 in
ipfw add queue 512 tcp from "table(12)" to not "table(127)" via igb1 in
ipfw add queue 513 tcp from "table(13)" to not "table(127)" via igb1 in
ipfw add queue 514 tcp from "table(14)" to not "table(127)" via igb1 in
ipfw add queue 515 tcp from "table(15)" to not "table(127)" via igb1 in
ipfw add queue 516 tcp from "table(16)" to not "table(127)" via igb1 in
ipfw add queue 517 tcp from "table(17)" to not "table(127)" via igb1 in
ipfw add queue 518 tcp from "table(18)" to not "table(127)" via igb1 in
ipfw add queue 519 tcp from "table(19)" to not "table(127)" via igb1 in
ipfw add queue 520 tcp from "table(20)" to not "table(127)" via igb1 in
ipfw add queue 521 tcp from "table(21)" to not "table(127)" via igb1 in
ipfw add queue 522 tcp from "table(22)" to not "table(127)" via igb1 in
ipfw add queue 523 tcp from "table(23)" to not "table(127)" via igb1 in
ipfw add queue 524 tcp from "table(24)" to not "table(127)" via igb1 in
ipfw add queue 525 tcp from "table(25)" to not "table(127)" via igb1 in
ipfw add queue 526 tcp from "table(26)" to not "table(127)" via igb1 in
ipfw add queue 527 tcp from "table(27)" to not "table(127)" via igb1 in

ipfw add queue 601 udp from "table(1)" to not "table(127)" via igb1 in
ipfw add queue 602 udp from "table(2)" to not "table(127)" via igb1 in
ipfw add queue 603 udp from "table(3)" to not "table(127)" via igb1 in
ipfw add queue 604 udp from "table(4)" to not "table(127)" via igb1 in
ipfw add queue 605 udp from "table(5)" to not "table(127)" via igb1 in
ipfw add queue 606 udp from "table(6)" to not "table(127)" via igb1 in
ipfw add queue 607 udp from "table(7)" to not "table(127)" via igb1 in
ipfw add queue 608 udp from "table(8)" to not "table(127)" via igb1 in
ipfw add queue 609 udp from "table(9)" to not "table(127)" via igb1 in
ipfw add queue 610 udp from "table(10)" to not "table(127)" via igb1 in
ipfw add queue 611 udp from "table(11)" to not "table(127)" via igb1 in
ipfw add queue 612 udp from "table(12)" to not "table(127)" via igb1 in
ipfw add queue 613 udp from "table(13)" to not "table(127)" via igb1 in
ipfw add queue 614 udp from "table(14)" to not "table(127)" via igb1 in
ipfw add queue 615 udp from "table(15)" to not "table(127)" via igb1 in
ipfw add queue 616 udp from "table(16)" to not "table(127)" via igb1 in
ipfw add queue 617 udp from "table(17)" to not "table(127)" via igb1 in
ipfw add queue 618 udp from "table(18)" to not "table(127)" via igb1 in
ipfw add queue 619 udp from "table(19)" to not "table(127)" via igb1 in
ipfw add queue 620 udp from "table(20)" to not "table(127)" via igb1 in
ipfw add queue 621 udp from "table(21)" to not "table(127)" via igb1 in
ipfw add queue 622 udp from "table(22)" to not "table(127)" via igb1 in
ipfw add queue 623 udp from "table(23)" to not "table(127)" via igb1 in
ipfw add queue 624 udp from "table(24)" to not "table(127)" via igb1 in
ipfw add queue 625 udp from "table(25)" to not "table(127)" via igb1 in
ipfw add queue 626 udp from "table(26)" to not "table(127)" via igb1 in
ipfw add queue 627 udp from "table(27)" to not "table(127)" via igb1 in
этот конфиг работает на 100 клиентов отлично. Но когда количество активных клиентов возрастает до 1500, интернетом пользоваться невозможно - скорость в разы ниже указанной в настройках труб. Подскажите, куда копать? Сервер - два интерфейса intel igb, Freebsd 8.1 AMD64, Xeon E5520 (LGA1366), 6 Gb RAM. За сутки прокачивается примерно 1,25 Тб. Ширина аплинк-канала - 600 Мбит/с

Код: Выделить всё

systctl.conf

kern.maxfiles=65536
kern.maxfilesperproc=32768
kern.ipc.maxsockbuf=8388608
kern.ipc.maxsockets=16424
kern.ipc.somaxconn=8192
kern.ipc.nmbclusters=262144
net.graph.recvspace=256000
net.inet.flowtable.enable=0
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.ip.fw.autoinc_step=1
net.inet.ip.dummynet.hash_size=1024
net.inet.ip.fastforwarding=1
net.inet.tcp.rfc1323=1
net.inet.tcp.delayed_ack=0
net.inet.tcp.sendspace=262144
net.inet.tcp.recvspace=262144
net.inet.udp.recvspace=262144
net.inet.udp.maxdgram=57344
net.local.stream.recvspace=262144
net.local.stream.sendspace=262144
net.inet.ip.fw.dyn_buckets=1024
net.inet.ip.dummynet.io_fast=1

Хостинговая компания Host-Food.ru
Хостинг HostFood.ru
 

Услуги хостинговой компании Host-Food.ru

Хостинг HostFood.ru

Тарифы на хостинг в России, от 12 рублей: https://www.host-food.ru/tariffs/hosting/
Тарифы на виртуальные сервера (VPS/VDS/KVM) в РФ, от 189 руб.: https://www.host-food.ru/tariffs/virtualny-server-vps/
Выделенные сервера, Россия, Москва, от 2000 рублей (HP Proliant G5, Intel Xeon E5430 (2.66GHz, Quad-Core, 12Mb), 8Gb RAM, 2x300Gb SAS HDD, P400i, 512Mb, BBU):
https://www.host-food.ru/tariffs/vydelennyi-server-ds/
Недорогие домены в популярных зонах: https://www.host-food.ru/domains/

Аватара пользователя
hizel
дядя поня
Сообщения: 9032
Зарегистрирован: 2007-06-29 10:05:02
Откуда: Выборг

Re: DUMMYNET и ~ 1500 юзеров

Непрочитанное сообщение hizel » 2010-11-23 22:31:25

вы засовываете в одну трубу кучу клиентов, естественно они там помрут

надо же отрезать каждому клиенту нужную скорость?
тогда вместо:

Код: Выделить всё

ipfw pipe 101 config bw 80kbit/s
ipfw queue 101 config weight 5 pipe 101 queue 64 mask dst-ip 0xffffffff
внедрять

Код: Выделить всё

ipfw pipe 101 config bw 80kbit/s mask dst-ip 0xffffffff
и увеличить net.inet.ip.dummynet.hash_size или в каждому правиле выставлять buckets
В дурацкие игры он не играет. Он просто жуткий, чу-чу, паровозик, и зовут его Блейн. Блейн --- это Боль.

Аватара пользователя
hizel
дядя поня
Сообщения: 9032
Зарегистрирован: 2007-06-29 10:05:02
Откуда: Выборг

Re: DUMMYNET и ~ 1500 юзеров

Непрочитанное сообщение hizel » 2010-11-23 22:32:53

ого, нет у вас что-то похуже, но buckets нужно накинуть и ipfw pipe show оценить
В дурацкие игры он не играет. Он просто жуткий, чу-чу, паровозик, и зовут его Блейн. Блейн --- это Боль.

Lord3D
проходил мимо
Сообщения: 2
Зарегистрирован: 2010-11-23 20:25:33

Re: DUMMYNET и ~ 1500 юзеров

Непрочитанное сообщение Lord3D » 2010-11-23 23:02:22

то есть в любом случае придётся на каждого из приведённых 3661 клиентов создавать по собственному каналу? А если я хочу задавать приоритеты, то и по очереди?

Аватара пользователя
hizel
дядя поня
Сообщения: 9032
Зарегистрирован: 2007-06-29 10:05:02
Откуда: Выборг

Re: DUMMYNET и ~ 1500 юзеров

Непрочитанное сообщение hizel » 2010-11-23 23:20:09

нет вам dst-ip в pipe не подойдет

а в ipfw pipe show все ок?

имхо слишко много queue

у вас у клиента может быть более 1-ого ip? иначе не понятно зачем dst-ip в queue? или предполагается равномерное распределение по ip из интернета? oO
В дурацкие игры он не играет. Он просто жуткий, чу-чу, паровозик, и зовут его Блейн. Блейн --- это Боль.

rmn
старшина
Сообщения: 427
Зарегистрирован: 2008-10-03 18:52:02

Re: DUMMYNET и ~ 1500 юзеров

Непрочитанное сообщение rmn » 2010-11-24 11:18:05

dst-ip для пайпов входящего трафика
src-ip - для исходящего

в table(22) серые адреса:

Код: Выделить всё

gw1# ipfw show 2042 2043
02042  3914235320  3686673236969 pipe 43 ip from any to table(22) out // bezlim-4096-4096
02043  3679120069  2140425100710 pipe 44 ip from table(22) to any in // bezlim-4096-4096

gw1# ipfw pipe 43 show
00043:   4.096 Mbit/s    0 ms   80 sl. 63 queues (64 buckets)
          GRED w_q 0.001999 min_th 10 max_th 30 max_p 0.099991
    mask: 0x00 0x00000000/0x0000 -> 0xffffffff/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
  0 ip           0.0.0.0/0          10.10.8.84/0     1000536 1434025163  0    0 361
  1 ip           0.0.0.0/0          10.10.2.21/0     456658 466444452  0    0 360
...

gw1# ipfw pipe 44 show
00044:   4.096 Mbit/s    0 ms   80 sl. 35 queues (64 buckets)
          GRED w_q 0.001999 min_th 10 max_th 30 max_p 0.099991
    mask: 0x00 0xffffffff/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
  0 ip       10.10.7.101/0             0.0.0.0/0        6      627  0    0   0
  2 ip       10.10.2.196/0             0.0.0.0/0     20367  2810916  0    0   0
...

Аватара пользователя
hizel
дядя поня
Сообщения: 9032
Зарегистрирован: 2007-06-29 10:05:02
Откуда: Выборг

Re: DUMMYNET и ~ 1500 юзеров

Непрочитанное сообщение hizel » 2010-11-24 13:29:44

для каждого пользователя две трубы, в каждой трубе по две очереди, одна для udp, вторая для tcp
если у каждого пользователя только один ip, зачем в очередях dst-ip?

Код: Выделить всё

00043:   4.096 Mbit/s    0 ms   80 sl. 63 queues (64 buckets)
          GRED w_q 0.001999 min_th 10 max_th 30 max_p 0.099991
    mask: 0x00 0x00000000/0x0000 -> 0xffffffff/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
  0 ip           0.0.0.0/0          10.10.8.84/0     1000536 1434025163  0    0 361
  1 ip           0.0.0.0/0          10.10.2.21/0     456658 466444452  0    0 360
...
тут 4.096 Mbit/s делятся равномерно на все queue, если людей много то они в этих 4.096 Mbit/s помрут
Последний раз редактировалось hizel 2010-11-24 13:30:03, всего редактировалось 1 раз.
Причина: queue
В дурацкие игры он не играет. Он просто жуткий, чу-чу, паровозик, и зовут его Блейн. Блейн --- это Боль.

rmn
старшина
Сообщения: 427
Зарегистрирован: 2008-10-03 18:52:02

Re: DUMMYNET и ~ 1500 юзеров

Непрочитанное сообщение rmn » 2010-11-24 13:37:18

hizel писал(а):

Код: Выделить всё

00043:   4.096 Mbit/s    0 ms   80 sl. 63 queues (64 buckets)
          GRED w_q 0.001999 min_th 10 max_th 30 max_p 0.099991
    mask: 0x00 0x00000000/0x0000 -> 0xffffffff/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
  0 ip           0.0.0.0/0          10.10.8.84/0     1000536 1434025163  0    0 361
  1 ip           0.0.0.0/0          10.10.2.21/0     456658 466444452  0    0 360
...
тут 4.096 Mbit/s делятся равномерно на все queue, если людей много то они в этих 4.096 Mbit/s помрут
нет. Для каждого юзера динамически создается пайп в 4Mbit/s. Конфиг пайпов:

Код: Выделить всё

function IPFW_CreateTable($id, $down_speed, $up_speed, $comment='')
{
    $TableNum = $id + 1;
    $InPipeNum = $id * 2 + 1;
    $OutPipeNum = $InPipeNum + 1;

    $DownSpeed = $down_speed . "Kbit/s";
    $UpSpeed = $up_speed . "Kbit/s";

    global $IPFW_BaseRule;
    global $IPFW_QueueSize;
    global $IPFW_GREDConf;

    $InRuleNum= $IPFW_BaseRule + $id * 2;
    $OutRuleNum = $InRuleNum + 1;

    IPFW_RemoveTable($id);

    IPFW_Exec(" pipe " . $InPipeNum . " config bw " . $DownSpeed . " queue " . $IPFW_QueueSize . " mask dst-ip 0xffffffff gred " . $IPFW_GREDConf);

    IPFW_Exec(" pipe " . $OutPipeNum . " config bw " . $UpSpeed . " queue " . $IPFW_QueueSize . " mask src-ip 0xffffffff gred " . $IPFW_GREDConf);

    $c = '';

    if ($comment != '')
        $c = '// ' . $comment;

    IPFW_Exec(" add " . $InRuleNum . " pipe " . $InPipeNum . " ip from any to table\(" . $TableNum . "\) out " . $c);
    IPFW_Exec(" add " . $OutRuleNum . " pipe " . $OutPipeNum . " ip from table\(" . $TableNum . "\) to any in " . $c);
}

Аватара пользователя
hizel
дядя поня
Сообщения: 9032
Зарегистрирован: 2007-06-29 10:05:02
Откуда: Выборг

Re: DUMMYNET и ~ 1500 юзеров

Непрочитанное сообщение hizel » 2010-11-24 13:46:37

хз, кароче как у вас там устроено, но bucket-ов не хватает, добавьте
00043: 4.096 Mbit/s 0 ms 80 sl. 63 queues (64 buckets)
В дурацкие игры он не играет. Он просто жуткий, чу-чу, паровозик, и зовут его Блейн. Блейн --- это Боль.