Код: Выделить всё
#!/bin/sh
ipfw -q flush
c="/sbin/ipfw -q"
inet="xl0"
lan="fxp0"
inet_ip="10.10.40.2"
$c add allow ip from any to any via lo0
$c add 64900 deny all from 192.168.0.0/16 to any via fxp0
$c add 65000 divert 8668 ip from 192.168.0.0/16 to any out via ${inet}
$c add 65100 divert 8668 ip from any to ${inet_ip} in via ${inet}
$c add 65200 allow ip from any to any
#table config
$c table 1 flush
$c table 1 add 172.16.22.0/24
$c table 64 flush
$c table 64 add 192.168.3.0/24
$c table 28 flush
$c table 28 add 192.168.2.0/24
$c table 56 flush
$c table 56 add 192.168.1.0/24
$c table 12 flush
$c table 12 add 192.168.0.0/24
#config pipe
$c pipe flush
$c add 65110 pipe 64 ip from not table\(1\) to table\(64\) out
$c add 65120 pipe 28 ip from not table\(1\) to table\(28\) out
$c add 65130 pipe 56 ip from not table\(1\) to table\(56\) out
$c add 65140 pipe 12 ip from not table\(1\) to table\(12\) out
$c pipe 64 config mask dst-ip 0xffffffff bw 64kbit/s
$c pipe 28 config mask dst-ip 0xffffffff bw 128kbit/s
$c pipe 56 config mask dst-ip 0xffffffff bw 256kbit/s
$c pipe 12 config mask dst-ip 0xffffffff bw 512kbit/s
Код: Выделить всё
00100 886232 89265954 allow ip from any to any via lo0
05041 0 0 skipto 65000 ip from 192.168.0.2 to any
05041 0 0 skipto 65000 ip from any to 192.168.0.2
64900 153 15160 deny ip from 192.168.0.0/16 to me via fxp0
65000 1145023 145921398 divert 8668 ip from 192.168.0.0/16 to any out via xl0
65100 9668859 6065553214 divert 8668 ip from any to 10.10.40.2 in via xl0
65110 0 0 pipe 64 ip from not table(1) to table(64) out
65120 6068817 3114132049 pipe 28 ip from not table(1) to table(28) out
65130 59443 38771442 pipe 56 ip from not table(1) to table(56) out
65140 2609302 2814726238 pipe 12 ip from not table(1) to table(12) out
65200 133592827 22438365851 allow ip from any to any
65535 15 1410 deny ip from any to any