Last active
July 16, 2018 10:39
-
-
Save lilongen/97220e521a62b0596fdf6bfcc2164db0 to your computer and use it in GitHub Desktop.
make linux as gatway using iptables
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
- 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