Corresponding rules in MacOS for this Iptables rules

8k views Asked by At

I need to give Internet access to a VM under Vmware fusion 7 in Host-Only mode. I know how to do it in Linux, with the following IPtables rules:

sysctl -w net.ipv4.ip_forward=1

iptables -A FORWARD -o eth0 -i vboxnet0 -s 192.168.56.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE

But I can not find out how to do it in MacOS Sierra. Any help?

Thanks in advance!

2

There are 2 answers

0
Captain Nemo On BEST ANSWER

I asked the same question in apple.stackexchange.com and here is the solution:

https://apple.stackexchange.com/questions/265237/corresponding-ipfw-rules-in-macos-for-this-iptables-rules/265298#265298

1
AudioBubble On

You should look into configuring pf (packet filter) in macos (or OS X) it's been included since Lion.

It Is substantially different from what you're used to, so there will be a learning curve.

pf originates on OpenBSD. They have information that includes examples on how to write pf rules.

https://www.openbsd.org/faq/pf/config.html#config

Using it for NAT has it's own manual: https://www.openbsd.org/faq/pf/nat.html

To get started on the mac: http://krypted.com/mac-security/a-cheat-sheet-for-using-pf-in-os-x-lion-and-up/ it's a bit old, but still should you get started.

I've no idea how vmware fusion does networking on the mac (parallels tends to add a ton of interfaces you see on the mac), I'd start with simple examples and slowly grow to a more complex setup.