Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am a Linux user and very new to OSX. I have an OSX 10.7.5 "Lion" server that I am configuring as a webserver. I only have shell access.

I am tryin to configure the firewall, but ipfw is quite different from iptables. Currently, all ports are open to the world. I would like to add the following rules:

  • port 80/443: allow incoming connections from any IP address.
  • anything else: only allow incoming connections from within current subnet.

How would I accomplish this with ipfw?

share|improve this question
If you you can use Server Admin Tools, it would be much easier to achieve what you need. If you really want to use the command line, here are some starting points (can't write a complete answer as I can't test it right now): for firewall rules you can use any FreeBSD IPFW manual, keep in mind that ipfw is /sbin/ipfw on OS X. However, setting up the rules to load on startup requires for example setting StartupItems (as at the bottom of ibiblio.org/macsupport/ipfw). And make sure that the rules that you set up don't lock you out from the machine (e.g. if you are not on local network) –  lupincho Dec 23 '12 at 18:11
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.