How to you enable ipfw with logging?
Tested on FreeBSD 4.10
First you will have to recompile your kernel, which requires the source to be installed.
# cd /usr/src
# ls
If nothing is there, then you have to install it
# Place FreeBSD disk1 in the cd drive.
# /stand/sysinstall
Choose configure –> Distributions –> src (press enter) –> All –> exit –> OK –> CD/DVD –> Exit
# ls /usr/src
You should see files now.
# cd /usr/src/sys/i386/conf (If you are using i386!)
# mv GENERIC /root
# ln -s /root/GENERIC GENERIC (That way you will have a copy to remeber what you configured next time.)
# vi GENERIC
Find a good place to enter your new options. I usually /bpf and place right underneath there.
insert:
options IPFIREWALL_VERBOSE
options IPFIREWALL_FORWARD
options IPFIREWALL_VERBOSE_LIMIT=5
! Don’t change anything else unless you know what you are doing, and if so why are you reading this? !
Save and exit
# cd /usr/src
# make buildkernel KERNCONF=GENERIC
Take a smoke break
If everything went ok then,
# make installkernel KERNCONF=GENERIC
# vi /etc/rc.conf
Add to the bottom of the file,
firewall_enable=”YES”
firewall_type=”/usr/local/etc/rc.d/firewall”
Save and exit
cd /usr/local/etc/rc.d
vi firewall
At least add a rule to allow yourself back in
change remotemachine, localmachine, and dns-server(s) to your setup
example:
add 00100 allow tcp from remotemachine to localmachine 22
add 65000 allow ip from localmachine to any
add 65001 allow tcp from any to localmachine established
add 65002 allow udp from dns-server 53 to localmachine (Remember SSH won’t work without dns)
add 65003 allow icmp from any to localmachine ( If you want to be able to ping your box )
save and exit
Edit your /etc/syslog.conf and configure syslog to log ipfw messages. (Check another howto for this)
Edit your /etc/newsyslog.conf and configure it to roll your firewall logs
# cd /var/log
# touch whatever-you-called-your-log-file.log
# chmod 600 whatever-you-called-your-log-file.log
Cross you fingers and,
# shutdown -r now
|