IPFW + FreeBSD 8.1 (8.0)
Добавлено: 2010-07-26 9:03:31
Код: Выделить всё
freebsd# uname -a
FreeBSD freebsd.domen 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Thu Jul 22 13:40:39 UTC 2010 root@freebsd.domen:/usr/obj/usr/src/sys/SS25 i386Код: Выделить всё
freebsd# /etc/rc.d/ipfw start
Flushed all rules.
00100 allow ip from any to any via lo0
00200 deny ip from any to 127.0.0.0/8
00300 deny ip from 127.0.0.0/8 to any
Line 3: bad command `FwCMD="/sbin/ipfw"'
Firewall rules loaded.
freebsd#
/etc/rc.conf
Код: Выделить всё
gateway_enable="YES"
keymap="ua.koi8-u.shift.alt"
ifconfig_le0="inet xxx.xxx.xxx.xxx netmask 255.255.255.248"
ifconfig_le1="inet 192.168.2.240 netmask 255.255.255.0"
ifconfig_le2="inet 192.168.1.240 netmask 255.255.255.0"
defaultrouter="zzz.zzz.zzz.zzz"
hostname="freebsd.yy.yy.yy"
firewall_enable="YES"
firewall_type="/etc/firewall"
sshd_enable="YES"
mpd_enable="YES"
Код: Выделить всё
#!/bin/sh
FwCMD="/sbin/ipfw" #Строка на которую идет ругань почему не пойму
LanOut="le0"
LanIn1="le1"
LanIn2="le2"
LanVPN="ng0"
IpOut="xxx.xxx.xxx.xxx"
IpIn1="192.168.1.240"
IpIn2="192.168.2.240"
NetMask="24"
NetIn1="192.168.1.0"
NetIn2="192.168.2.0"
${FwCMD} -f flush
${FwCMD} add check-state
${FwCMD} add allow ip from any to any via lo0
${FwCMD} add deny ip from any to 127.0.0.0/8
${FwCMD} add deny ip from 127.0.0.0/8 to any
${FwCMD} add allow ip from any to any via ${LanIn1}
${FwCMD} add allow ip from any to any via ${LanIn2}
${FwCMD} add allow ip from any to any via ${LanVPN}
${FwCMD} add deny ip from any to any