7

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
13

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 pf firewall tools. Try here

    Prior to 10.7 Lion, OS X used the ipfw firewall tools, which are well documented all over the net. Try here, or here

1
  • This is exactly what I needed to enable a proper switch on my Bridge virtual interface. Catalina. – Ray Foss Jun 23 '20 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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