
A new VPS usually comes up with more exposed than you think. The image may include services you never asked for, the provider's network firewall might be wide open by default, and the software you install during setup often listens on every interface unless told otherwise. Your firewall rules describe what you intend to be reachable. A port check from outside tells you what actually is.
Before you point DNS at a new server and put real users on it, it is worth spending ten minutes checking its ports from the internet. Here are the six checks that catch most mistakes, what the results mean, and how to keep them true after launch.
First, understand the three possible answers
When you test a TCP port from outside, you get one of three results:
- Open. Something accepted the connection. A service is listening and nothing in between blocked it.
- Closed. The server answered, but refused the connection. Nothing is listening on that port, and no firewall dropped the packet.
- Filtered. There was no answer at all within the timeout. A firewall, either on the server or in the provider's network, silently dropped the attempt.
For ports that should be private, filtered is the best answer and closed is acceptable. Open is a finding to investigate.
Why you must test from outside
Checking from the server itself shows what is listening, which is useful. You can list listening sockets with the ss utility and see every service and the address it is bound to. But it cannot show you what the internet can reach, because it skips every firewall layer in between: the provider's security group, the host firewall and any NAT or load balancer in front of the server.
There is also a well-known trap on servers that run Docker. When a container publishes a port, Docker writes its own firewall rules, and those rules are evaluated before the rules managed by common host firewall front ends such as UFW. The result is that a database container published on all interfaces can be reachable from the internet even though your firewall configuration says the port is blocked. Only an external test reveals it.
The simplest way to test from outside is an open port checker that makes a single TCP connection to your server's address and reports whether the port is open, closed or filtered. Run it from a browser on your laptop, not from the server, and go through the list below.
Check 1: SSH is reachable only the way you intend
Port 22 will be open on most servers, because that is how you manage them. The check is whether that is a deliberate choice. If you only ever connect from a fixed office or VPN address, restrict SSH to that address in the provider's firewall, and the external check should then show the port as filtered from anywhere else. If SSH must stay open to the world, make sure password authentication is disabled and only key-based logins are accepted, since open SSH ports receive automated login attempts within minutes of a server going online.
Check 2: Web ports answer correctly
Ports 80 and 443 should be open on a web server, and this check confirms that traffic actually arrives. While you are at it, confirm that port 80 only redirects to HTTPS and does not serve the site in plain text, and that the certificate on 443 is valid for the hostname. These are the ports your users will hit, so a firewall mistake here is an outage on day one.
Check 3: Databases are not on the internet
This is the check that matters most. MySQL and MariaDB on 3306, PostgreSQL on 5432, MongoDB on 27017, Redis on 6379 and Elasticsearch on 9200 should never be reachable from the public internet. Automated scanners find exposed databases within hours, and several of these services have historically shipped with weak or no authentication by default. If the application and database run on the same server, bind the database to localhost. If they run on different servers, use a private network or restrict the port to the application server's address.
Check 4: Admin panels are restricted
Control panels and admin tools often listen on their own ports: 8080 and 8443 for various web panels, 2083 and 2087 for cPanel and WHM, and 10000 for Webmin. Development servers started "just for a minute" during setup are another common find. Each of these is a login form exposed to the world. Restrict them to trusted addresses or put them behind a VPN, and check that anything you started temporarily has really stopped.
Check 5: Mail ports match your plan
If the server sends email, check ports 25, 465 and 587. Many VPS providers block outbound port 25 by default to fight spam, which explains why a fresh server can receive mail but not deliver it. If the server is not meant to receive mail, port 25 should not be open inbound. If it is a mail server, confirm that submission on 587 and 465 requires authentication, so it cannot be used as an open relay.
Check 6: UDP services are not amplifiers
UDP is harder to test, because a lack of reply can mean either open or filtered. Still, a few UDP services deserve attention because attackers abuse them to amplify denial of service traffic: DNS on 53 when the server answers recursive queries for anyone, NTP on 123, SNMP on 161 and memcached on 11211. Unless the server is intentionally a public DNS server, none of these should answer the internet. Block them in the provider's firewall to be sure.
Keep the results true after launch
A port check on launch day is a snapshot. Servers change: a package update starts a new service, a colleague opens a port to debug something, or a new container publishes a port nobody reviewed. A few habits keep the picture accurate:
- Re-run the external checks after any significant change, such as a new application, a control panel update or a firewall edit.
- Put the ports that must be open, such as 443 for the website or 25 for a mail server, under continuous monitoring, so you get an alert when a required service stops accepting connections.
- Keep firewall rules in one place, ideally the provider's network firewall plus a host firewall as a second layer, and document why each open port exists.
- Schedule a quick review every few months to close anything that is no longer needed.
Most server compromises do not start with a clever exploit. They start with a service that was never meant to be reachable. Ten minutes of port checks before launch is one of the cheapest pieces of security work you will ever do.
FAQs
What does a filtered port mean on a VPS?
A filtered port means the test got no reply before it timed out. A firewall on the server, or in the provider network, dropped the packet. For a database or admin panel, filtered is the result you want. Closed is fine too. Open means a service accepted the connection, so find out why before the server goes live.
Why is a port check from the server itself not enough?
A check on the server only lists programs that are listening. It skips the provider firewall, the host firewall, and any load balancer in front, so it cannot show what the internet can reach. Docker can also publish a container port ahead of UFW. The database looks blocked in your config and is still open from outside.
Which ports should stay private on a new VPS?
Databases should not face the public internet. That includes MySQL and MariaDB on 3306, PostgreSQL on 5432, MongoDB on 27017, Redis on 6379, and Elasticsearch on 9200. Admin panels on 8080, 8443, 2083, 2087, and 10000 should be limited to trusted addresses or a VPN. Leave SSH on 22 open only when that is deliberate and passwords are disabled.
How often should these port checks be repeated?
Run the checks again after a new application, a control panel update, or a firewall change. A package update or a new container can publish a port nobody reviewed. Watch ports that must stay open, such as 443, so you hear when a required service stops answering. Review every few months and close ports left open for debugging.


