Last active
January 10, 2025 03:47
-
-
Save vimagick/864a0ba0282c165641c3d19acdbf1e7f to your computer and use it in GitHub Desktop.
Enable LAN Access from Wireguard Peers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# enable ip forwarding | |
sudo sysctl -w net.inet.ip.forwarding=1 | |
# disable pf firewall | |
sudo pfctl -d | |
# flush nat rules | |
sudo pfctl -F nat | |
# add NAT rule (utun12 is the wireguard interface, alternatively CIDR can be used here) | |
echo "nat on en0 inet from utun12:network to any -> (en0)" | sudo pfctl -f - | |
# list nat rules | |
sudo pfctl -s nat | |
# enable pf firewall | |
sudo pfctl -e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment