0

I want users to connect to Netgear router and access an app hosted on my laptop at localhost:9002. This will be in a place without cell phone or internet access.

The Windows 10 laptop is connected to the "Internet" port of the Netgear router. I have tried 192.168.137.1; 10.0.2.2 (from an answer to a similar question); 169.254.232.76 (autoconfigured IPV4 address for Ethernet adapter). I have tried this both with entering the base IP addresses above and with :9002 for the port. This is being entered in my phone's browser.

I have also tried this with the laptop connected to an ethernet port on the router rather than the internet port.

Here are my network connections (again, Wi-Fi will not be available): Network connections Ethernet and Ethernet through Netgear router

Do I need a DNS or something? Or is it a setting I'm missing? Any help is appreciated.

1
  • did any of these answers helped you?
    – trolzen
    Jul 22, 2021 at 15:49

2 Answers 2

1

I assume you have a router with one WAN port, several LAN ports and WiFi capability. And there is no need to connect to this app from Internet.

You just connect your laptop to any LAN ports, configure DHCP server inside your Netgear router (otherwise you'll have to correctly assign ip addresses from the same subnet for your laptop and your phone). This way your router will be working as a switch bridging your devices in the same network segment, and you'll have connectivity from your phone to your laptop.

Also be sure that your app binds to the laptop's ip address like 192.168... (whichever is configured) and not to 127.0.0.1 (which is the "synonym" of the localhost)

UPD

Check the Windows Firewall, maybe you disabled net access for python when you first run your script binding to 192.168.1.2.

8
  • I did not find DHCP settings inside the router. I do see that the router has assigned the computer (cable-connected) the address of 192.168.1.2. It has also assigned the phone (wifi-connected) to 192.168.1.3. @Anaksunaman I misspoke, wifi is available on the router. There is no internet connection. I am using Python http.server module and have tried it with default to 127.0.0.1 and binding to 192.168.1.2. I can bring up either of these with Chrome on my laptop. Neither of them will show up with Chrome on my phone.
    – Brad
    Jul 24, 2021 at 21:14
  • Can you ping the phone from the laptop and vice versa (you can do that using termux, it is opensource and doesn't require root)? When you will be performing this, ping both of the addresses (...1.3 and ...1.2) and post the results.
    – trolzen
    Jul 24, 2021 at 22:05
  • added a remark about windows firewall
    – trolzen
    Jul 24, 2021 at 22:11
  • Results of ping from phone: -- 198.162.1.2 ping statistics --- 7 packets transmitted, 0 received, 100% packet loss, time 6073ms Results of ping from laptop: Pinging 192.168.1.3 with 32 bytes of data: Reply from 192.168.1.3: bytes=32 time=37ms TTL=64 Reply from 192.168.1.3: bytes=32 time=46ms TTL=64 Reply from 192.168.1.3: bytes=32 time=33ms TTL=64 Reply from 192.168.1.3: bytes=32 time=36ms TTL=64 Ping statistics for 192.168.1.3: Packets: Sent = 4, Lost = 0 (0%loss), Approximate round trip times in milli-seconds: Minimum = 33ms, Maximum = 46ms, Average = 38ms
    – Brad
    Jul 25, 2021 at 11:53
  • that should be 192.168..., not 198.162...
    – trolzen
    Jul 25, 2021 at 20:27
0

Wi-Fi will not be available.

Supplementing the existing answer to this question:

  • Wi-Fi needs to be available on the router, at least to for the phones to connect to. The router is what actually connects your phone and laptop, allowing e.g. your phone browser access to the laptop and whatever app it's running.

  • You should make sure there are no firewalls between the phone(s) and the application. This could be a firewall on the router or on the laptop itself (e.g. Windows firewall).

  • Be aware that you may need to port forward 9002 to the local IP address of the laptop in the router. That is, requests for port 9002 that come from another device on the network (e.g. a phone) need to be routed to the correct computer (e.g. the laptop); otherwise, the router may simply ignore those requests.

Do I need a DNS or something?

Likely not, unless you want to use a name rather than an IP address to access the laptop (e.g. as laptop.local:9002 versus e.g. 192.168.1.X:9002).

Note that while you can theoretically redirect localhost to another computer (rather than the local device) with DNS, in practice software such as browsers don't necessarily check that name for its associated IP (since it is typically mapped to 127.0.0.1).

1
  • See my comment above. I've also completely turned off Windows firewall and I added port forwarding as you suggested. Using Python, the default is now port 8000. My phone still cannot connect to the web page on my laptop. What am I missing?
    – Brad
    Jul 24, 2021 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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