I maintain a server in a remote place. It is connected to a LAN - the LAN is the usual poor man's LAN which uses the BSNL router as the dhcp server. They have dynamic IP from bsnl. The machine the machine has a fixed IP (192.168.1.123). The inward facing IP of the router is 192.168.1.1. Is it possible to ssh into this machine from outside, and if so how?
This is pretty simple to do, I have been using it for a few years now. There are three parts to the problem, 1. Accessing your Dynamic IP 2. Opening your SSH port 3. NAT Loopback (1) Dynamic IPSince the IP is dynamic, you need a domain name which can be updated periodically. There are several dynamic DNS providers, one of the popular ones is dyndns.org which is now dyn.com. They provide a couple of REST APIs which you can use to get your external IP and update the IP in your dyn.com account.
I have attached the shell script which you can use. Just modify the script with your newly created dyn.com account name and password.
(2) Port forwardingBSNL modems are unpredictable when it comes to port forwarding but you can try it out. In the port forwarding table, just specify incoming port 22 to be forwarded to IP (192.168.1.123) and port 22.
(3) NAT LoopbackThis is just something you should know, it is not required. Even after the above setup, you might not be able to access your domain name directly from your internal network if the router doesn't support NAT loopback. AFAIK, linksys/cisco routers support this while the basic netgear routers don't. I don't know about BSNL modem/routers.
In case you are interested, the script does the following, - gets your external ip - resolves the domain name to the current ip - if the current ip and external ip are different, issues an update. Hope this helps. -- 0
update_dyndns.sh
Description: application/shellscript
_______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
