On this page
- Why test from both inside and outside?
- How do you check what listens on the server?
- How do you check the server firewall?
- How do you test a TCP port from another machine?
- How do you read open, closed and filtered results?
- How do you test UDP ports?
- How do you check outgoing connections and port 25?
- What else can make a port look blocked?
- Questions
Why test from both inside and outside?
A port can fail at several points, and each point needs a different fix. Testing from the server itself tells you whether the service runs and listens on the right address. Testing from another machine tells you whether the firewall and the network path let packets through. Doing both turns a vague "the port is blocked" into a specific cause: no listener, a listener bound to localhost, a firewall drop, or a filter somewhere between the client and the server.
Do the outside test from a machine you control: your own computer, or a second small server in another city. Scanning addresses that are not yours is not acceptable, so limit every test to your own server address.
How do you check what listens on the server?
ss lists listening sockets with the owning process; it replaces the older netstat and is covered in detail in the ss guide.
sudo ss -tlnp
sudo ss -ulnp
sudo ss -tlnp 'sport = :443'Read the local address column carefully. 0.0.0.0:443 and [::]:443 (or *:443) accept connections on all addresses. 127.0.0.1:5432 or [::1]:5432 accept only local connections, so that service will never be reachable from outside, whatever the firewall says. If nothing appears for your port, the service is stopped or configured for another port; check it with systemctl status and its log.
Then test the listener locally, which proves the program accepts connections before the firewall is even involved:
nc -vz 127.0.0.1 443
curl -sI https://127.0.0.1 -k | head -n 1How do you check the server firewall?
Look at the rules the system really enforces. On Ubuntu and Debian with ufw:
sudo ufw status verboseOn Rocky Linux 9 and AlmaLinux 9 with firewalld:
sudo firewall-cmd --get-active-zones
sudo firewall-cmd --list-allBoth are front ends for nftables, so sudo nft list ruleset shows the final rule set on all four systems, including rules added by Docker. Open a missing port with sudo ufw allow 8443/tcp or sudo firewall-cmd --permanent --add-port=8443/tcp followed by sudo firewall-cmd --reload. The firewall rules tutorial and the ufw guide explain the rule order.
The BitcoinVPS console has no firewall groups, so the rules you manage live inside the operating system. Docker publishes ports through its own rules, which can bypass ufw, so a container port may be open even when ufw does not list it.
How do you test a TCP port from another machine?
Install the tools on the machine you test from. On Ubuntu and Debian the OpenBSD netcat and nmap come from the archive; on Rocky and Alma netcat is the nmap-ncat package:
sudo apt install -y netcat-openbsd nmap # Ubuntu, Debian
sudo dnf install -y nmap-ncat nmap # Rocky, Almanetcat makes one connection and reports the result, with a timeout so it never hangs:
nc -vz -w 5 198.51.100.24 22
nc -vz -w 5 198.51.100.24 443
nc -6 -vz -w 5 2001:db8:4f2a::24 443If netcat is missing, bash can test a port on its own, and curl can open a raw TCP connection:
timeout 5 bash -c '</dev/tcp/198.51.100.24/443' && echo open || echo not reachable
curl -v --max-time 5 telnet://198.51.100.24:5432The netcat guide covers more of what nc can do.
How do you read open, closed and filtered results?
The answer type tells you where to look. nmap prints it per port:
nmap -Pn -p 22,80,443,8443 198.51.100.24
nmap -6 -Pn -p 22,80,443 2001:db8:4f2a::24- open: something accepted the connection. The port is reachable.
- closed: the server answered with a reset, so the path and the firewall let the packet in, but nothing listens on that port. Fix the service, not the firewall.
- filtered: no answer at all within the timeout. A firewall drops the packet, either on the server or somewhere on the path. Check the server rules first, then capture with tcpdump on the server while you test: if the SYN arrives, the drop is local; if nothing arrives, the block is before the server.
-Pn skips the host discovery ping, which matters because many servers drop ping. For a wider review of what your server exposes, see the nmap port audit guide.
How do you test UDP ports?
UDP has no handshake, so a silent port can mean open or filtered and tools cannot always tell the difference. The reliable test is to run a temporary listener and send a datagram to it. Stop the real service first if it uses the port, then on the server:
nc -u -l 51820From the other machine, type a line after this command and press Enter:
nc -u 198.51.100.24 51820If the text appears on the server, the port is reachable. With the real service running, sudo nmap -sU -p 51820 198.51.100.24 reports open|filtered for most quiet UDP services, which only rules out "closed". For WireGuard the best test is the service itself: sudo wg show shows a recent handshake once a client connects.
How do you check outgoing connections and port 25?
Outgoing tests run from the server towards a host you control or a service you use. A short connect test is enough:
nc -vz -w 5 smtp.example.net 587
curl -sS -o /dev/null -w '%{http_code}\n' https://example.net/Port 25, used by mail servers to deliver to each other, needs special handling. Do not plan a mail server or a newsletter tool around direct delivery on port 25 before you have asked support with a ticket. Apps that only need to send notifications or password resets work best through an authenticated relay on port 587 with STARTTLS, which the SMTP relay guide sets up. Reverse DNS for a mail sending address is also handled by ticket rather than in the console.
What else can make a port look blocked?
A few causes come up again and again:
- The service listens on IPv4 only while the client prefers IPv6 because the domain has an AAAA record. Test both families with
curl -4andcurl -6, as in the curl guide. - fail2ban or a similar tool banned your test address after failed logins. Check with
sudo fail2ban-client status sshd. - The client network blocks the outgoing port. Office and public Wi-Fi networks often allow only web ports, so repeat the test from another network.
- SELinux on Rocky or Alma refuses a non standard port for a service;
sudo ausearch -m avc -ts recentshows denials.
Questions about Check which ports are reachable
Which ports are open on a new server?
That depends on the image. Check right after deploy with sudo ss -tulpn and your firewall status, then close anything you do not need. SSH on port 22 is what you use to log in.
What does connection refused mean?
The packet reached the server and was rejected because nothing listens on that port, or a firewall rule rejects rather than drops. Start or fix the service first.
What does a timeout mean?
Packets are dropped silently, usually by a firewall. Check the server rules, then use tcpdump on the server during a test to see whether the packets arrive.
Is port 25 open for outgoing mail?
Do not assume it. Ask support with a ticket before planning direct mail delivery, and use an authenticated SMTP relay on port 587 for application mail.
Can I scan my server from the server itself?
Yes, but a scan from localhost bypasses most of the path and some firewall rules. Always confirm with a test from another machine.
Is there a firewall setting in the console?
No. Firewalls are configured inside the operating system with ufw, firewalld or nftables, as the firewall rules tutorial shows.
More in Networking and diagnostics
- FreeRADIUS with PostgreSQL
- IPv6 on your server
- The ip command
- DNS lookups with dig
- Listening ports with ss and netstat
- Test ports and transfer data with netcat
- Trace network paths with mtr
- Capture packets with tcpdump
- Live bandwidth with iftop and nethogs
- HTTP requests with curl
- Dynamic DNS updates from a server
- Latency graphs with SmokePing
- Traffic analysis with ntopng