I've got a fairly standard home network with a modem from my ISP, which is connected to a router which then provides NAT to about 3 PCs and laptops. There's a possibility to obtain one public IP from my ISP.

Now I'd like to add a web server to this setup. What I'm concerned about is how the web server will play along with the rest of the network.

Say that my ISP gives me a public IP address of In my home router, I think that I'll need to setup a rule saying that requests to should be routed to my web server's internal IP, say

However, if I sit at my home PC and try to load google.com, Google will probably see my PC's IP (which might be as (my public IP) and will send the response to this IP. When the IP packets reach my router, it will see it as a packet to and I'm worried that it will be routed to my home web server which would obviously prevent my PCs from working correctly.

I'm sure there's some hole in the reasoning above and that it is possible to have both regular desktops and a web server behind one public IP. So if anyone could explain where my thinking is wrong and how it really works, it would be greatly appreciated.

  • To help understand this situation Google for articles on NAT. Feb 25 '10 at 11:31

You're almost right there. Except that the replies coming from Google will not see it as a packet to They will see it as where XXXXX is a random port number in the unprivileged range.

Also, the router will keep a list of connections in its routing table and route the return packet correctly to your desktop computer instead of your home server.

What you want to do is a fairly straightforward and normal setup.


Keep in mind that frequently, for residential ISPs, your Acceptable Use Policy or Terms Of Use will forbid servers. My ISP actually blocks ports 25 & 80 (and a few others) making it impossible to run a server w/o a port designation on it.


The question you didn't ask, is "should I host a webserver on my home network", and the answer is almost always "no". The technology exists to do it, but unless this is a very small, hobby-ish website (or just for learning purposes) you are much better of paying $5-$10 a month and getting many, many more magnitudes of throughput and redundancy from a company that is setup to do it.

So can, yes? Should you? almost never.

  • Where I live, you can't get a VPS for $5-$10 a month (you can get a shared hosting for this price which is very different from what I want). Feb 25 '10 at 21:09
  • 1
    Really? You live on another planet? Where I live I can get a VPS from every hoster on the planet.
    – TomTom
    Sep 25 '10 at 5:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.