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
link|improve this question

feedback

2 Answers

up vote 5 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

link|improve this answer
feedback

Does Mac OS X IPFW allow port forwarding from local ports to local ports? I have dansguardian 127.0.0.1:8883 and squid 127.0.0.1:3333 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 127.0.0.1,8883 tcp from any to any 80

I tried using natd and redirect with little success.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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