Navjot Singh Navjot Singh - 19 days ago 6
Python Question

Finding my IP address on windows for SimpleHTTPServer

I've started an HTTP Server on my laptop using:

python -m SimpleHTTPServer


I want to access this from another computer in a different network. I tried finding the IP of the laptop running HTTP server using whatismyip and then called from the PC on other network like:

http://xx.xx.xx.xx:8000


Because since 8000 is the default port on which it started. However, this doesn't seem to work. What is the right way?

Answer

First you need to know your public IP address.

This is how people find your network from outside. You can find this by Googling "whatsmyip".

For example your public ip address is 66.66.66.66

enter image description here

Then you need to know your private IP address, this is how people (or machines) find your PC from within your network.

Open a cmd and type in ipconfig

For example your private IP address is 192.168.1.13

This is mine

Now comes the hard part

You need to port forward people accessing the public ip to your private ip within the network.

It looks something like this:

enter image description here

Here is a comprehensive guide on how to do that

Most likely you need to go to your gateway ip, mine is 192.168.1.1 if you see the above picture.

Login to the router and find a port forwarding section.

There you forward incoming requests to HTTP/TCP PORT 8000 to your private ip address port 8000, for example: 192.168.1.13:8000

It would look something like this:

enter image description here