Last active
December 28, 2017 13:46
-
-
Save dz0ny/22db8e4d7bee5d2450b8dd45b8075fae to your computer and use it in GitHub Desktop.
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
dev="vpn-swan" | |
gw=$(ip a show $dev| grep "inet\b" | awk '{print $2}' | cut -d/ -f1) | |
ip rule del from 10.10.10.0/24 | |
ip rule add from 10.10.10.0/24 priority 10 table 100 | |
ip route add 10.10.10.0/24 dev $dev table 100 | |
ip route add default via $gw dev $dev table 100 | |
ip route flush cache | |
iptables -I FORWARD -o $dev -j ACCEPT | |
iptables -t nat -I POSTROUTING -o $dev -j MASQUERADE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment