Saturday, March 17, 2012

Turning your home PC into a hosting server.

Most of you who is going to read this probably already know how to do this. I'm going to write a post about it anyway since I actually met a few people who are in the IT field themselves that do not really know how to achieve this.

So, people nowadays usually subscribes to a 24 hours available fast internet broadband at their homes. In some part of the world especially in the western countries, they probably are getting a fixed IP address which makes things a lot easier to achieve what we are discussing here since it's just a matter of buying a domain name, have it point to the fixed IP address and probably setup port forwarding from the router.

Here in Malaysia, the broadband that we subscribe to is based on a dynamic IP address. That means, we are getting a different IP address each time we get disconnected and reconnect to the Internet Service Provider.
This presents a problem as it's impossible to be sure that the IP that we are using remains the same and by the way, who would want to memorize IP address right?

So thankfully, the manufacturers of the broadband routers (most of them) includes a functionality called Dynamic DNS or DDNS built right into their products. What this functionality provide is a facility to automatically update your current IP address to a 3rd party service that their business is to provide a domain name for dynamic IP users.

To utilize this, first thing you have to do is to register at www.dyndns.org and add your chosen hostname (depends on availability).

Next, all you need to do is to login to your router, find the Dynamic DNS (or DDNS) setting page, input your credentials that you registered at the site before and save the setting.

Example is taken from my D-Link DIR-615 router.

DDNS setting in DIR-615 router

Now your network will have a domain name. :)

Next,  you need to tell the router your PC's IP address and the port that it needs to forward the packets to.
For example, if you want to make your PC to be your own personal private web hosting server, you need to input the port number that your web server application is listening to. Wweb servers (Apache, IIS, etc) listens to port 80. So, in this example, we are going to forward any packets that come in through port 80 to the PC with the web server application running. 

Login to your router again. This time, look for Port Forwarding or Virtual Servers in the menu. 
You should be able to find something almost similar like this (again screenshot is taken from my router):

Port forwarding rules in DIR-615 router

So what we have to do here is to input our PC's IP address in the private IP field and also the port number that we are using. In the image, I've set my router to forward any request to port 80 to the port 80 of my PC that is going to be the hosting machine.

What we have to do next it to test it. Try accessing the URL of the domain that we registered earlier from a device that is not using the same internet access (your smartphone with subscribed 3G/HSPA connection maybe). You should be able to access your web server remotely from anywhere in the globe with internet connection now. 

:)



1 comment:

Joy Brooki said...

Nice Post, you said that most of readers probably already know this but i don't know about this, anyway very nice post thanks for sharing.