Port Forwarding & Server setup for WAN

Summary line – In this post, I am going to let you know “How to” setup servers on your IP address(Static) and port forwarding your router in order to make your PC accessible in WAN, run servers like HTTP, FTP, SSH, IMAP, TELNET, SMTP, VNC etc etc.

Okay, let us first see the image below and have a clear idea of what the real picture is:
InternetVsLocalNetwork

So, we at our homes or local network are always behind layers of firewalls and restrictions.  In general case, our ISP provides us with a router which is allocated an IP, dynamically or statically, and following the router we usually have another router in our home or directly connects a switch to the ISP’s router to connect all other nodes in the network.

Now, PING is something that we have been using to check if some node is alive or not.  So, we ping some IP address or a domain name to which if DNS is working gets resolved to its IP address and then gets checked up for being up or not.  IP address is something like the real address of the node.  We want to connect, we specify the IP address.   Now, can I have that thing?  i.e. an IP address to which I can connect to and it shows my PC and my website and my servers running.

Lets get to the point here, we get an IP or I should say, that our router gets an IP and then it allocates local network IP to the nodes in network.  A typical example is like you have some IP allocated to your ISP modem which is generally and most of the times allocated dynamically, it is the by default state.

Now since our router from ISP get its address dynamically via DHCP, it gets so from further circle out Routers.  Thus there exists a problem of logging into “MY” node whose address is decided dynamically in local network and whose router is again getting its IP address dynamically i.e. at every power restart the router reconfigures its IP via DHCP. (well, actually this is how dhcp works, i.e. it always asks for its previous IP allocated and tries to get the same every new time).

So, pertaining to this dynamism, our poor desire of “I want to access my Pc over WAN” dies.  The solution are
1. if somehow I can either manage to get my local IP opened up whenever someone tries to open my router’s address.(dynamic IP tracking and allocation)

2. Get a static IP.

Second is a way to easy.
NOTE : All, MTNL customers having broadband unlimited plans over any lower or high speed are given this FREE static IP address facility, (just bother to read the details of the plan you are taking up).
I have been using this facility from past 6-7 years.

Once your ISP’s router gets a Static IP, you just need to configure your router to allocate a few nodes static IPs i.e. your PC or laptop or any other virtual network drive or some embedded hardware.
I am assuming in this post that you already know how to setup  SSH, FTP, HTTP server on localhost at least.   Once we are having our desired server up and running on our node that we want to access on WAN, we just need to give it a static IP in our network.

My typical example :

Router’s IP                                                    : 59.177.25.245
HTTP server running on PC                             : 192.168.1.3
SSH server running on Single Board Computer : 192.168.1.4
FTP server running on Laptop                          : 192.168.1.2

Now, when I open my Router’s IP address over any point in whole WAN, it redirects my request to specific node, i.e HTTP request to PC, ssh to SBC and FTP to laptop.  So I can access my things anytime, anyhow I want.

How This Happens ??
The answer is Port Forwarding.  I actually create a virtual Server in my Router’s configuration and tell it about these IP address running the corresponding servers.

Screenshot from 2014-11-07 21:08:45

 

Don’t forget to make sure that DMZ is on, (your own security parameter).

Now,
HTTP request coming on your Router’s IP address —> local IP address running HTTP server and likewise.