Skip to content

Instantly share code, notes, and snippets.

@lilongen
Last active July 16, 2018 10:39
Show Gist options
  • Save lilongen/97220e521a62b0596fdf6bfcc2164db0 to your computer and use it in GitHub Desktop.
Save lilongen/97220e521a62b0596fdf6bfcc2164db0 to your computer and use it in GitHub Desktop.
make linux as gatway using iptables
- gateway side
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -t nat -A POSTROUTING -s 172.17.128.0/24 -d 10.10.0.0/16 -o tun0 -j MASQUERADE
# iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT
# iptables -A FORWARD -j ACCEPT
- client side
# ip route add 10.10.0.0/16 via 172.17.128.240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment