How do I enable IP-forwarding in MacOS X?
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
Solution 1:
You're doing two things there.
-
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.
-
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
pf
firewall tools. Try herePrior to 10.7 Lion, OS X used the
ipfw
firewall tools, which are well documented all over the net. Try here, or here