1

I have a python server running on port 8000 on a raspberry pi and would like to make it accessible within the local network, which is currently not working.

The interface wlan0 is configured with the IP 10.0.0.69 and netmask 255.255.255.0.

I can't reach the server within the local network (from a different host):

root@DESKTOP-Lukas:~# curl http://10.0.0.69:8000
curl: (7) Failed to connect to 10.0.0.69 port 8000: Connection refused

I also can't reach the server from the raspberry pi:

lukas@raspberrypi:~ $ curl http://10.0.0.69:8000
curl: (7) Failed to connect to 10.0.0.69 port 8000: Connection refused

The server is running and listening on port 8000:

lukas@raspberrypi:~ $ sudo netstat -tnlp | ack 8000
tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN      743/python

The server responds properly when using localhost:

lukas@raspberrypi:~ $ curl localhost:8000
<h1>Not Found</h1><p>The requested URL / was not found on this server.</p>

The firewall has allow actions for port 8000:

lukas@raspberrypi:~ $ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
...
8000                       ALLOW       Anywhere
8000/tcp                   ALLOW       Anywhere
8000 (v6)                  ALLOW       Anywhere (v6)
8000/tcp (v6)              ALLOW       Anywhere (v6)
3
  • You are not listening external inerface. You are listening (bound) to 172.0.0.1 (localhost). See "Local Address" column Commented Apr 19, 2018 at 18:57
  • 1
    Who is the troll downvoting all questions here? Commented Apr 19, 2018 at 19:53
  • Sadly, it's unlikely they will reveal themselves. Commented Apr 19, 2018 at 20:55

1 Answer 1

5

Your netstat output shows you the problem:

tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN      743/python

Specifically, 127.0.0.1:8000 shows that your web server is bound only to the loopback address 127.0.0.1. You need to either bind it to the actual network interface or, more simply, bind it to all addresses (usually by specifying 0.0.0.0) and it will then be accessible by all other hosts with a route to your Pi.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.