Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 6 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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.