1

I am trying to set up a web server on my laptop that could be accessed publicly using my public ip(ex. http://123.45.678.910/), but I am stuck with port forwarding issue(or so I think).

So this is my set up:

Desktop is connect to the internet directly with LAN cable.

Laptop is connect to the internet only through Wi-Fi.

On my laptop, when I type "localhost", "127.0.0.1" or "192.168.0.6"(laptop's ip) into the browser's address bar I get directed to the webpage running on my Apache Server, so the web server is working. But when I type in my public ip I am directed to the router set-up page.

How to forward the ip so that the person typing in the address bar my public ip could access the Apache Server that runs on my laptop(which is connected to the internet through Wi-Fi)?

5
  • 3
    Accessing the web server public IP from your private network will only work if your router supports NAT Reflection/NAT Loopback/NAT Hairpinning. Most consumer grade routers don't.
    – DavidPostill
    Commented Apr 28, 2018 at 20:25
  • 1
    If you want to access it from an external network you need to enable port forwarding on your router.
    – DavidPostill
    Commented Apr 28, 2018 at 20:27
  • And it's generally a pretty bad idea to do it too.
    – Dave
    Commented Apr 28, 2018 at 20:38
  • 1
    @dave, if it's up to date and patched properly? Unless I'm just missing something? I would say the bad idea is trying to run a server on any 802.11 connection... Commented May 1, 2018 at 16:01
  • Yes @Tim_Stewart especially if it's running Windows. Things are a little bit better/safer with a Linux variant but it's still not generally considered a good idea. Agree that trying to do with with a wireless connection is a bit like pouring gasoline on a fire.
    – Dave
    Commented May 1, 2018 at 16:06

1 Answer 1

0

When I type in my public IP I am directed to the router set-up page.

To be clear, while hairpinning (the ability to access a public IP connected to a local machine from the local network) could be an issue, it seems more likely you simply haven't set up port forwarding properly in your router.

Regarding your exact problem, in short, it's likely your router doesn't understand that you wish to pass incoming requests on port 80 (HTTP) to your web server (e.g. 192.168.0.6). So instead, it serves up its own web-based configuration page.

Unfortunately, each router has a different interface for setting up port forwarding, so it's difficult to give exact steps. However, you need to see if you can find any (likely advanced) settings in your router which will allow you to set your laptop's IP as the destination for port 80 requests (these settings are often marked as "port forwarding" or "virtual server" settings). You may want to examine your router's manual if you can't find these easily.

It's also worth noting that any firewall present on your server can potentially interfere with running a web server, so you may need to adjust your laptop's firewall settings as well.

My laptop is connected to the Internet through Wi-Fi.

As a side note, this is likely extremely insecure. Wi-Fi presents a large number of possible ways for an attacker to gain access to your network. Other security considerations aside, it would be much better to run your web server from a wired connection.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .