Last active
March 22, 2018 14:33
-
-
Save smirn0v/d049a5672570cce05f1b5e8411df8d9c to your computer and use it in GitHub Desktop.
ssh tunnel
This file contains hidden or 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
#!/bin/sh | |
sudo ssh -f -N -w 0:0 my_server | |
sudo ifconfig tun0 192.168.1.102 pointopoint 192.168.1.101 | |
ssh my_server sudo ifconfig tun0 192.168.1.101 pointopoint 192.168.1.102 | |
ssh my_server sudo arp -n | |
sudo route add 123.456.789.123 gw 10.0.2.2 eth0 | |
sudo route add default gw 192.168.1.101 tun0 | |
sudo route del default gw 10.0.2.2 eth0 | |
Things you will need to change... | |
my_server = my server's name | |
123.456.789.123 = my server's ip | |
10.0.2.2 = GW in this virtual machine, yours will differ. | |
It's not pretty but it works for my needs. Oh, and the arp line is there to verify that the arp entry for 192.168.1.102 is still configured on the server side. You may need to add it as explained in the tutorial you're following (same tutorial I was following). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment