Skip to content

Instantly share code, notes, and snippets.

@kfigiela
Last active May 30, 2016 17:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfigiela/efb6fd928093eff40bc1 to your computer and use it in GitHub Desktop.
Save kfigiela/efb6fd928093eff40bc1 to your computer and use it in GitHub Desktop.
Using native OS X NAT with VirtualBox
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bootp_enabled</key>
<true/>
<key>detect_other_dhcp_server</key>
<integer>1</integer>
<key>dhcp_enabled</key>
<array>
<string>vboxnet0</string>
</array>
<key>reply_threshold_seconds</key>
<integer>0</integer>
<key>Subnets</key>
<array>
<dict>
<key>allocate</key>
<true/>
<key>lease_max</key>
<integer>86400</integer>
<key>lease_min</key>
<integer>86400</integer>
<key>name</key>
<string>10.0.69</string>
<key>net_address</key>
<string>10.0.69.0</string>
<key>net_mask</key>
<string>255.255.255.0</string>
<key>net_range</key>
<array>
<string>10.0.69.50</string>
<string>10.0.69.254</string>
</array>
</dict>
</array>
</dict>
</plist>
sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist
sudo /usr/libexec/PlistBuddy -c 'add :ProgramArguments:3 string -e' /System/Library/LaunchDaemons/com.apple.pfctl.plist
nat on en0 proto {tcp, udp, icmp} from 10.0.69.0/24 to any -> (en0)
nat on en1 proto {tcp, udp, icmp} from 10.0.69.0/24 to any -> (en1)
pass from {lo0, 10.0.69.0/24} to any keep state
net.inet.ip.forwarding=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment