IPFW on FreeBSD 7

Prerequisites:

FreeBSD (Base + Autoconf, Automake, Bash and GCC)
Kernel Options

IP Firewall built in to FreeBSD

# Note: IPFW requires that you have compiled some specific kernel options

# Edit /etc/rc.conf file
vi /etc/rc.conf
 




# Edit /etc/ipfw.rules
vi /etc/ipfw.rules

 

# Comment out biff (comsat) (if you are not using it, you probably are not using it)
vi /etc/services



# Uncomment auth
vi /etc/inetd.conf

 

# Commands to note:
ipfw show
sockstat -4
ipfw zero
more /var/log/ipfw.today
tail /var/log/dmesg.today


# References and thanks to:
#     http://www.onlamp.com/pub/a/bsd/2001/04/25/FreeBSD_Basics.html
#     http://www.onlamp.com/pub/a/bsd/2001/05/09/FreeBSD_Basics.html
#    
http://www.freebsd.org/cgi/man.cgi?query=ipfw&apropos=0&sektion=0&manpath=FreeBSD+6.2-RELEASE&format=html

 

# Note: Webmin's rule editor breaks the rule file - it forgets to put "add" starting each line

# Also: You may now see messages in /var/log/messages like this:
# Aug 15 19:54:44 nms kernel: Connection attempt to TCP 127.0.0.1:111 from 127.0.0.1:864 flags:0x02
# Since you probably don't have RPC running for NFS use on TCP port 111 you can ignore these.
# If you had RPC running, you wouldn't see these "log in vain" messages.
# "Log in vain" messages show connection attempts on ports where you do not currently have services running