Pa3yM 29 мар 2007, 21:42
Очень просто граничить по скоростям....
Ставишь FREEBSD и в фаирволе прописываешь для юзеров свои каналы, со своими скоростями.
#!/bin/sh -
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
setup_loopback () {
${fwcmd} add pass all from any to any via lo0
${fwcmd} add deny all from any to 127.0.0.0/8
${fwcmd} add deny ip from 127.0.0.0/8 to any
${fwcmd} add deny udp from any 137,138,139 to any via xl0
${fwcmd} add deny tcp from any 137,138,139 to any via xl0
${fwcmd} add deny tcp from any 135,369,445 to any via xl0
${fwcmd} add deny udp from any 135,369,445 to any via xl0
}
if [ -n "${1}" ]; then
firewall_type="${1}"
fi
case ${firewall_quiet} in
[Yy][Ee][Ss])
fwcmd="/sbin/ipfw -q"
;;
*)
fwcmd="/sbin/ipfw"
;;
esac
${fwcmd} -f flush
setup_loopback
${fwcmd} add reject icmp from any to me icmptype 5,9,10,13,14,17,18
${fwcmd} add deny tcp from any 1048 to any
${fwcmd} add deny udp from any 1048 to any
case ${natd_enable} in
[Yy][Ee][Ss])
if [ -n "${natd_interface}" ]; then
${fwcmd} add divert natd all from any to any via ${natd_interface}
fi
;;
esac
${fwcmd} add reject all from 192.168.0.0/16 to any via ed0
${fwcmd} add reject all from 172.16.0.0/12 to any via ed0
${fwcmd} add reject all from 10.0.0.0/8 to any via ed0
${fwcmd} add reject all from 0.0.0.0/8 to any via ed0
#------------------ USER
${fwcmd} add allow all from 192.168.0.2 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.3 to any via xl0
#------------------ USER
#${fwcmd} add allow all from 192.168.0.4 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.5 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.6 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.7 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.8 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.9 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.10 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.11 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.12 to any via xl0
#------------------File_Server
#${fwcmd} add allow all from 192.168.0.13 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.14 to any via xl0
#------------------ USER
${fwcmd} add allow all from 192.168.0.15 to any via xl0
#------------------USER
${fwcmd} add allow all from 192.168.0.16 to any via xl0
#Drug
${fwcmd} add allow all from 192.168.0.17 to any via xl0
#Dima
${fwcmd} add allow all from 192.168.0.18 to any via xl0
#${fwcmd} add allow all from 192.168.0.19 to any via xl0
#${fwcmd} add allow all from 192.168.0.20 to any via xl0
client="192.168.0.17,192.168.0.18,192.168.0.5"
mold1="89.33.0.0/22,89.28.0.0/17,89.187.32.0/19,89.149.64.0/18,87.255.64.0/19,87.248.160.0/19,86.124.160.0/24,86.106.224.0/19,86.106.208.0/20,86.104.240.0/22,83.218.192.0/19,82.198.16.0/23,81.180.64.0/20,80.97.59.0/24"
mold2="80.97.57.0/24,80.97.56.0/24,217.26.174.0/24,217.26.172.0/24,217.26.170.0/24,217.26.168.0/24,217.26.166.0/24,217.26.162.0/24,217.26.160.0/24,217.26.160.0/20,217.26.159.0/24,217.26.158.0/24,217.26.157.0/24"
mold3="217.26.155.0/24,217.26.154.0/24,217.26.153.0/24,217.26.152.0/24,217.26.151.0/24,217.26.150.0/24,217.26.144.0/20,217.156.5.0/24,217.12.112.0/20,212.56.192.0/19,212.0.211.0/24,212.0.210.0/24,212.0.198.0/24"
mold4="212.0.192.0/19,195.22.224.0/19,195.170.178.0/24,195.138.99.0/24,195.138.98.0/24,195.138.97.0/24,195.138.96.0/24,195.138.96.0/20,195.138.126.0/23,195.138.124.0/23,195.138.120.0/23,195.138.118.0/23"
mold5="195.138.103.0/24,195.138.102.0/24,195.138.101.0/24,195.138.100.0/24,194.102.152.0/23,193.84.183.0/24,193.243.132.0/24,193.243.132.0/24,193.239.182.0/23,193.226.65.0/24,193.226.64.0/24,192.168.0.0/16"
mold6="212.0.197.0/24,217.26.156.0/24,80.97.58.0/24,195.138.107.0/24,172.16.0.0/16,11.0.0.0/8,10.0.0.0/8,1.0.0.0/8"
${fwcmd} pipe 1 config bw 1300kbit/s
${fwcmd} add pipe 1 ip from ${client} to ${mold1}
${fwcmd} add pipe 1 ip from ${mold1} to ${client}
${fwcmd} add pipe 1 ip from ${client} to ${mold2}
${fwcmd} add pipe 1 ip from ${mold2} to ${client}
${fwcmd} add pipe 1 ip from ${client} to ${mold3}
${fwcmd} add pipe 1 ip from ${mold3} to ${client}
${fwcmd} add pipe 1 ip from ${client} to ${mold4}
${fwcmd} add pipe 1 ip from ${mold4} to ${client}
${fwcmd} add pipe 1 ip from ${client} to ${mold5}
${fwcmd} add pipe 1 ip from ${mold5} to ${client}
${fwcmd} add pipe 1 ip from ${client} to ${mold6}
${fwcmd} add pipe 1 ip from ${mold6} to ${client}
#${fwcmd} pipe 2 config bw 128kbit/s
#${fwcmd} add pipe 2 ip from 192.168.0.2 to any
#${fwcmd} add pipe 2 ip from any to 192.168.0.2
${fwcmd} pipe 3 config bw 6500kbit/s
${fwcmd} add pipe 3 ip from 192.168.0.3 to any
${fwcmd} add pipe 3 ip from any to 192.168.0.3
#${fwcmd} pipe 4 config bw 4000kbit/s
#${fwcmd} add pipe 4 ip from 192.168.0.4 to any
#${fwcmd} add pipe 4 ip from any to 192.168.0.4
${fwcmd} pipe 5 config bw 110kbit/s
${fwcmd} add pipe 5 ip from 192.168.0.5 to any
${fwcmd} add pipe 5 ip from any to 192.168.0.5
${fwcmd} pipe 6 config bw 5000kbit/s
${fwcmd} add pipe 6 ip from 192.168.0.6 to any
${fwcmd} add pipe 6 ip from any to 192.168.0.6
${fwcmd} pipe 7 config bw 6500kbit/s
${fwcmd} add pipe 7 ip from 192.168.0.7 to any
${fwcmd} add pipe 7 ip from any to 192.168.0.7
${fwcmd} pipe 8 config bw 6500kbit/s
${fwcmd} add pipe 8 ip from 192.168.0.8 to any
${fwcmd} add pipe 8 ip from any to 192.168.0.8
#${fwcmd} pipe 9 config bw 64kbit/s
#${fwcmd} add pipe 9 ip from 192.168.0.9 to any
#${fwcmd} add pipe 9 ip from any to 192.168.0.9
#${fwcmd} pipe 10 config bw 64kbit/s
#${fwcmd} add pipe 10 ip from 192.168.0.10 to any
#${fwcmd} add pipe 10 ip from any to 192.168.0.10
${fwcmd} pipe 11 config bw 6500kbit/s
${fwcmd} add pipe 11 ip from 192.168.0.11 to any
${fwcmd} add pipe 11 ip from any to 192.168.0.11
#${fwcmd} pipe 12 config bw 2000kbit/s
#${fwcmd} add pipe 12 ip from 192.168.0.12 to any
#${fwcmd} add pipe 12 ip from any to 192.168.0.12
#${fwcmd} pipe 13 config bw 160kbit/s
#${fwcmd} add pipe 13 ip from 192.168.0.13 to any
#${fwcmd} add pipe 13 ip from any to 192.168.0.13
#Maximus
${fwcmd} pipe 14 config bw 5000kbit/s
${fwcmd} add pipe 14 ip from 192.168.0.14 to any
${fwcmd} add pipe 14 ip from any to 192.168.0.14
#Novitskii
${fwcmd} pipe 15 config bw 6000kbit/s
${fwcmd} add pipe 15 ip from 192.168.0.15 to any
${fwcmd} add pipe 15 ip from any to 192.168.0.15
#Valik
${fwcmd} pipe 16 config bw 6500kbit/s
${fwcmd} add pipe 16 ip from 192.168.0.16 to any
${fwcmd} add pipe 16 ip from any to 192.168.0.16
#Drug
${fwcmd} pipe 17 config bw 300kbit/s
${fwcmd} add pipe 17 ip from 192.168.0.17 to any
${fwcmd} add pipe 17 ip from any to 192.168.0.17
#Dima
${fwcmd} pipe 18 config bw 256kbit/s
${fwcmd} add pipe 18 ip from 192.168.0.18 to any
${fwcmd} add pipe 18 ip from any to 192.168.0.18
#${fwcmd} pipe 19 config bw 160kbit/s
#${fwcmd} add pipe 19 ip from 192.168.0.19 to any
#${fwcmd} add pipe 19 ip from any to 192.168.0.19
#${fwcmd} pipe 20 config bw 64kbit/s
#${fwcmd} add pipe 20 ip from 192.168.0.20 to any
#${fwcmd} add pipe 20 ip from any to 192.168.0.20
${fwcmd} add allow all from 192.168.0.1 to 192.168.0.9 via xl0
${fwcmd} add reject all from 192.168.0.0/24 to any via xl0
${fwcmd} add reject log tcp from any to me dst-port 1-3000 via ed0
${fwcmd} add deny log from any to any
Тут кстати сразу и молдавский инет отдельно и отдельно внешка. У кажого в итоге свой канал и своя скорость. Единственное, что у меня трабла с разграничением аплоада и даунлоада...В этом фаире общие каналы на плоад и даунлоад. Разбираюсь как разделить, точнее я уже разделял, но почему-то не работало.