Код: Выделить всё
#!/bin/sh
fwcmd="/sbin/ipfw -q"
ipfw -f flush
ipfw -f pipe flush
ipfw -f queue flush
ipfw table  all flush
ipfw add 101 allow all from any to any via lo0
ipfw add 102 deny all from any to 127.0.0.0/8
ipfw add 103 deny all from 127.0.0.0/8 to any
ipfw nat 1 config if $exit_if same_ports log
ipfw add 200 nat 1  ip from 192.168.0.0/16 to any via $exit_if
ipfw add 210 nat 1  ip from any to me via $exit_if
ipfw add 300 allow all from 192.168.0.0/16 to 192.168.0.0/16
ipfw pipe 1000 config bw 1024Kbit/s mask src-ip 0xffffffff
ipfw pipe 1001 config bw 1024Kbit/s mask dst-ip 0xffffffff
ipfw table 1 add 192.168.210.101 1
ipfw add 1000 pipe tablearg  all from "table(1)" to any in via $intofffice
ipfw add 1001 pipe tablearg  all from any to "table(1)" out via $intofffice
Код: Выделить всё
ipfw add 1000 pipe tablearg  all from "table(1)" to any in via $intofffice
ipfw add 1001 pipe tablearg  all from any to "table(1)" out via $intoffficeСписок загруженных правил:
Код: Выделить всё
# ipfw show
00101    0      0 allow ip from any to any via lo0
00102    0      0 deny ip from any to 127.0.0.0/8
00103    0      0 deny ip from 127.0.0.0/8 to any
00200    0      0 nat 1 log  ip from 192.168.0.0/16 to any via $exit_if
00210    0      0 nat 1 log  ip from any to me via $exit_if
00300   68   5760 allow ip from 192.168.0.0/16 to 192.168.0.0/16
01000    1     60 pipe tablearg  ip from table(1) to any in via $officevlan
01001    0      0 pipe tablearg 0 ip from any to table(1) out via $officevlan
65535 2829 514336 allow ip from any to any
#Код: Выделить всё
net.inet.ip.fw.one_pass: 1

