I live in a city where internet is the main problem I face everyday and seriously whole India does suffer from low internet speed. To solve this i just switched from ADSL connection to wireless(WiMAX) and now I have problem that I don't have a dedicated ip and can't connect to my PC, my server or my raspberry pi.
For every network request router must forward that request to server so that server can handle that and reply to it. So in this case I don't own the main router which gives me internet connection and therefore I can't forward request to my server.
So In order to do this we can use a server which doesn't have this limitation. I own server of cloudtub.com and dynofy.com and some other cheap cloud servers which I can use to connect to my home server and access it while travelling.
So I could only thought of these two methods
- UDP Hole Punching
- Port forwarding via SSH
UDP Hole Punching is clever Idea but not very reliable and I am not sure whether I can trust it for persistant connection. So I will describe both methods here and tell you how to use both of these.
My home server and public server both uses Ubuntu linux. Now for UDP Hole Punching you can download and use this
Github : https://github.com/samyk/pwnat
This is a tool that allows you to proxy connection between two server even when they are behind different NAT.
After downloading you need to unzip and compile it using make command. After that you run this tool and enjoy.
Second method I used is simple port forwarding via ssh tunnel. This is as simple as
ssh -R 3000:localhost:80 firstname.lastname@example.org
Here 3000 is the remove port of server which you will use to access port 80 of your local server from where you are issuing this command.
There is one extra thing you need to do so that you can access your local server on remote server url which enabling GatewayPorts to yes in sshd_config file
GatewayPorts yes to the following file and save and restart the ssh service by using following command
sudo service ssh restart