Comment 4 for bug 1288135

Revision history for this message
Miroslav Anashkin (manashkin) wrote :

Working network settings for MacOS overview available here:
https://drive.google.com/file/d/0BwNB1Fj6mQMBRnJHYjBtSXlIajQ/edit?usp=sharing

To set up NAT for VBox host-only adapter under MacOS one may do the following (all under root account!)
1.
`sysctl -w net.inet.ip.forwarding=1`

2. Do not use "ipfw" — use "pf" only.
Below is the pf config example with the necessary rules declared. Simply add the similar settings to your pf.conf:

`# cat /etc/pf.conf`
#######################
scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
nat on en0 inet from ! (en0) to any -> (en0)
dummynet-anchor "com.apple/*"
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"
pass in on vboxnet0
pass in on vboxnet1
pass in on vboxnet2
pass in on vboxnet3
pass in on vboxnet4
pass in on vboxnet5
pass in on vboxnet6
pass in on vboxnet7
pass in on vboxnet8
pass in on vboxnet9
pass in on vboxnet10
pass in on vboxnet11
pass in on vboxnet12
pass in on vboxnet13
pass in on vboxnet14
pass in on vboxnet15
#######################

3. Apply the settings:
`pfctl -f /etc/pf.conf`

The key rules in the settings listed above are `nat on en0 inet ...`
and all that "pass" rules, all the remained rules are mostly defaults.