Created
September 19, 2013 03:20
-
-
Save hgdeoro/6618729 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
# | |
# in the remote (client) machine | |
# | |
sudo ssh -o PermitLocalCommand=yes \ | |
-o LocalCommand="sudo ifconfig tun1 192.168.123.2 pointopoint 192.168.123.1 netmask 255.255.255.0" \ | |
-TC -w 1:1 root@ip-of-the-machine-with-the-virtual-servers \ | |
'ifconfig tun1 192.168.123.1 pointopoint 192.168.123.2 netmask 255.255.255.0; echo tun ready' | |
# | |
# in the machine with the virtual servers to share | |
# | |
iptables -I FORWARD -i tun1 -d 192.168.122.0/24 -j ACCEPT | |
iptables -t nat -I PREROUTING -i tun1 -d 192.168.123.201 -j DNAT --to-destination 192.168.122.201 | |
iptables -t nat -I PREROUTING -i tun1 -d 192.168.123.202 -j DNAT --to-destination 192.168.122.202 | |
(...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment