How to Use TCP Ping to Test a Server That Blocks ICMP
When a server blocks ICMP, standard Ping requests may consistently time out even though its website, SSH service, or other TCP services are working normally. In this situation, you can use a method commonly called TCP Ping: initiate a TCP connection to the target service port and observe whether the connection is established and how long it takes. For example, when checking an HTTPS service, prioritize TCP 443 rather than choosing an unrelated port simply to make the probe succeed.
The key distinctions are these: a successful TCP connection shows that the connection path from the current client to the target IP and port is available at that moment; a refused connection means an explicit rejection signal was received; and a timeout means only that the connection was not established within the specified time—not necessarily that the server is down. If a CDN, load balancer, layer-four proxy, or SYN proxy is involved, the successful response may come from an ingress device rather than the final application server.
Start troubleshooting by confirming the address and service port, then make a small number of TCP connection attempts. Once a connection succeeds, check TLS and the application response. The following analysis and verification methods are based on protocol behavior, not findings from live tests. For curl options, consult its official manual. For other tools, use the help provided by the locally installed version. All domain names and IP addresses in this article are examples; replace them with targets you are authorized to test before running the commands.
Why TCP Ports Can Still Work When ICMP Does Not Respond
ICMP Echo and TCP Connections Are Subject to Different Policies
Common Ping tools send ICMP Echo Requests and wait for Echo Replies. TCP services, by contrast, receive connection requests at a target IP address and port. Although both depend on IP networking, firewalls can handle them separately: rejecting or dropping ICMP Echo while allowing TCP 443 is a perfectly possible configuration.
Strictly speaking, “Ping fails” means that an ICMP probe did not receive the expected response. The server may restrict Echo requests, an intermediate device may filter the reply, or there may indeed be a fault with routing, the host, or the return path. A client-side timeout alone cannot establish which rule, if any, is enabled on the target. Confirming that ICMP is blocked requires additional evidence from known configurations, device logs, or authorized packet captures.
Conversely, a successful Ping does not prove that a website is working. The TCP port may not be listening, the TLS certificate may not match, or the application may return errors. Assessing ICMP and TCP separately avoids repeated trial and error around the overly broad question of whether a server is online.
There is another important distinction: not responding to Echo does not mean all ICMP should be blocked. Some ICMP error messages support path failure reporting and Path MTU Discovery, while ICMPv6 also serves critical functions such as Neighbor Discovery in IPv6 networks. The fact that TCP Ping can replace some reachability checks does not mean that disabling ICMP entirely will have no effect on services.
TCP Ping Is Not a Single Standardized Protocol or Tool
“TCP Ping” generally refers to using TCP packets to assess port reachability, but different tools measure different events. Some call the operating system's connect(), establish a full connection, and close it immediately. Others send raw SYN packets and wait for SYN-ACK or RST responses without necessarily establishing a full session.
The full-connection approach generally does not require raw socket privileges and closely resembles how an ordinary application connects. Raw SYN probing usually requires administrator or root privileges, or the appropriate network capabilities. It may be better suited to observing packet-level responses, but receiving a SYN-ACK still does not mean the application has processed a request. A device using a SYN proxy can even respond to the client before a backend connection has been established.
Before comparing the “latency” reported by two tools, check exactly what each measures. Whether DNS resolution is included in the timing, whether the tool waits for retransmissions, whether it counts refused connections as successful probes, and whether it completes the handshake all affect the result. Measurements are not equivalent simply because both are expressed in milliseconds.
Choose the Correct Target IP and Service Port
The Port Must Match the Service You Need to Verify
HTTPS commonly uses port 443, and HTTP commonly uses port 80, but production services may use other ports. Determine the target from the actual access URL, service configuration, or operations records. Do not assume that a commonly used port is open. A refusal on TCP 80 may be entirely normal on a server that does not host an HTTP service.
If you are checking a management endpoint, test its actual management port. If you are checking a website, test its public-facing endpoint. Do not expose databases, management consoles, or similar services to the public internet merely to make probing easier. Checks should follow an already permitted access path, such as an existing VPN, bastion host, or private-network probe location for restricted ports.
TCP port tests cannot replace checks of UDP services either. Testing TCP 443 alone, for example, does not verify the HTTP/3 path over UDP; testing TCP 53 does not fully establish the availability of UDP DNS queries. The word “Ping” in a tool's name does not mean it covers every transport protocol.
A Domain May Resolve to Multiple Addresses—or Only to a CDN Endpoint
When testing a domain over TCP, a tool typically resolves the domain first and then chooses an address to connect to. If the domain has multiple A or AAAA records, one successful attempt only establishes success for the selected address. IPv4 success does not establish IPv6 availability either. Record the remote address shown by the tool and test both address families separately when necessary.
When a domain uses a CDN or load balancer, a TCP 443 test against that domain generally verifies the connection from the client to the ingress endpoint, not the connection from that endpoint to the origin. Even if the origin has stopped serving requests, the ingress endpoint may still complete the TCP handshake and then return an error page. If TCP succeeds but the website still has problems, shift the investigation to TLS, HTTP, and the backend path. Do not keep repeating handshakes as proof that the origin is healthy.
For help determining whether a domain uses an acceleration or proxy service, see provider identification and supporting node checks. However, identification results cannot replace server configuration and connection logs, and an IP label alone cannot establish the full delivery path.
Windows: Check the Port with Test-NetConnection
In Windows PowerShell, start with Test-NetConnection rather than immediately installing similarly named third-party TCP Ping tools from different sources. In a Windows environment that provides this command, run:
Test-NetConnection -ComputerName www.example.com -Port 443 -InformationLevel Detailed
Focus on RemoteAddress, RemotePort, SourceAddress, and TcpTestSucceeded. RemoteAddress is the remote address actually attempted in this test. SourceAddress helps establish whether the request left through the expected network interface or VPN egress. TcpTestSucceeded indicates whether the TCP connection test succeeded.
TcpTestSucceeded : True confirms that this particular port connection was established, but it does not check the certificate, HTTP status, or page content. If the tool also displays a Ping warning, read the ICMP and TCP results separately. An ICMP timeout does not invalidate a successful TCP result.
If the result is False, also check whether DNS resolution succeeded, which address was selected, and whether the error relates to local routing or network permissions. To rule out changes in DNS resolution, replace ComputerName with an authorized, confirmed target IP and test IPv4 and IPv6 separately. When recording the result, specify the address rather than broadly stating that the entire domain is unreachable.
This command is primarily useful for a quick port check. Do not interpret any Ping round-trip time it displays as the TCP connection time. The script's total runtime may also include resolution, diagnostics, and waiting for failures, so it cannot be treated as the latency of a single handshake. To observe connection times repeatedly, use the explicit timing method below.
Linux: Use nc to Verify TCP Connection Establishment
On Linux, you can perform a lightweight check with an installed netcat implementation. The commonly used OpenBSD netcat supports the following syntax:
nc -4 -vz -w 3 www.example.com 443
nc -6 -vz -w 3 www.example.com 443
Here, -4 and -6 restrict the address family, -v displays connection information, -z checks the port without sending normal application data, and -w 3 sets a waiting limit. Different distributions may install traditional netcat, OpenBSD netcat, or another compatible implementation. Options and timeout semantics vary, so check nc -h before running the command rather than assuming one implementation's behavior applies everywhere.
A message such as succeeded usually means the TCP connection was established. Connection refused means the connection was explicitly rejected, while a timeout means no connection was established within the waiting period. English output messages are not standardized; interpret them alongside the exit status and the behavior of the actual implementation.
nc is useful for answering whether a port accepts connections, but many versions do not directly report reliable millisecond-level connection times. Wrapping the entire command with the shell's time may include process startup, name resolution, and error output. It is especially unsuitable for comparing very small differences in network latency.
Also, -z does not mean the server sees nothing. Closing a connection after a complete handshake can still generate connection records. Services that expect immediate protocol data may also log empty connections or aborted handshakes. Make only a small number of probes against authorized ports, and do not turn a single-port diagnostic check into an unauthorized scan.
For Repeated TCP Ping Tests, Set Explicit Attempt and Timeout Limits
A single result is not enough to investigate intermittent problems. To observe whether connections fail intermittently, you can use Python 3 to connect repeatedly to a fixed address. The following script does not query DNS or send application data. It creates a new connection for each attempt and records successful connections, refusals, timeouts, and other errors separately:
import socket
import time
from datetime import datetime, timezone
host = "203.0.113.10"
port = 443
count = 10
family = socket.AF_INET6 if ":" in host else socket.AF_INET
for attempt in range(1, count + 1):
with socket.socket(family, socket.SOCK_STREAM) as conn:
conn.settimeout(3.0)
started = time.perf_counter()
try:
conn.connect((host, port))
result = "connected"
except ConnectionRefusedError:
result = "refused"
except socket.timeout:
result = "timeout"
except OSError as error:
result = f"os_error={error.errno}"
elapsed_ms = (time.perf_counter() - started) * 1000
stamp = datetime.now(timezone.utc).isoformat(timespec="seconds")
print(f"{stamp} attempt={attempt} result={result} elapsed_ms={elapsed_ms:.2f}")
if attempt < count:
time.sleep(1)
Before running it, replace host with a real address you are authorized to test. The script selects IPv6 or IPv4 based on whether the value contains a colon, so enter a numeric address here, not a domain name. The documentation example address is not a server available for actual testing. To compare different addresses, keep the port, execution environment, timeout, and attempt count consistent, run each test separately, and save the output.
connected means that connect() returned successfully. Its elapsed time includes local scheduling, protocol stack processing, and waiting for the network handshake. It is neither pure network propagation delay nor server application processing time. The operating system may retransmit SYN packets before the timeout, so a connection that succeeds close to the timeout limit does not necessarily mean the route is simply very long.
For timeout, the reported duration is how long this failed attempt waited, not a usable successful-connection latency. For refused, a quick return means the rejection signal arrived quickly; it does not mean the service responds quickly. Summarize each result category separately, calculate connection times only from successful samples, and make clear that failures have not been hidden or replaced with zero.
Ten attempts is merely an example count suitable for manual diagnostics, not proof of availability or long-term stability. To calculate tail latency, collect enough samples and retain the raw records. Do not simply average the P95 values of multiple small samples. The timeout threshold must also match the application's connection budget: a very short threshold may declare failure prematurely, while a very long one delays detection of problems.
This type of script waits one second after each connection attempt finishes, so the actual interval also includes the connection time; it does not start a new attempt exactly once per second. Do not use unlimited concurrency to generate denser measurements. Large numbers of short-lived connections consume client ephemeral ports, NAT state, and server connection resources, potentially making the diagnostic process itself a source of disruption.
How to Interpret Success, Refusal, and Timeout
Test result | What it supports | What remains unknown | Recommended next step |
|---|---|---|---|
TCP connection established | The target endpoint on the current path accepted a connection | Whether TLS, application content, and the backend origin are working | Send an application request using the matching domain name |
Connection refused | An active rejection related to this connection was received | Whether the rejection came from the target host or an intermediate device | Check the listening address, port, and rejection rules |
Connection timed out | The connection was not established within the time limit | Whether the cause is dropping, congestion, routing, or a return-path problem | Compare client-side and server-side packet captures |
DNS resolution failed | No usable target address has been obtained | Whether the target port is actually reachable | Troubleshoot resolution separately and test a confirmed IP |
Local permission or routing error | The probe may not have left the client correctly | The remote system's state | Check local networking, routing, and execution permissions |
Connection Refused: Check Listening Ports First, Not Just the Firewall
When a TCP SYN reaches a port with no listener, the target protocol stack usually returns an RST. A firewall configured to actively reject traffic, a proxy, or another intermediate device may also generate a rejection signal. A refusal therefore usually provides more information than a timeout, but it does not prove that the application server issued it.
If you have server access, check whether the application is running, whether the port is correct, whether it listens only on a loopback address, and whether it is in another container or network namespace. For example, if an application binds only to 127.0.0.1, successful local access and failed public access are entirely consistent. Whether an application bound to an IPv6 wildcard address also accepts IPv4 depends on the socket and system configuration. A single listening entry is not enough to draw that conclusion.
Connection Timeout: Dropped Packets Are Only One Possible Cause
Silently dropped SYN packets, filtered returning SYN-ACK packets, an unreachable route without effective error feedback, and pressure on connection-tracking resources can all appear as timeouts. Client egress policies and target ingress policies may also treat different source addresses differently.
If the same address and port work from the server itself but time out externally, focus on the listener's exposure and the network path. If a local connection also fails, resolve the service's listening configuration first. This sequence is more effective than immediately changing the public-facing firewall, and it avoids expanding exposure merely to “rule out a network problem.”
When individual attempts alternate between success and failure, also check whether DNS is rotating through different addresses, whether the local VPN is changing paths, whether the service is restarting, and whether the ingress endpoint rate-limits short-lived connections. First control these factors that can change the target or path under test, then investigate network jitter.
After TCP 443 Succeeds, Verify the Next Layer with an HTTPS Request
TCP Ping does not send a TLS ClientHello, so it does not verify certificates, domain SNI, protocol negotiation, or HTTP responses. To verify an HTTPS service, make a request using its actual domain name. In Linux or a Unix-like shell, run:
curl --noproxy '*' -4 --http1.1 \
--connect-timeout 3 --max-time 10 \
-sS -o /dev/null \
-w 'ip=%{remote_ip} code=%{http_code} dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} first_byte=%{time_starttransfer} total=%{time_total}\n' \
https://www.example.com/
This command makes a GET request, discards the response body, does not automatically follow redirects, and forces HTTP/1.1 to keep the focus on TCP, TLS, and a single request. --noproxy '*' excludes the influence of curl's explicit proxy settings, but it cannot bypass transparent proxies, VPNs, or network devices. If normal access requires a proxy, bypassing it tests a different path; adjust the test to match the actual access method instead.
These timing fields are cumulative from the start of the request, not durations for independent stages. For a single direct request using a new connection without redirects, time_connect - time_namelookup can approximate the TCP connection phase, while time_appconnect - time_connect can help assess the TLS phase. time_starttransfer also includes the preceding connection process, sending the request, and waiting for the first byte. It cannot simply be called application execution time.
The command does not use -L, so if a redirect occurs, it observes only the first hop. Adding redirects or proxy tunnels, or reusing connections within the same curl process, requires corresponding changes to how the timings are interpreted. For failed requests, some fields may be zero or incomplete. Check curl errors and the exit status as well, and do not interpret zero as “no latency.”
If TCP succeeds but TLS fails, check the certificate chain, domain matching, TLS configuration, and handshake-stage policies. If TLS succeeds but HTTP returns an error, continue with routing, authentication, the application, and upstream dependencies. HTTP 200 only indicates a successful HTTP status. Application health checks must also validate the agreed fields or response content rather than reading the status code alone.
Preserve Host and TLS SNI When Specifying an Origin IP
If you are authorized to direct the same HTTPS request to a particular origin server, add --resolve www.example.com:443:203.0.113.10 to the command above while retaining https://www.example.com/ as the URL. This specifies the connection address while preserving the domain's Host and TLS SNI.
Do not access https://203.0.113.10/ directly and then conclude that the origin is faulty because the certificate does not match or the request reaches the default virtual host. Nor should you habitually add -k to hide certificate issues. If the origin uses a certificate trust system intended only for origin connections, validate it according to the existing trust design rather than weakening verification standards for public clients.
When comparing the ingress endpoint and origin, keep the URL, method, request headers, and source network as consistent as possible, and record whether the cache is warm or cold, the request time, and the sample count. The origin may accept connections only from designated origin-fetch egress addresses, so a failed direct connection may be consistent with its security design. An edge cache hit may not trigger an origin request at all. Different results on the two paths are therefore diagnostic clues, not conclusions that can be interpreted without architectural context.
Use Server-Side Listening State and Packet Captures to Locate Timeouts
With server access, keep the minimum verification focused on one clearly defined port. The following Linux examples require appropriate permissions for packet capture. Before running them, confirm that the target is actually on the current host or in the current network namespace:
ss -lnt '( sport = :443 )'
sudo tcpdump -ni any -nn -c 30 'tcp port 443 and host 203.0.113.10'
ss checks the listening state and bound address for local TCP 443. Replace 203.0.113.10 in the capture expression with the probe's source address as actually seen by the server. With NAT, this is usually not the private address of the client's network interface. The command limits the capture by port, host, and packet count, then exits when that count is reached. In low-traffic conditions, stop it with Ctrl+C rather than capturing unrelated connections for a long period.
Observe the server while making a small number of probes from the client. If no SYN packets appear, first confirm that the capture location, interface, network namespace, and filter are correct. Then investigate cloud security policies, perimeter firewalls, NAT forwarding, and the upstream path. The absence of captured packets on one host does not by itself prove that a carrier is dropping them.
If SYN packets appear but no SYN-ACK or RST follows, assess the host firewall, listening state, and kernel resources together. The presence of a listening port does not guarantee that every connection can be accepted. Connection queue pressure, filtering rules, or policy routing may still affect responses. Rule counters, service logs, and connection-related statistics can provide additional evidence, but correlate them within the same time window.
If the server sends a SYN-ACK but the client still times out, continue investigating the return path, egress policies, NAT state, and client firewall. Asymmetric routing may send requests and replies through different devices. A packet captured as “sent” on one side has not necessarily been received on the other. When needed, capture at both ends and correlate the same connection using addresses, ports, sequence numbers, and timestamps.
For a tool that establishes a full connection, observing SYN, SYN-ACK, and ACK means the TCP handshake completed. An immediate close afterward may simply be the probe's expected behavior. A raw SYN probe, however, cannot be expected to send the ACK required to establish a connection. Know which implementation the client tool uses before interpreting the capture.
Keep Access Scope Minimal When Fixing Port Problems
If a port is not listening, fix service startup, the bind address, container port publishing, or load balancer backend configuration rather than adding firewall allowances first. If a rule is blocking the connection, adjust only the direction, protocol, port, and authorized sources relevant to that service, retaining existing access restrictions.
If temporary rules are needed for verification, record the original configuration, rule order, and scope of the change, and limit both the test sources and the validity period. Remove the temporary rules or roll back afterward, then verify again that existing services remain accessible and unauthorized sources remain restricted. Do not disable an entire firewall, WAF, or cloud security policy just to obtain a successful result.
When an origin permits connections only from a CDN or dedicated proxy, a failed public TCP Ping may not need fixing. The correct approach is to verify origin connectivity from an allowed ingress point or diagnostic environment, not to expose the origin further for external monitoring. The same principle applies to management ports intended only for internal access.
If ICMP Echo restrictions are intentional, there is no need to remove them merely to restore a green Ping indicator. A better approach is to distinguish ICMP probes, TCP connections, TLS handshakes, and application health explicitly in monitoring. Each failure points to a different layer, and alert names should accurately identify what failed.
How to Confirm the TCP Ping Investigation Is Complete
After a fix, retest from the client path that originally failed rather than confirming success only on the server itself. Keep the same target address, port, address family, and timeout, then repeat a small number of connection attempts to ensure the result does not depend on a single lucky success. If the original problem affected IPv6, IPv4 results alone are not sufficient for acceptance.
Next, verify the corresponding application operation. For HTTPS, at minimum, confirm that TLS identity verification works and the expected HTTP route is available. For an application health endpoint, also check the response content. If the problem involves a CDN or proxy, verify the client-facing endpoint and the necessary backend path separately. Do not treat an ingress handshake as origin acceptance testing.
When documenting the conclusion, “TCP 443 connections from the specified client to the specified IP succeeded during this test window” is more accurate than “the server is completely healthy.” For refusals and timeouts, retain the result category, occurrence time, and server-side observations as well. This makes it possible to compare like-for-like symptoms if the issue recurs.
TCP Ping is valuable because it lets you continue checking a specific TCP service endpoint when ICMP does not respond—not because it can certify the health of an entire server through a different kind of probe. If a connection fails, investigate listening state, filtering, and the outbound and return paths. If it succeeds, move on to TLS and the application layer. Letting each step answer only the questions it can actually resolve shortens troubleshooting and avoids unnecessary security configuration changes.
- TCP Ping
- blocking ICMP
- server not responding to Ping
- TCP port testing
- Test-NetConnection
- checking ports with nc
- TCP connection timeout
- HTTPS connection troubleshooting