Пришлось под ругань сотрудников перебирать строчки, но вроде как решилось, у мну заработало.
Код: Выделить всё
#!/bin/sh
ipfw -q -f flush
IPFW="ipfw add"
SKIP="skipto 800"
EXT="vr0"
INT="rl0"
${IPFW} 005 allow all from any to any via xl0
${IPFW} 010 allow all from any to any via lo0
${IPFW} 014 divert natd ip from any to any in via ${EXT}
${IPFW} 015 check-state
${IPFW} 16 allow ip from any to any via lo0
${IPFW} 18 allow ip from any to any via ${INT}
${IPFW} 020 ${SKIP} udp from any to any 53 via ${EXT}
${IPFW} 022 ${SKIP} udp from any 53 to any via ${EXT}
${IPFW} 040 ${SKIP} tcp from any to any 80 out via ${EXT} setup keep-state
${IPFW} 050 ${SKIP} tcp from any to any 443 out via ${EXT} setup keep-state
${IPFW} 060 ${SKIP} tcp from any to any 1433 out via ${EXT} setup keep-state
${IPFW} 060 ${SKIP} tcp from any to any 5190 out via ${EXT} setup keep-state
${IPFW} 080 ${SKIP} icmp from any to any out via ${EXT} keep-state
${IPFW} 110 ${SKIP} tcp from any to any 22 out via ${EXT} setup keep-state
${IPFW} 300 deny all from 192.168.0.0/16 to any in via ${EXT}
${IPFW} 301 deny all from 172.16.0.0/12 to any in via ${EXT}
${IPFW} 302 deny all from 10.0.0.0/8 to any in via ${EXT}
${IPFW} 303 deny all from 127.0.0.0/8 to any in via ${EXT}
${IPFW} 304 deny all from 0.0.0.0/8 to any in via ${EXT}
${IPFW} 305 deny all from 169.254.0.0/16 to any in via ${EXT}
${IPFW} 306 deny all from 192.0.2.0/24 to any in via ${EXT}
${IPFW} 307 deny all from 204.152.64.0/23 to any in via ${EXT}
${IPFW} 308 deny all from 224.0.0.0/3 to any in via ${EXT}
${IPFW} 315 deny tcp from any to any 113 in via ${EXT}
${IPFW} 330 deny all from any to any frag in via ${EXT}
${IPFW} 332 deny tcp from any to any established in via ${EXT}
${IPFW} 380 allow tcp from any to me 22 in via ${EXT} setup limit src-addr 2
${IPFW} 400 deny log all from any to any in via ${EXT}
${IPFW} 450 deny log all from any to any out via ${EXT}
${IPFW} 800 divert natd ip from any to any out via ${EXT}
${IPFW} 801 allow ip from any to any
${IPFW} 999 deny log all from any to any
Код: Выделить всё
firewall_enable="YES"
firewall_script="/путь/конфиг"
firewall_logging="YES"
natd_enable="YES"
natd_interface="карта"