Skip to content

Instantly share code, notes, and snippets.

@battlecow
Forked from mowings/masq.sh
Created May 24, 2018 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save battlecow/b236256687fcc228782b77bf28d7b9ff to your computer and use it in GitHub Desktop.
Save battlecow/b236256687fcc228782b77bf28d7b9ff to your computer and use it in GitHub Desktop.
script to get xet xhyve working with all vpn interfaces
#!/bin/bash
interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) )
rulefile="rules.tmp"
echo "" > $rulefile
sudo pfctl -a com.apple/tun -F nat
for i in "${interfaces[@]}"
do
RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}"
echo $RULE >> $rulefile
done
sudo pfctl -a com.apple/tun -f $rulefile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment