Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the correct way to enable IP-forwarding in MacOS X?

More specifically, what is the MacOS X command line quivalent of the following two Linux commands:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -j ACCEPT
share|improve this question
up vote 8 down vote accepted

You're doing two things there.

  1. Enabling IP forwarding. The OS X equivalent might be:

    sysctl -w net.inet.ip.forwarding=1

    ...but since I don't know exactly what you're trying to do, this might be technically correct but unhelpful.

  2. Adding a largely unnecessary firewall rule. If you haven't changed the default policy for your FORWARD chain (iptables -P FORWARD ...), then this rule does nothing.

    OS X uses the ipfw firewall tools, which are well documented all over the net. Try here, or here

share|improve this answer

Does Mac OS X IPFW allow port forwarding from local ports to local ports? I have dansguardian and squid running on a mac as my firerules.

I'm trying to do this (on same mac)browser->dansguadian->squid->Internet

so I'm using this rule - fwd,8883 tcp from any to any 80

I tried using natd and redirect with little success.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.