Skip to content

Instantly share code, notes, and snippets.

@DanielThomas
Created January 18, 2021 04:00
Show Gist options
  • Save DanielThomas/8acc505ae822c36ee349606cbcd91724 to your computer and use it in GitHub Desktop.
Save DanielThomas/8acc505ae822c36ee349606cbcd91724 to your computer and use it in GitHub Desktop.
Docker for Mac M1 Preview VPN workaround
docker_setup_vpn () {
echo "## Previous Configuration"
sudo pfctl -a com.apple.internet-sharing/shared_v4 -s nat 2> /dev/null | tee /tmp/docker_vpn.conf
if sudo pfctl -a com.apple.internet-sharing/shared_v4 -s nat 2> /dev/null | grep 192.168.64.0 | grep -q utun2
then
echo && echo "Not applying change"
else
echo "nat on utun2 inet from 192.168.64.0/24 to any -> (utun2) extfilter ei" >> /tmp/docker_vpn.conf
sudo pfctl -a com.apple.internet-sharing/shared_v4 -N -f /tmp/docker_vpn.conf 2> /dev/null
echo && echo "## New Configuration"
cat /tmp/docker_vpn.conf
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment