How to load the IPFW rules
-
Copy your
ipfw.rulesinside /etc/$ cp ipfw.rules /etc/Note: Be sure the rules don’t have \r\n lines (CRLN windows lines), but only \n lines (Unix LN lines), otherwise you get locked out!
-
Open
/etc/rc.conf:$ ee /etc/rc.conf -
Edit/Add these options:
# IPFW firewall_enable="YES" firewall_type="open" firewall_script="/etc/ipfw.rules" firewall_logging="YES"Note: For testing, set the
firewall_enableto “NO” -
Start the ipfw service:
$ service ipfw startNote: if
firewall_enableis set to “NO”, you should useonestart|onestop|onerestartinstead ofstart|stop|restart
If you’re afraid of getting locked out, you can try this way:
- Use the
firewall_enable="NO"option inside/etc/rc.conf - Start the service with the command
service ipfw onestart && sleep 60 && service ipfw onestop &(ipfw will be stopped after 60 seconds)