Click here to Skip to main content
15,745,270 members
Articles / Operating Systems / Windows
Posted 11 May 2015


15 bookmarked

Convert Your Home Desktop to Webserver using IP-forwarding

Rate me:
Please Sign up or sign in to vote.
4.40/5 (5 votes)
11 May 2015CPOL4 min read
This tip describes how to convert your personal laptop into a webserver available on world wide web


Recently, when I was working on a personal web application being built on my laptop I wanted to have my friends test it over the internet.

I did not have a domain purchased yet and it was not ready as a production version. I did not want to buy a domain at testing phase of the site. After a few trial and errors, I figured out how I have my development laptop act as a webserver and allow external users to connect. 

This tip describes some simple steps which can be done to achieve this.

Using the Code

There is no coding needed for this - I will show here how to allow incoming traffic to your network end up routing the traffic to your local http server.

In my case, I was using a Microsoft IIS server, but this same trick can be applied for an application running on Java and using Apache server.

Considering you're using a Windows OS, first you need to figure out the IP address of your laptop. If you're inside a home network beside your ISP provided router, the router allocates different internal IPs to each of the latops connected to this network. These are internal IPs inside your network and not the IP on the world wide web.

First, you need to figure out what is your laptop's IP inside the network.

To get this, go to Windows command prompt and type ipconfig (or ipcofig|more - because the ipconfig output sometimes is too big). In the output of the command, you will see a line like this: 

Image 1

The IPv4 address is the address of your latop (considering your ISP is using IPv4 protocol), in this case it is

The default gateway address ( is the one of your home routers. The gateway has a very important role to play in allowing incoming traffic and routing those to your laptop, but we will discuss that shortly.

Remember, none of these addresses are public IP address, these are merely internal IP addresses inside your network.

Now, as my application was a .NET application, I needed to publish it and run it on my IIS webserver. If you are publishing a J2EE application, you would have deployed it on your Apache tomcat or websphere or weblogic. etc.

My web application was deployed on my local IIS server on Windows on port 9881 -

Image 2

See the binding details which says the application "onlineplat" is running on IP address and listening on port 9881.

Now, my friends sitting outside of my network cannot connect to this application using the IP - as this address is not visible to the outside world. How do I allow anyone else to connect to my applcation then? The trick is "IP-forwarding".

You have seen in the above screenshot where I did ipconfig and got the address of the dafault gateway or my router:

This address is mostly the same for all routers for home network world wide. You need to now type this IP on your browser.

Your router will now prompt for an id/password. In most of the cases, the id is something like "admin" and the password is "password" if you have not changed it. If you did not set it or don't remember, you can check your router version and search on the internet for the deault password for the router.

If you had already set the password and forgot it, you can press the "reset" button of your router and then open this same url (, where you can change the password.

Here is the screenshot from my router's home page -

Image 3

Different models of router will have different looking homepage, but all of them have a section "ip-forwarding". You can search on the internet for your router's ip-forwarding menu option. It generally is easy to find if you just search over the menu items.

The following screenshot shows the port forwarding rule I setup for my web-application:Image 4

What it means is, all incoming traffic to my home network on port 9881 will be forwarded to my laptop with address which is the IP address (internal IP address within my home network) of my laptop running the application.

You also need to make sure that the port 9881 on your laptop is not blocking incoming traffic. To ensure this, type "firewall" in your windows run menu and setup an inbound rule to allow traffic on port 9881:

Image 5

Now, the last part is to figure out your gateway's exact IP address over the work wide web - which you can find out from sites like - (this is not the only one). Basically, these sites poll your gateway and show your IP address.

For me, the IP address was

So now I told my friends to type  on their browser's URL and they were able to connect to my home made webserver over internet.

Of course, they were connecting using http and not https because I did not create my https settings - but that's part of a different discussion.


  • 11th May, 2015: Initial version


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior)
Australia Australia
Around 10 years of experience working in JSF and .NET both. I sometimes find time and love to write technical blogs.
Currently working out of Sydney for an assignment in ETL and Cloud Platforms.

If you like this post, you will probably be interested in checking similar posts here -
My personal website for blogs and more!

And here is My linkedin profile here

Comments and Discussions

SuggestionI would add Pin
Alexms12-May-15 9:44
Alexms12-May-15 9:44 
a word about what's called "dynamic DNS", the site is (look for free service for starters).

Your externally visible IP address may be changed by the provider without notice, so there is a chance that you pointed your friends to, but in the meantime your external IP became or something else.

So the idea is to register your very own name (URL), like, which is updated by a client app from NoIP that you install on your computer. Then your friends can use without knowing your current IP address.

With these two things - registration and client installation - done, a change from to is reflected in the world-wide DNS system within minutes, if not seconds, so your friends will not loose connectivity, well, maybe just for a minute.

Just my two cents.
GeneralRe: I would add Pin
Shibasis Sengupta12-May-15 13:48
professionalShibasis Sengupta12-May-15 13:48 
GeneralRe: I would add Pin
Alexms13-May-15 2:53
Alexms13-May-15 2:53 
GeneralRe: I would add Pin
Shibasis Sengupta13-May-15 14:06
professionalShibasis Sengupta13-May-15 14:06 
QuestionReg : Information Pin
Abhishek RV11-May-15 21:25
professionalAbhishek RV11-May-15 21:25 
AnswerRe: Reg : Information Pin
Shibasis Sengupta11-May-15 23:46
professionalShibasis Sengupta11-May-15 23:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.