I have a server (Arch Linux) running locally with a couple of services on it, and I wanted to add a new python service (Flask) running on a different port. Locally, the server is running on 192.168.x.x, and I can already access all of the services currently running on it. I started my Flask server on port 5000, however running nmap on my laptop showed that the port was still closed:mylaptop~$ nmap 192.168.x.xPORT     STATE SERVICE22/tcp   open  ssh3000/tcp open  ppp5432/tcp open  postgresqlHowever, the port was open on the server's localhostmyserver~$ nmap localhostPORT     STATE SERVICE22/tcp   open  ssh3000/tcp open  ppp5000/tcp open  upnp5432/tcp open  postgresqlI assumed that it was some sort of issue with iptables (which I'm mostly unfamiliar with), but I tried running an express.js server (I already had one running on port 3000) on port 5000, and sure enough it worked.mylaptop~$ nmap 192.168.x.xPORT     STATE SERVICE22/tcp   open  ssh3000/tcp open  ppp5000/tcp open  upnp5432/tcp open  postgresqlI'm still unsure on how to forward the Flask server, and also I'm curious as to why my ssh, express.js and postgres services are forwarded by default. Any help is appreciated!
Port-Forwarding issues specifically with Flask, but not express.js
networking;arch linux;services;webserver;port forwarding
Assuming you're using Flasks built in HTTP server, then this is explained in the Flask documentation (scroll down to Externally Visible Server):If you run the server you will notice that the server is only accessible from your own computer, not from any other in the network. This is the default because in debugging mode a user of the application can execute arbitrary Python code on your computer.If you have the debugger disabled or trust the users on your network, you can make the server publicly available simply by adding --host=0.0.0.0 to the command line:flask run --host=0.0.0.0This tells your operating system to listen on all public IPs.The nmap output on your myserver machine showed port 5000 as open because you used nmap localhost, which scans for opens ports on localhost aka 127.0.0.1, not 192.168.x.x.