Lambert 5 Posted 2006-10-12 15:51:08 Share Posted 2006-10-12 15:51:08 Несколько не по эхотагу топик, но все же, может сталкивался кто.. дано: домашняя локальная сеть, гейт в мир на FreeBSD 5.3 транспарентный прокси, старгейзер, разделение Украина/мир Завелось в локалке пару сосунов, что в прайм-тайм кладут канал напрочь, не пробиться. Уже как-то в пылу бешенства пару раз выключал коммутатор Кто-нибудь заморачивался регулятором скорости? Какими путями решали вопрос? Сквидовые delay-pools работают несколько.. эээ.. непонятно. Если вообще работают Link to post Share on other sites
Pit 35 Posted 2006-10-12 16:29:51 Share Posted 2006-10-12 16:29:51 pf, накрайняк ipfw pipe заюзать gred red шняги. Link to post Share on other sites
Lambert 5 Posted 2006-10-12 16:40:59 Author Share Posted 2006-10-12 16:40:59 пробовал использовать ipfw pipe резать оно вроде как и режет, но пинг сервера вырастает порой до 2 секунд убираю шейпер в конфиге файрволла - нормально, 1 мс включаю - с любой машины в локалке пинг до сервера не меньше секунды непонятно, что его так грузит. проца вроде б должно быть достаточно Link to post Share on other sites
Pit 35 Posted 2006-10-12 16:56:26 Share Posted 2006-10-12 16:56:26 а ты не качай когда пингуеш. Link to post Share on other sites
Lambert 5 Posted 2006-10-12 18:54:59 Author Share Posted 2006-10-12 18:54:59 а ты не качай когда пингуеш. не качаю. вообще никаких обращений к серверу нет попытка пинга - и дикое время отклика закачка чего-либо идет так же с глюками такое впечатление, что этот шейпер так и работает, через временнЫе задержки а delay pools в сквиде непонятно как на скорость настраивать, я ему указываю 128К отдавать на такой IP - а прокачка как была 512, так и остается ставлю 64 - все падает до 48К где мои руки кривы - не могу понять Link to post Share on other sites
Den_LocalNet 1,474 Posted 2006-10-12 19:38:31 Share Posted 2006-10-12 19:38:31 правильно настроенный шейпер дает задержку паразитную - 10мс я пересобрал с девайс_пулинг и ХЗ=1000 и зпдержка пропала совсем скинь сюда ipfw pipe show когда создашь пайпы - посмотрим ну и конфиг тоже сюда пуляй поглядим Link to post Share on other sites
Pit 35 Posted 2006-10-12 20:29:41 Share Posted 2006-10-12 20:29:41 покажи как ты описываеш правила шейпера, и какие айпи попадают в шейп (честные или из фейкового блока) Link to post Share on other sites
Lambert 5 Posted 2006-10-14 01:41:31 Author Share Posted 2006-10-14 01:41:31 ОК, вот rc.firewall #!/bin/sh - # Suck in the configuration variables. if [ -z "${source_rc_confs_defined}" ]; then if [ -r /etc/defaults/rc.conf ]; then . /etc/defaults/rc.conf source_rc_confs elif [ -r /etc/rc.conf ]; then . /etc/rc.conf fi fi fwcmd="/sbin/ipfw" setup_loopback () { ############ # Only in rare cases do you want to change these rules # ${fwcmd} add 100 pass all from any to any via lo0 ${fwcmd} add 200 deny all from any to 127.0.0.0/8 ${fwcmd} add 300 deny ip from 127.0.0.0/8 to any } ############ # Flush out the list before we begin. # ${fwcmd} -f flush ${fwcmd} -f pipe flush ############ # If you just configured ipfw in the kernel as a tool to solve network # problems or you just want to disallow some particular kinds of traffic # then you will want to change the default policy to open. You can also # do this as your only action by setting the firewall_type to ``open''. # # ${fwcmd} add 65000 pass all from any to any # set these to your outside interface network and netmask and ip oif="xl0" onet="193.201.0.0" omask="255.255.255.240" oip="193.201.160.145" # set these to your inside interface network and netmask and ip iif="xl1" inet="192.168.0.0" imask="255.255.255.0" iip="192.168.0.1" setup_loopback # Traffic Shaper ${fwcmd} pipe 1 config bw 256000bit/s ${fwcmd} queue 1 config pipe 1 weight 50 mask dst-ip 0x00000000 ${fwcmd} add queue 1 ip from any to 192.168.0.12 out ${fwcmd} pipe 1 config bw 256000bit/s ${fwcmd} queue 1 config pipe 1 weight 50 mask dst-ip 0x00000000 ${fwcmd} add queue 1 ip from any to 192.168.0.14 out ${fwcmd} pipe 1 config bw 128000bit/s ${fwcmd} queue 1 config pipe 1 weight 50 mask dst-ip 0x00000000 ${fwcmd} add queue 1 ip from any to 192.168.0.16 out ${fwcmd} pipe 1 config bw 128000bit/s ${fwcmd} queue 1 config pipe 1 weight 50 mask dst-ip 0x00000000 ${fwcmd} add queue 1 ip from any to 192.168.0.18 out # ${fwcmd} pipe 1 config bw 256000bit/s # ${fwcmd} queue 1 config pipe 1 weight 50 mask dst-ip 0x00000000 # ${fwcmd} add queue 1 ip from any to 192.168.0.0/24 out #via ${oif} # # Stop spoofing ${fwcmd} add deny all from ${inet}:${imask} to any in via ${oif} ${fwcmd} add deny all from ${onet}:${omask} to any in via ${iif} # Stop RFC1918 nets on the outside interface ${fwcmd} add deny all from any to 10.0.0.0/8 via ${oif} ${fwcmd} add deny all from any to 172.16.0.0/12 via ${oif} ${fwcmd} add deny all from any to 192.168.0.0/16 via ${oif} # Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1, # DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E) # on the outside interface ${fwcmd} add deny all from any to 0.0.0.0/8 via ${oif} ${fwcmd} add deny all from any to 169.254.0.0/16 via ${oif} ${fwcmd} add deny all from any to 192.0.2.0/24 via ${oif} ${fwcmd} add deny all from any to 224.0.0.0/4 via ${oif} ${fwcmd} add deny all from any to 240.0.0.0/4 via ${oif} # Transparent proxy ${fwcmd} add fwd 127.0.0.1,3128 tcp from 192.168.0.0/24 to any 80 in via ${iif} # Network Address Translation ${fwcmd} add divert natd all from any to any via ${natd_interface} # Stop RFC1918 nets on the outside interface ${fwcmd} add deny all from 10.0.0.0/8 to any via ${oif} ${fwcmd} add deny all from 172.16.0.0/12 to any via ${oif} ${fwcmd} add deny all from 192.168.0.0/16 to any via ${oif} # Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1, # DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E) # on the outside interface ${fwcmd} add deny all from 0.0.0.0/8 to any via ${oif} ${fwcmd} add deny all from 169.254.0.0/16 to any via ${oif} ${fwcmd} add deny all from 192.0.2.0/24 to any via ${oif} ${fwcmd} add deny all from 224.0.0.0/4 to any via ${oif} ${fwcmd} add deny all from 240.0.0.0/4 to any via ${oif} # Allow TCP through if setup succeeded ${fwcmd} add pass tcp from any to any established # Allow IP fragments to pass through ${fwcmd} add pass all from any to any frag # Allow setup of incoming email ${fwcmd} add pass tcp from any to ${oip} 25 setup ..... Link to post Share on other sites
Den_LocalNet 1,474 Posted 2006-10-14 07:40:19 Share Posted 2006-10-14 07:40:19 гггг номера пайпов меняй а то всех людей загнал в один пайп вот как у меня: #128k ipfw pipe 128 config bw 128Kbit mask dst-ip 0XFFFFFFFF ipfw pipe 129 config bw 128Kbit mask src-ip 0XFFFFFFFF ipfw add 521 pipe 128 ip from any to 10.10.10.10 ipfw add 521 pipe 129 ip from 10.10.10.10 to any ipfw add 521 pipe 128 ip from any to 10.10.10.11 ipfw add 521 pipe 129 ip from 10.10.10.11 to any ipfw add 521 pipe 128 ip from any to 10.10.10.12 ipfw add 521 pipe 129 ip from 10.10.10.12 to any Вот так выходит отдельный шейп по 128к на каждого. Link to post Share on other sites
Pit 35 Posted 2006-10-14 08:06:03 Share Posted 2006-10-14 08:06:03 ${fwcmd} pipe 2 config mask dst-ip 0x000000ff bw 128Kbit/s queue 10 gred 0.002/8/24/0.1 queue и gred повкусу, читать доку до просветления gred red. А также смотреть на кол-во дропов, и пытаться подобрать значения queue и gred. Link to post Share on other sites
Xeddin 0 Posted 2006-10-14 10:11:26 Share Posted 2006-10-14 10:11:26 пайпы делят очередь как бы статически, и если канал 1 Мбити и юзеров 8, то можно дать каждому по 128 К, а если добавился 9-й юзер и все 9 одновременно что-то качают, тогда начнется неравномерное распределение канала. Подскажите, как можно динамически шейпить канал? Link to post Share on other sites
Amal 0 Posted 2006-10-14 14:18:10 Share Posted 2006-10-14 14:18:10 т.е. если есть жирный канал, а нескольким юзерам надо анлим и чтоб они сильно не "закачались" им можно урезать канал с помошью pipe а всем остальным ничего не делать. Тогда получиться юзер с pipe получит не более чем, например, 128К, а всем остальным то что осталось от канала. Link to post Share on other sites
Lambert 5 Posted 2006-10-14 17:31:27 Author Share Posted 2006-10-14 17:31:27 Server# ipfw pipe show 00001: 128.000 Kbit/s 0 ms 50 sl. 4 queues (64 buckets) droptail mask: 0x00 0x00000000/0x0000 -> 0xffffffff/0x0000 BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp 2 ip 0.0.0.0/0 192.168.0.18/0 201 181243 6 3559 0 17 ip 0.0.0.0/0 192.168.0.1/0 137 17111 0 0 0 28 ip 0.0.0.0/0 192.168.0.12/0 2 171 0 0 0 48 ip 0.0.0.0/0 205.188.1.136/0 2 80 0 0 0 00002: 128.000 Kbit/s 0 ms 50 sl. 0 queues (64 buckets) droptail mask: 0x00 0xffffffff/0x0000 -> 0x00000000/0x0000 Server# вот так оно выглядит Link to post Share on other sites
Pit 35 Posted 2006-10-14 19:39:27 Share Posted 2006-10-14 19:39:27 Можно сделать 1 большую трубу, и установить приоритет, например пришел VIP и схавал 90 процентов канала всем остальным осталось 10 процентов, VIP свалил, все поделили канал поровну, и тд. Link to post Share on other sites
Xeddin 0 Posted 2006-10-15 17:59:19 Share Posted 2006-10-15 17:59:19 и самый главный вопрос: как это прописать для ipfw ??? Сколько доков читаю, не могу понять Link to post Share on other sites
Pit 35 Posted 2006-10-15 18:10:10 Share Posted 2006-10-15 18:10:10 ${fwcmd} pipe 1 config bw 30Mbit/s ${fwcmd} queue 1 config pipe 1 weight 50 mask dst-ip 0x000000ff ${fwcmd} queue 2 config pipe 1 weight 90 mask dst-ip 0x000000ff и тд. добавить в sysctl.conf net.inet.ip.fw.one_pass=0 net.inet.ip.dummynet.expire=0 Link to post Share on other sites
Lambert 5 Posted 2006-10-16 14:34:57 Author Share Posted 2006-10-16 14:34:57 правильно настроенный шейпер дает задержку паразитную - 10мся пересобрал с девайс_пулинг и ХЗ=1000 и зпдержка пропала совсем скинь сюда ipfw pipe show когда создашь пайпы - посмотрим ну и конфиг тоже сюда пуляй поглядим "я пересобрал с девайс_пулинг и ХЗ=1000 и зпдержка пропала совсем" А можно точнее, как эти опции ядра называются? покопался в FAQе по BSD - ничего не нашел... Link to post Share on other sites
Den_LocalNet 1,474 Posted 2006-10-16 16:03:28 Share Posted 2006-10-16 16:03:28 Я вот что добавлял вообще: options IPFIREWALL options IPFIREWALL_VERBOSE options IPFIREWALL_FORWARD options IPDIVERT options IPFILTER options IPFILTER_LOG options DUMMYNET options QUOTA options DEVICE_POLLING options HZ=1000 Link to post Share on other sites
Lambert 5 Posted 2006-10-16 16:48:03 Author Share Posted 2006-10-16 16:48:03 Принято. Спасибо, Ден! Link to post Share on other sites
Kucher2 122 Posted 2006-10-17 02:25:24 Share Posted 2006-10-17 02:25:24 Делаю так: ipfw pipe 1 config bw 31KB ipfw queue 1 config pipe 1 weight 10 mask dst-ip 0xffffffff ipfw queue 2 config pipe 1 weight 90 mask dst-ip 0xffffffff ipfw add 350 queue 2 ip from any to 10.0.0.1 via rl0 ipfw add 360 queue 2 ip from 10.0.0.1 to any via rl0 ipfw add 370 queue 1 ip from any to 10.0.0.3 via rl0 ipfw add 380 queue 1 ip from 10.0.0.3 to any via rl0 Где rl0 - внутренний ИФ, 10.0.0.1 - моя машина, 10.0.0.3 - машина, на которой идёт закачка музыки. При этом я играю в он-лайн игру, где важен низкий пинг ну и скорость не менее 64К. Трагедия в том, что вроде всё верно, а игра страшно лагает, када 10.0.0.3 качает или лазает по сайтам. Где могут быть грабли? Link to post Share on other sites
Pit 35 Posted 2006-10-17 04:23:35 Share Posted 2006-10-17 04:23:35 поставь приоритет на порт игры. ipfw pipe 1 config bw 31KB Это ширена всей трубы, и эта скорость делится на всех. Link to post Share on other sites
Kucher2 122 Posted 2006-10-17 08:41:42 Share Posted 2006-10-17 08:41:42 поставь приоритет на порт игры. ipfw pipe 1 config bw 31KB Это ширена всей трубы, и эта скорость делится на всех. Со скоростью понятно. Но почему всё же лагает при активности второй машины? :\ Всё-таки 256Кбит/с вместо 64 Кбит/с положеных. И зачем на порт? Стоит же приоритет на конкретный адрес. Она ж должна "всё бросить и идти сюда". Пробовал приоритет на адрес игрового сервера, но адреса меняются от локтации к локтации, а перечня адресов игровых серверов Ragnarok они не выкладывают, да и эффект в общем-то тот же. Т.е. никакого. Хм. :/ Ведь по идее можно было бы делать pipe на внешнем ИФ для конкретного адреса и должно всё так же работать, как и для внутреннего? Вообще рекомендуется pipe для адресов внутренней подсети и это мне кажется правильным... Link to post Share on other sites
Xeddin 0 Posted 2006-10-21 10:46:43 Share Posted 2006-10-21 10:46:43 ${fwcmd} pipe 1 config bw 30Mbit/s ${fwcmd} queue 1 config pipe 1 weight 50 mask dst-ip 0x000000ff ${fwcmd} queue 2 config pipe 1 weight 90 mask dst-ip 0x000000ff и тд. добавить в sysctl.conf net.inet.ip.fw.one_pass=0 net.inet.ip.dummynet.expire=0 т.е. если у меня канал, допустим, 3 Мб и 3 юзеров, с адресами 10.0.0.1, 10.0.0.2, 10.0.0.3, то для равномерного распределения файрвол будет выглядеть так? ${fwcmd} pipe 1 config bw 3Mbit/s ${fwcmd} queue 1 config pipe 1 weight 50 mask dst-ip 0x000000ff ipfw add queue 1 ip from any to 10.0.0.1 via rl0 ipfw add queue 1 ip from 10.0.0.1 to any via rl0 ipfw add queue 1 ip from any to 10.0.0.2 via rl0 ipfw add queue 1 ip from 10.0.0.2 to any via rl0 ipfw add queue 1 ip from any to 10.0.0.3 via rl0 ipfw add queue 1 ip from 10.0.0.3 to any via rl0 Link to post Share on other sites
Pit 35 Posted 2006-10-21 11:05:58 Share Posted 2006-10-21 11:05:58 Угу. Link to post Share on other sites
Xeddin 0 Posted 2006-10-22 19:11:32 Share Posted 2006-10-22 19:11:32 канал у меня АДСЛ 1024/512 Кбит/с Сделал так: ${fwcmd} pipe 1 config bw 1024Kbit/s queue 5 ${fwcmd} pipe 2 config bw 512Kbit/s queue 5 ${fwcmd} queue 10 config pipe 1 weight 50 mask src-ip 0x000000ff ${fwcmd} queue 20 config pipe 2 weight 50 mask dst-ip 0x000000ff ipfw add queue 10 ip from any to 10.0.0.1 in via rl0 ipfw add queue 20 ip from 10.0.0.1 to any out via rl0 ipfw add queue 10 ip from any to 10.0.0.2 in via rl0 ipfw add queue 20 ip from 10.0.0.2 to any out via rl0 ipfw add queue 10 ip from any to 10.0.0.3 in via rl0 ipfw add queue 20 ip from 10.0.0.3 to any out via rl0 после этих правил идет натд как только кто-то начинает качать, сразу огромные пинги, около 1000 мс. что неправильно??? руководствовался этим и предыдущими постами Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now