Skip to content

Instantly share code, notes, and snippets.

@butterl
Forked from tzermias/ip_forward.md
Last active March 20, 2024 02:03
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 butterl/0e865444ada4e259593e5718dcbea788 to your computer and use it in GitHub Desktop.
Save butterl/0e865444ada4e259593e5718dcbea788 to your computer and use it in GitHub Desktop.
Forward traffic from wlan0 to eth0 interface

FORWARD LAN(eth0) traffic to wg0 vlan and make a transparent proxy

Enable IP forwarding

sudo sysctl -w net.ipv4.ip_forward=1

Start the wg0

sudo wg-quick up wg0

Forward packets from eth0 to wlan0

sudo iptables -A FORWARD --in-interface eth0 -j ACCEPT
sudo iptables --table nat -A POSTROUTING --out-interface wg0 -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment