Home › Topics › Ping, Traceroute & Friends › Beyond ICMP

Beyond ICMP: TCP and UDP Reachability Checks


Sooner or later, ping fails you. Sometimes literally — the firewall drops your echo requests and the server sits there, alive and unpingable, while your check turns red. Sometimes subtly — the replies come back fine. But they have been deprioritized, rate-limited, or answered by a load balancer standing in front of a dead application. So the green light is describing something other than reality. The whole catalog of those betrayals is in ICMP politics; this guide is what you do about it.


The answer is to move up a layer. Instead of asking the network's side channel "is this address there?", you ask the machine's front door "is anything listening on this port?" One rung higher, you ask "will the service actually speak to me?" These are TCP and UDP reachability checks. And they have two enormous virtues. They travel as ordinary traffic, subject to the same rules and queues as the packets your users send. And they test the thing users actually touch. A port check can be blocked, but it cannot be flattered.


By the end you will be able to test any port from Windows or Linux with one-liners. You will read the three possible verdicts — open, refused, timeout — like a detective. You will handle UDP's strange silences honestly and choose the right check for any target. Ping stays in your toolbox; it just stops being the only tool in it.


In this guide

  • The three-way handshake as a truth test
  • The one-liners: Windows, Linux, and bare bash
  • Timing the handshake: latency in the right lane
  • UDP, honestly: probing what won't answer
  • One rung up: banners and handshakes
  • Matching the check to the target
  • Firewall reality: a blocked check might be policy working
  • Hand tool and scheduled check: both roles
  • The phrasebook, and where to go next

The three-way handshake as a truth test


Every TCP connection on earth begins with the same three-packet ritual. Your machine sends a SYN ("may I connect?") to a specific port on the target. If a program is listening on that port, the target answers SYN-ACK ("yes, come in"). Your machine then replies ACK ("here I am"). Three packets, a few milliseconds, and a connection exists. This is the three-way handshake, and as a monitoring instrument it is beautifully strict.


Strict, because a completed handshake cannot be faked by accident. A SYN-ACK comes back only if several conditions hold. The address must be reachable, and a host must be up at it. Its operating system must be functioning well enough to run its network stack, and a program has specifically asked to receive connections on that exact port. Ping proves an address answers memos; a completed handshake proves something is home and taking visitors at that door. That is a categorically stronger statement. And it is the statement your users' traffic depends on — because their traffic starts with the same three packets.


One honest caveat before the tools: the handshake is answered by the operating system's network stack, not by the application itself. The OS will complete handshakes for a listening program even if that program is hung, wedged, or busy screaming into a log file — up to a point. So "port open" sits one rung below "service actually works" on the ladder that ping-up versus service-up describes. We will climb that final rung later in this guide.


The one-liners: Windows, Linux, and bare bash


Windows: Test-NetConnection

PowerShell ships with a purpose-built tool. Give it a host and a port:


Test-NetConnection 10.0.0.8 -Port 443

ComputerName     : 10.0.0.8
RemoteAddress    : 10.0.0.8
RemotePort       : 443
InterfaceAlias   : Ethernet
SourceAddress    : 10.0.0.20
PingSucceeded    : False
TcpTestSucceeded : True

Read the last two lines together, because they are this entire article in miniature. PingSucceeded : False — the host ignores ICMP. TcpTestSucceeded : True — and yet something is absolutely listening on port 443. A ping-only check would have declared this server down while it served every user in the building. (The tool pings as a courtesy and TCP-tests as the verdict; you now know which line to trust. The alias tnc saves typing: tnc 10.0.0.8 -Port 443.)


Linux: netcat

The classic is nc (netcat) with -z (just test, send no data) and -v (say what happened):


nc -zv 10.0.0.8 443
Connection to 10.0.0.8 443 port [tcp/https] succeeded!

nc -zv 10.0.0.8 8080
nc: connect to 10.0.0.8 port 8080 (tcp) failed: Connection refused

nc -zv -w 3 203.0.113.50 443
nc: connect to 203.0.113.50 port 443 (tcp) timed out

Three runs, three different verdicts — and each one is information. The -w 3 sets a three-second timeout, which you should always include when testing anything that might not answer. The default patience of a TCP connect is measured in minutes, and yours is not.


Bare bash: no tools installed

On a minimal box with no netcat — a container, an appliance shell — bash itself can open TCP connections through a built-in pseudo-path:


timeout 3 bash -c 'echo > /dev/tcp/10.0.0.8/443' && echo open || echo closed

/dev/tcp/HOST/PORT is not a real file; it is a bash feature that performs a TCP connect when written to. Wrapped in timeout, it makes a serviceable port check out of nothing. It is a party trick, but the day you are stranded on a stripped-down box, it is a very good party.


Reading the three verdicts

Every TCP check ends in one of three ways, and each is a distinct wire-level event with its own meaning:


VerdictWhat happened on the wireWhat it proves
Succeeded / openSYN sent, SYN-ACK returned, handshake completedHost up, path open, and a program is listening on that port
Refused (instant)Host answered with RST — an active "nothing here"Host is up and reachable; that particular service is not running (or runs on another port)
Timeout (slow silence)SYN sent, nothing came back at allHost down, address wrong, or — most often inside networks — a firewall silently dropping you

Dwell on the middle row, because beginners misread it daily. Refused is not failure — refused is information. A refusal is the host's own operating system actively responding "I'm here, but nobody is listening at that door." You have just proven the machine is up and the network path works. And the problem is specifically the service: crashed, not started, or bound to a different port. That instantly narrows a "server down?" ticket to a "service down" ticket — different on-call, different fix, different urgency. Timeout, by contrast, is the ambiguous verdict: silence could be a dead host or a firewall doing exactly what it was told. Telling those apart is the firewall-reality section below.


Timing the handshake: latency in the right lane


The handshake is not just a truth test; it is a stopwatch. The time from SYN to SYN-ACK is one round trip to the target — measured in real TCP traffic. That matters because of QoS politics: ICMP probes often ride a different queue than user traffic, so ping latency can flatter or slander the path. A handshake to port 443 is queued, classed, and policed like the HTTPS traffic your users send. That is because as far as the network can tell, it is that traffic. When ping and users disagree, handshake timing is the tiebreaker.


# Linux: time three handshakes
time nc -zv -w 5 10.0.0.8 443

# Windows: measure a TCP test
(Measure-Command { tnc 10.0.0.8 -Port 443 }).TotalMilliseconds

The shell's time wraps the whole command (including name lookup), so treat it as a rough cut. Monitoring platforms and purpose-built tools record the connect time alone, which is the clean number. Trend that number over time and you have a latency graph drawn in the same lane as production traffic. The measurement discipline behind that idea lives in measuring latency. The graphing technique in smokeping-style latency graphing works as well over TCP probes as over ping.


UDP, honestly: probing what won't answer


Now for the awkward relative. UDP has no handshake — by design. You send a datagram; the protocol makes no promises and sends no acknowledgment. That is precisely why DNS, VoIP, and streaming use it, and precisely why "UDP port check" is a nearly self-contradictory phrase. Suppose you send a probe datagram at a UDP port and hear nothing back. That silence means... a listening service that simply ignored your meaningless probe. Or a firewall that ate it. Or an empty port on a host configured not to complain. Silence is the expected result in every case, so a raw UDP probe that "passes" or "fails" has told you close to nothing.


There is one lucky exception. When a datagram reaches a real host on a port where nothing listens, the host may send back an ICMP "port unreachable" memo. If you receive one, you have genuine information — host up, port empty. Notice the inversion, though: UDP can sometimes prove absence, but raw probes can never prove presence. And the hint rides ICMP, which means the politics apply — rate-limited, often filtered, never guaranteed. A clue when you are lucky; a foundation for nothing.


So how do you actually check a UDP service? You stop probing the port and start speaking the protocol. Send the service a tiny real request in its own language; a real reply proves the whole stack at once. The canonical example is DNS — the check that proves a DNS server works is a DNS question:


# Ask the server at 10.0.0.53 to resolve a name
dig @10.0.0.53 www.example.com +short
93.184.216.34

# Windows (or anywhere without dig)
nslookup www.example.com 10.0.0.53

An answer proves the path was open, the host is up, and the daemon is running. And it is actually performing resolutions — that makes four facts from one packet exchange, where a raw probe would have proven none. The same principle covers other UDP services: an NTP client query proves a time server, a RADIUS test request proves an authentication server. If a UDP service matters enough to monitor, it deserves a check written in its own language. If no such check exists, monitor it from inside the host instead (is the process running? is it answering locally?) rather than trusting silence from across the network.


One rung up: banners and handshakes


Back on TCP, one more rung separates "port open" from "service speaking." Remember the caveat: the OS completes handshakes on a listening program's behalf. So a wedged application can hold its door open while helping nobody. The fix is to demand a word from the service itself.


Some protocols volunteer that word instantly. Connect to a mail server and the SMTP service introduces itself with a greeting line before you say anything:


nc -w 5 mail.example.com 25
220 mail.example.com ESMTP service ready

That 220 banner is a different class of evidence than an open port: the application process itself composed and sent it. The kernel answers the knock; the greeting proves a worker actually came to the door. For TLS services, the equivalent is completing a TLS handshake:


openssl s_client -connect www.example.com:443 -servername www.example.com < /dev/null

If that spills out a certificate chain and finishes with a verification result, you have proven the service can negotiate encryption and present its certificate. That quietly hands you a bonus check, because the output includes the certificate's expiry dates. An expiring certificate is an outage with a countdown timer attached. Each rung up the ladder — port open, banner spoken, protocol transaction completed — proves strictly more, at the cost of a slightly more elaborate check. The top of the ladder (a full login, a real transaction) belongs to service-level monitoring. The rungs in this guide are the ones you can climb with one-liners.


Matching the check to the target


Choosing well is mostly a habit of asking "what would this target's users notice first?" and checking that. A working default per target type:


TargetBest first checkCommand shapeWhat success proves
Router, switch, UPSPing (plus SNMP polling)ping HOSTDevice alive and answering; its politics are knowable and baselineable
Windows serverTCP to the service it exists fortnc HOST -Port 3389 (or 445, 1433...)OS up and the role's door open — even where ping is blocked
Web applicationTLS handshake (or HTTP fetch)openssl s_client -connect HOST:443Listener up, TLS negotiating, certificate presented and dated
DNS serverA real querydig @HOST name +shortDaemon running and resolving — the entire job, proven end to end
Mail serverSMTP bannernc -w 5 HOST 25 expecting 220The MTA process itself is alive and accepting
Anything behind a load balancerApplication-layer check through the front doorReal query or fetch via the public addressThe chain to at least one healthy backend — not merely the doorman
UDP service (VPN endpoint, NTP...)Protocol-native request; else check from inside the hostdig-style native clientThe service performing its actual function — raw UDP probes prove nothing

Warning: port checks against machines you do not own or manage look exactly like the opening move of a port scan, because mechanically they are one. Security teams and intrusion sensors notice. Keep systematic checks to your own estate and get agreement before probing anything else. And let your security folks know which monitoring hosts generate this traffic so your own sensors learn to recognize friendly fire.


Firewall reality: a blocked check might be policy working


Here is the property that makes TCP checks honest, and occasionally confusing. They traverse the exact same firewall rules, routing policy, and queues as real traffic. There is no diplomatic channel, no side door. The flip side: when your check fails, you may not have found an outage at all — you may have found policy, working as designed. A timeout from the guest VLAN to the database port is not a problem; it is the firewall earning its keep. The check is telling the truth. The truth is "blocked," and blocked was the intent.


This turns verdict-reading into a two-step: first the wire answer, then the policy question. An instant refused usually means you reached the actual host and nothing listens there. But some firewalls are configured to reject (send back an active refusal) rather than silently drop. So a refusal can occasionally be the firewall speaking in the host's voice. A timeout where the host should exist usually means a silent drop rule somewhere along the path. When the verdict surprises you, do not re-run the same check harder. Change something and triangulate. Test the same port from a second location, test a known-open port on the same host, and compare. Two vantage points resolve what one cannot.


And that raises the question every monitoring design eventually faces: checks are honest only about the path they travel. A check that succeeds from the monitoring server proves nothing about the user VLAN if policy differs between them — and it usually does. Test from where the users sit, or as close to it as you can get. The craft of choosing those vantage points is covered in designing synthetic probes.


Hand tool and scheduled check: both roles


Everything above plays two distinct roles in your working life. As hand tools, these one-liners are triage. A ticket says "server down," and thirty seconds of tnc tells you whether it is down, unpingable-but-listening, or up-with-a-dead-service. That is three different tickets, sorted before your coffee cools. Keep the phrasebook below within reach for exactly those moments.


As scheduled checks, the same probes become monitoring: something runs them every minute or few, records the results, and alerts on change. The mechanics differ from hand use in three small ways that matter. Set explicit timeouts a little above the target's normal response time — seconds, not the protocol's leisurely defaults. Require two or three consecutive failures before alerting, because a single lost SYN on a busy morning is weather, not news. And alert on state change rather than every failed run, so one outage produces one alert instead of one per minute. A scheduled handshake check with sane timeouts and flap damping is one of the highest signal-per-effort monitors you can own. It is cheap, honest, and aimed at the door your users actually use.


The phrasebook, and where to go next


The six most common needs, one line each:


NeedOne-linerSuccess looks like
Is this Windows box reachable on a port?tnc 10.0.0.8 -Port 3389TcpTestSucceeded : True
Quick port test from Linuxnc -zv -w 3 10.0.0.8 443succeeded!
Port test with no tools installedtimeout 3 bash -c 'echo > /dev/tcp/10.0.0.8/443' && echo openopen
Is DNS actually resolving?dig @10.0.0.53 www.example.com +shortAn IP address prints
Is the mail service itself alive?nc -w 5 mail.example.com 25A 220 greeting
Is TLS healthy, not just the port?openssl s_client -connect HOST:443 < /dev/nullCertificate chain and a clean verify result

One practical footnote: netcat exists in several flavors (traditional, OpenBSD, and the nmap project's ncat). Flag spellings vary slightly between them. If -z is missing, check your variant's help text; the idea transfers even when the letter does not.


The ladder to carry away: ping proves an address answers memos. A TCP handshake proves a door is open; a banner or protocol reply proves someone is working behind it. Climb only as high as the question you are asking. And when ping and reality disagree, you now hold the tools that settle the argument. For the rest of the toolbox, from what ping really measures to continuous path testing with MTR, head back to the Ping, Traceroute & Friends pillar.


Put this into practice with SysPeep Monitor

A one-liner proves a port is open right now; monitoring is remembering to ask every few minutes, forever. That's what SysPeep Monitor is for. It is a central service on one Windows machine (with optional remote probes for other sites). It auto-discovers your devices, collects health and performance data, and alerts you when answers change. Its dependency rules keep the noise down. The free trial installs in minutes.

Download Free TrialLearn About SysPeep