Port Forwarding to make the localhost available for everyone

port-forwardingremote accesswebserver

I have installed Apache web server on my local linux machine.

Now, I followed the steps described here to do port forwarding.. I wanted my localhost to be accessible from outer web too.

Now, I am using D-Link DIR-605L router. and here's what I have done.

I have entered public port as 10000 and private port as 80. and entered the IP address as my machine's IP adddress.

Now from my machine (where I have installed the apache server), when I do

Router's Public IP Address:10000

It takes me to my homepage on webserver(localhost). But when I do it from a device that is not connected to my wifi, it says Web Page Not available.

Also, later I changed private port to 800, and in that case when I did

Router's Public IP Address:10000

it still worked. Now my questions are

  • The public port is that the people will use when accessing my webserver, and private port is the one where my localhost is listening. Now apache is always listening at 80 (by default). So when I change my private port to 800, how does <Router's Public IP Address>:10000 still work?
  • What do I do to make it work for everyone?

I am using DHCP server, not static IP.

Thanks

EDIT

Right now I have public port and private port both as 80. And still it is the same. I can access the localhost from the systems in the same network but not from an external system.

canyouseeme.org says that Error: I could not see your service on 45.64.17.245 on port (80)
Reason: Connection timed out

Best Answer

Easier than using port forwarding is to put your PC IP in the DMZ, ie, outside the router firewall. You can also set the router to lease always the same IP to your computer, based on MAC address. Then you can use a service like NoIP or freedns.afraid.org to get a static hostname to your IP. But... if you are using a home connection (cable modem, DSL...) the operator will probably block incoming traffic - that is, you are behind the operator's NAT and you cannot configure port forwarding or DMZ in the operator's routers. Simply consider that your router is connected to another router, that is connected to another...

Related Question