0

I am trying to open a specific port (8000) on my Mac (macOS 11.6) for local web development testing.

Let’s say my computer’s NAT IP is 192.168.1.10. If I go to 192.168.1.10:8000, I get nothing. nmap also tells me the port is closed. I can access the port on 127.0.0.1:8000, though.

I’m not doing anything with my router to give WLAN access, this is just so other computers and mobile devices on my local Wi-Fi network can access the server.

I have turned off the application firewall, and also have tried adjusting the packet filter (PF) settings, and it kept saying that there was a syntax error in the PF list.

I even tried disabling pfctl, which I did, but macOS is still blocking port 8000 and generally still seemed to be running a firewall. Is there another/different firewall system? What’s the best way to open a port these days?

1
  • 2
    Your Diango instance seems to be bound to localhost (127.0.0.1) only. What is the output of netstat -f inet -n | grep 8000? You may want to try specifying port and IP address when starting Django: python manage.py runserver 0.0.0.0:8000 (0.0.0.0 means "bind to all IP addresses").
    – jaume
    Commented Feb 14, 2022 at 14:41

1 Answer 1

0

You have to configure your application to open the port and wait on specific network subnet.

What you have in the moment, is serving only on 127.0.0.1 and not on 192.* or wider.

In django, you can run it with this example:

python manage.py runserver 192.168.1.10:8000

Similar question answered on stackoverflow.

3
  • The linked answer recommends to open on 0.0.0.0, which makes the port accessibly both locally and from the LAN without the need to know the IP address.
    – nohillside
    Commented Mar 5 at 11:19
  • Yes, @nohillside , but in this question I have answered as per question details, for the local network on 192.168.1.1 and his address so he can test and access from that network.
    – zhrist
    Commented Mar 7 at 21:53
  • Opening for 0.0.0.0 also allows access from 192.168.1.x, limiting it is an unnecessary restriction and (in most cases) simply a bad practice.
    – nohillside
    Commented Mar 7 at 22:59

You must log in to answer this question.

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