ICMP Ping Success vs. Port 443 Reachability
Easy · Software Engineering Fundamentals · Software Engineer · Onsite
Prompt
Suppose running ping api.payments.example from your workstation returns normal echo replies with 0% packet loss. Does that result guarantee that port 443 on api.payments.example is reachable? Justify your answer, and walk through the concrete steps and command-line tools you would run from your workstation to verify connectivity to port 443.
State any assumptions you would clarify with the interviewer first—such as whether middleboxes (stateful firewalls, cloud security policies, NAT gateways, or reverse proxies) sit on the network path, whether "reachable" refers strictly to completing a transport-layer socket handshake or completing a valid HTTPS exchange, and whether you only care about access from your current client network or across the public internet.
Scope & Expectations
- Contrast the network-layer diagnostic protocol behind
pingwith the transport- and application-layer protocols used on port443, noting which component on the host answers each one. - Identify realistic network and host scenarios in which
pingreplies succeed even though traffic to port443fails. - Demonstrate direct client-side command-line probes for TCP and HTTPS on port
443, explaining how to distinguish open, connection-refused, and timeout results. - Describe a systematic fault-isolation workflow to pinpoint where packets stop when port
443cannot be reached.
Step-by-step walkthrough
Direct answer: ping and port 443 use different protocols
No — a successful
pingdoes not mean port443is reachable. All apingproves is that an ICMP (Internet Control Message Protocol — a network-layer diagnostic protocol used for status and error messages) Echo Request reached some device at that IP address and an Echo Reply made it back to your machine.Port
443belongs to transport-layer protocols thatpingnever touches:Tool / Traffic Layer & Protocol Port concept? Who answers on the server? ----------------- --------------------------------------- -------------- ------------------------------------------ ping (IPv4) Layer 3: ICMP (IP protocol 1) No ports OS kernel network stack (Echo 8 -> Reply 0) ping (IPv6) Layer 3: ICMPv6 (Next Header 58) No ports OS kernel network stack (Echo 128 -> 129) HTTPS (HTTP/1.1,2) Layer 4: TCP (IP protocol 6) Port 443 User-space web server or proxy (e.g. Nginx) HTTPS (HTTP/3) Layer 4: QUIC over UDP (IP protocol 17) Port 443 User-space QUIC/HTTP/3 server or proxyBecause TCP (Transmission Control Protocol — a connection-oriented transport protocol that numbers application endpoints with ports
0–65535) and UDP (User Datagram Protocol — a connectionless transport protocol that also uses ports0–65535) are separate protocols from ICMP:- Every packet filter, router, and cloud security policy on the route evaluates ICMP and TCP port
443under separate rule sets. - The operating system kernel answers
pingautomatically even if the web server process has crashed or was never installed.
To know whether port
443onapi.payments.exampleis usable, you must probe port443itself from the client network you care about.- Every packet filter, router, and cloud security policy on the route evaluates ICMP and TCP port
Checklist: what HTTPS needs vs what ping actually tests
Align with the interviewer on whether "reachable" means "a TCP socket handshake completes on port 443" or "an HTTPS client completes a verified request". Putting every requirement side by side shows why
pingcannot prove either one:Requirement Tested by ping? TCP connect :443 Full HTTPS request ----------------------------------------------------------- ---------------- ----------------- ------------------ 1. DNS resolves hostname to the intended IP (A or AAAA) Yes* Yes* Yes 2. IP routing exists from client to server and back Yes Yes Yes 3. Firewalls / security groups allow ICMP Echo Yes No (not needed!) No (not needed!) 4. Firewalls / security groups allow TCP to port 443 No Yes Yes 5. A process is actively listening on port 443 on that IP No Yes Yes 6. Return path allows TCP replies back to client No Yes Yes 7. TLS handshake succeeds (packet size, TLS version/cipher) No No Yes 8. Server certificate is valid, unexpired, and matches host No No Yes 9. Web application responds healthy (e.g. HTTP 200) No No Yes * Only if you ran the command with the hostname rather than a raw IP address.pingchecks items 1–3, and item 3 is not even required for HTTPS. Items 4–9 remain completely untested.Five real-world reasons ping succeeds while port 443 fails
In production networks,
pingand port443routinely give opposite answers for five concrete reasons:- Protocol- and port-specific firewall rules: a cloud security group (virtual instance firewall) evaluates each rule per protocol and port range:
text Security Group A: Allow TCP 443 from 0.0.0.0/0 -> ping FAILS, HTTPS WORKS from anywhere Security Group B: Allow ICMP Echo from 0.0.0.0/0 Allow TCP 443 from 10.0.0.0/16 -> ping WORKS from anywhere, port 443 WORKS only inside 10.0.0.0/16- No process listening on the public interface: Nginx or Envoy may be stopped, listening on port
8443instead of443, or bound only to loopback (127.0.0.1:443) instead of0.0.0.0:443. The OS kernel still answersping, while TCP port443immediately rejects connections. - A middlebox answers the ping: behind DNAT (Destination Network Address Translation — a router or firewall feature that rewrites a public IP/port to a private backend server) or an edge load balancer, the public IP belongs to the front box. Its Echo Reply only proves the front box is alive, not that port
443is forwarded or that the backend pool is up. - IPv4 vs IPv6 path split: if DNS publishes both an
Arecord (IPv4) and anAAAArecord (IPv6),pingmay test IPv4 while your browser connects over IPv6 (or vice versa), hitting different routes and firewall policies. - MTU black holes break TLS after ping and TCP succeed: MTU (Maximum Transmission Unit) is the largest IP packet size in bytes a link can forward without fragmentation (
1500bytes on standard Ethernet, often1400–1420bytes inside VPN or overlay tunnels). A default Linux or macOSpingsends a56-byte payload (56 + 8 ICMP header + 20 IPv4 header = 84bytes total), and TCPSYNpackets are only40–60bytes, so both slip easily through a1400-byte tunnel. During TLS (Transport Layer Security — the cryptographic protocol that encrypts HTTPS), the server sends its multi-kilobyte certificate chain in full1500-byte packets with the "Don't Fragment" (DF) flag set. If a firewall drops the tunnel's ICMP "Fragmentation Needed" error, the TLS handshake stalls! You can test path MTU directly by settingDFand varying payload size:ping -M do -s 1472 hoston Linux (ping -D -s 1472 hoston macOS) sends1472 + 8 + 20 = 1500bytes; if-s 1372(1400bytes) succeeds while-s 1373(1401bytes) fails, the path MTU is1400bytes.
Test port 443 directly from your workstation
Run a tool that opens a real TCP connection (and optionally a TLS/HTTPS session) to
api.payments.example:443from the exact client workstation or network in question:# 1. Pure TCP port reachability (Layer 4 only): nc -vz -w 3 api.payments.example 443 # netcat: 3-second timeout, connect and close Test-NetConnection api.payments.example -Port 443 # Windows PowerShell: check "TcpTestSucceeded : True" nmap -Pn -p 443 api.payments.example # reports open / closed / filtered (-Pn skips ping check) # 2. Full HTTPS check (DNS -> TCP -> TLS -> HTTP): curl -v --connect-timeout 5 https://api.payments.example/ # prints resolved IP, TCP connect, TLS version, HTTP status # 3. Deep TLS and certificate inspection: openssl s_client -connect api.payments.example:443 -servername api.payments.exampleAlways pass
-servernametoopenssl s_clientso it sends SNI (Server Name Indication — a TLS handshake field telling a server that hosts multiple domains which hostname's certificate to present). Also remember that a test speaks only for the network where you ran it: to verify "reachable from anywhere on the public internet," run checks from external vantage points (such as cloud VMs in multiple regions or synthetic probes), and test UDP port443separately (curl --http3) if HTTP/3 matters.Interpret the three TCP outcomes: open, refused, and timed out
Opening a TCP connection starts with a three-way handshake: the client sends a
SYN(synchronize) packet, an open server answersSYN-ACK(synchronize-acknowledge), and the client repliesACK(acknowledge). What comes back after yourSYNimmediately narrows down the root cause:Client sends TCP SYN -> port 443: Case 1 (OPEN): Client ---SYN---> Server Client <--SYN-ACK- Server => Port 443 is open and accepting connections. Case 2 (CLOSED): Client ---SYN---> Server Client <--RST----- Server => "Connection refused": packets reached the host, but no process is listening on port 443 (or a firewall rule explicitly rejected with TCP reset). Case 3 (FILTERED): Client ---SYN---> [X] => "Connection timed out": a firewall silently dropped (silence until timeout) the SYN (or dropped the returning SYN-ACK), or no valid route exists.Notice the diagnostic gold in Case 2 vs Case 3: Connection refused arrives in milliseconds and proves network routing is working; Connection timed out means packets are disappearing in transit.
Always pass an explicit timeout (
-w 3or--connect-timeout 5). Without one, the OS retries a droppedSYNwith exponential backoff: on Linux with the classic default1 sinitial timeout andnet.ipv4.tcp_syn_retries = 6, retries fire after1 + 2 + 4 + 8 + 16 + 32 = 63 sand the final wait adds64 s, blocking your terminal or script for roughly127 s(over two minutes; macOS waits ~75 s).Pinpoint where dropped packets stop along the path
When port
443times out from your laptop, isolate the faulty hop systematically:- Compare vantage points: test on the server itself (
curl -vk https://127.0.0.1/), from a sibling VM in the same subnet, from your laptop, and from an independent network (such as a phone hotspot). Working on127.0.0.1but failing from the same subnet points to a wrong bind address or host firewall; working from the subnet but timing out from outside points to a perimeter firewall, security group, or return-path bug. - Verify the listening socket on the server: run
ss -ltnp | grep ':443'on Linux (netstat -an | grep 443elsewhere). Confirm a process is bound to0.0.0.0:443or[::]:443rather than only127.0.0.1:443. - Capture packets on the server while attempting to connect: run
tcpdump -ni any 'tcp port 443 and host <client-ip>':- No
SYNarrives: an upstream security group, perimeter firewall, or client egress filter dropped it before reaching the host. SYNarrives, nothing leaves: the server's own host firewall (iptables/nftables/ufw) dropped it (tcpdumpsees incoming frames before Linux netfilter rules run).SYNarrives,SYN-ACKleaves, client still times out: the return path is broken (for example, a stateless network ACL — a packet filter that checks inbound and outbound rules independently without remembering active connections — is blocking outbound traffic to the client's high-numbered ephemeral source port, or asymmetric routing is bypassing a stateful firewall).
- No
- Run a TCP traceroute on port 443: use
traceroute -T -p 443 hostormtr -T -P 443 hostso the TTL-limited probe packets are real TCPSYNs to port443rather than ICMP or high-port UDP probes that firewalls treat differently.
- Compare vantage points: test on the server itself (
Automate a layered check in Python
Writing the check in Python makes each layer (DNS -> TCP -> verified TLS) explicit and reports the exact layer that failed instead of lumping every failure into "site down":
import socket import ssl def check_https_port(host: str, port: int = 443, timeout: float = 3.0) -> str: """Test DNS, TCP connect, and verified TLS on host:port, reporting which layer failed.""" # Layer 1: resolve hostname to stream (TCP) socket addresses. try: addr_infos = socket.getaddrinfo(host, port, type=socket.SOCK_STREAM) except socket.gaierror as err: return f"DNS failed for {host}: {err}" ip = addr_infos[0][4][0] # Layer 2: attempt TCP three-way handshake with an explicit short timeout. try: raw_sock = socket.create_connection((ip, port), timeout=timeout) except ConnectionRefusedError: return f"TCP refused by {ip}:{port} (RST received: host reachable, nothing listening)" except (TimeoutError, socket.timeout): return f"TCP timed out to {ip}:{port} (SYN or SYN-ACK dropped by firewall or routing)" except OSError as err: return f"TCP error to {ip}:{port}: {err}" # Layer 3: run TLS handshake with SNI (server_hostname) and full certificate verification. tls_context = ssl.create_default_context() with raw_sock: try: with tls_context.wrap_socket(raw_sock, server_hostname=host) as tls_sock: tls_version = tls_sock.version() except ssl.SSLCertVerificationError as err: return f"TCP open on {ip}:{port}, but certificate verification failed: {err.verify_message}" except (ssl.SSLError, OSError) as err: return f"TCP open on {ip}:{port}, but TLS handshake failed: {err}" return f"OK: {ip}:{port} accepted TCP and completed a verified {tls_version} handshake"Calling
check_https_port("localhost", 1)fails in milliseconds with"TCP refused...", calling it against a firewalled port fails cleanly after3.0 swith"TCP timed out...", and a healthy HTTPS server returns"OK: ... TLSv1.3 handshake". In production, iterate over every address inaddr_infosso a broken IPv6 or secondary IPv4 record cannot hide behind one healthy address.
Intuition & how it works
Think of a server's IP address as a large office building, and port 443 as Room 443 inside where the HTTPS reception desk operates. Running ping is like pressing the building's street intercom and hearing the lobby guard buzz back: it proves the street address exists and the guard is allowed to answer the intercom, but it tells you nothing about whether building security lets visitors walk up to Room 443, whether anyone is sitting at the desk inside Room 443, or whether their ID badge is valid.
Why does the naive assumption ("ping works, so the website port must be reachable") fail? First, ping uses ICMP (Internet Control Message Protocol — a network-layer diagnostic protocol that has no port numbers at all), whereas HTTPS runs over TCP (Transmission Control Protocol — a connection-oriented transport protocol using ports 0–65535) on port 443, or over UDP (User Datagram Protocol) port 443 for HTTP/3, and firewalls filter each protocol and port independently. Second, the operating system kernel answers ping automatically in the background even when the web server process has crashed. Third, a front-end load balancer or NAT gateway may answer ping at the public IP while dropping or failing to forward port 443 traffic, or a TLS (Transport Layer Security — the encryption layer inside HTTPS) handshake may stall on oversized packets even after small ping packets succeed.
Trace 4 probes from your workstation (198.51.100.42) to api.payments.example (203.0.113.85) to see how completely independent the outcomes are:
- Ping succeeds (
12 ms): your workstation sends an84-byte ICMP Echo Request (56data +8ICMP +20IPv4 bytes); the firewall permits ICMP and the server's OS kernel replies with an Echo Reply. - Port 443 filtered (
3.0 stimeout): your workstation sends a TCPSYN(connection-start) packet to203.0.113.85:443, a cloud security policy silently drops TCP443from external IPs, andnc -vz -w 3fails withConnection timed out. - Port 443 closed (
12 msrefused): you open the firewall rule, send another TCPSYNto:443, the packet reaches the server while Nginx is stopped, and the OS kernel immediately answers with a TCPRST(reset) packet —ncfails withConnection refused. - Port 443 healthy (
35 msHTTP 200): you start Nginx on0.0.0.0:443; nowSYNreceivesSYN-ACK, the client finishes TCP + TLS certificate verification, andcurl -v https://api.payments.example/receivesHTTP/2 200.
Key points
- Independent protocols and layers:
pingtests Layer 3 ICMP Echo (IP protocol1, no ports), whereas HTTPS tests Layer 4 TCP port443(IP protocol6) or QUIC over UDP port443(IP protocol17) plus Layer 7 TLS and HTTP. - Narrow meaning of ping: a successful
pingproves bidirectional IP routing for small ICMP packets and an active network stack at that IP—not firewall permission for TCP443, a listening process, backend health behind NAT/load balancers, or valid TLS certificates. - Direct port and service tools: use
nc -vz -w 3 host 443,Test-NetConnection host -Port 443, ornmap -Pn -p 443 hostto test raw TCP reachability; usecurl -v --connect-timeout 5 https://host/andopenssl s_client -connect host:443 -servername hostto verify TLS and HTTP. - Three diagnostic TCP states:
SYN-ACKmeans open;RST(Connection refused) means packets reached the host's IP stack but nothing is listening on port443; silence (Connection timed out) means a firewall or routing hop silently dropped theSYNorSYN-ACK. - Packet-size mismatch (MTU): default
pingpackets are84bytes while TLS certificate flights fill1500-byte Ethernet frames; if a VPN/tunnel has a1400-byte MTU (Maximum Transmission Unit — the largest unfragmented IP packet a link carries) and ICMP "Fragmentation Needed" errors are blocked,pingand TCP connect both pass while TLS hangs. - Fault localization workflow: compare vantage points (
127.0.0.1, same subnet, laptop, phone hotspot), check listening addresses withss -ltnp, capture on the server withtcpdumpto see whetherSYNarrives andSYN-ACKleaves, and runtraceroute -T -p 443.
Common mistakes
- Treating ping failure as "server down" or ping success as "HTTPS up": production clouds (such as default AWS security groups) routinely block inbound ICMP Echo while serving HTTPS on TCP
443normally, and vice versa. - Testing from the wrong network vantage point: running
curl https://localhost/on the server bypasses every network firewall and even succeeds when the service mistakenly bound to127.0.0.1:443instead of0.0.0.0:443. - Running
curl,nc, ortelnetwithout an explicit timeout: OS kernel SYN retries wait ~75–127 sbefore giving up on a silently dropped port, stalling scripts and CI jobs. - Confusing
Connection refusedwithConnection timed out:refusedproves routing and firewall transit succeeded and points straight to the server process or bind address;timed outpoints to packet filtering or routing on the path. - Testing only one IP address when DNS returns several: a hostname with both
A(IPv4) andAAAA(IPv6) records, or multiple round-robinArecords, can succeed on one IP while failing for users who land on another. - Passing
curl -k(disabling certificate checks) in monitoring scripts: masks expired certificates, wrong hostnames, and missing intermediate certificates that break real browsers and API clients.
Follow-up questions
- Suppose ICMP echo requests time out, yet HTTPS requests to the same host succeed. What network configurations explain this behavior? Most commonly, a perimeter firewall, cloud security policy, or edge load balancer permits inbound TCP port
443while dropping or rate-limiting inbound ICMP Echo Requests. Another frequent case occurs inside enterprise networks where workstations reach external sites through an explicit HTTPS forward proxy while direct outbound ICMP from client subnets is blocked at the gateway. Because HTTPS runs over TCP (or QUIC over UDP) and never sends ICMP Echo messages, droppingpinghas zero impact on normal HTTPS sessions unless oversized-packet ICMP "Fragmentation Needed" errors are also filtered out. - Connecting to TCP port 443 succeeds from a peer VM inside the target subnet, yet hangs until timeout from your workstation. Which culprits are most likely, and how would you isolate the cause? Because the in-subnet VM connected (confirming the server process is listening on
0.0.0.0:443or its subnet IP) and your workstation timed out rather than receivingConnection refused, packets are silently disappearing between the external network and the subnet. Typical culprits are a security group allowing TCP443only from internal CIDR blocks (such as10.0.0.0/16), an upstream perimeter firewall, a stateless network ACL (a subnet packet filter that evaluates inbound and outbound rules separately, dropping returnSYN-ACKpackets destined for the workstation's high-numbered ephemeral port such as54321), or outbound filtering on the workstation's network. Isolate the hop by runningtcpdump -ni any 'tcp port 443 and host <workstation-public-ip>'on the server during a test: no incomingSYNpoints to an upstream or client-egress drop (test via a cellular hotspot to separate the two), whereasSYNarriving andSYN-ACKdeparting points to a broken return route or stateless outbound ACL. - A TCP socket connects on port 443, yet web browsers reject the session with a TLS certificate warning. How would you classify reachability across network layers? At Layer 4 (transport), port
443is reachable: bidirectional TCP routing works and a TLS listener accepted the connection and transmitted its certificate flight. At Layer 7 (application usability), the service is unhealthy because Certificate Authority (CA) validation—verifying that a trusted issuer signed an unexpired certificate matching the target hostname—failed, causing browsers and strict API clients to abort before sending HTTP requests. Typical causes include an expired leaf certificate, connecting to a raw IP or omitting SNI (Server Name Indication, so the server presents a fallback certificate for another hostname), a missing intermediate certificate in the chain, or an untrusted TLS-inspection proxy; runopenssl s_client -connect api.payments.example:443 -servername api.payments.example -showcertsto inspect the exact subject names, chain, and validity dates. - How would you design a reliable, automated CI/CD health probe that validates HTTPS availability end to end? Run a multi-layer check from an external runner whose network path matches real clients: resolve every
AandAAAADNS record for the hostname, iterate through all resolved IPs with explicit per-stage timeouts (e.g.,3 s), complete the TCP handshake, validate the full TLS certificate chain (failing or warning early if expiration is within14days), and send anHTTPS GETto a dedicated/healthzroute expectingHTTP 200within a defined latency threshold. Emit structured timing metrics and distinct exit/reason codes per layer (DNS, TCP refused, TCP timeout, TLS verification, HTTP status) so alerts pinpoint the broken layer immediately, and retry transient network timeouts2–3times with short backoff before failing the pipeline.
Follow-up questions
- Suppose ICMP echo requests time out, yet HTTPS requests to the same host succeed. What network configurations explain this behavior?
- Connecting to TCP port 443 succeeds from a peer VM inside the target subnet, yet hangs until timeout from your workstation. Which culprits are most likely, and how would you isolate the cause?
- A TCP socket connects on port 443, yet web browsers reject the session with a TLS certificate warning. How would you classify reachability across network layers?
- How would you design a reliable, automated CI/CD health probe that validates HTTPS availability end to end?
Similar questions
- BGP Fundamentals: Peering Sessions, Prefix Propagation, and Path Selection
- In-Memory Task Tracker with CRUD Operations
- Core Mechanics of pytest Fixtures, Function Wrappers, and Lazy Generators
- Method Resolution Order in Python Multiple Inheritance
- Memory Layout and Arithmetic of C Pointer vs. Array Declarations
- Designing a Feature Test Strategy and Taming Intermittent CI Failures
More Cisco interview questions
- Leading a Testing and Release Process Upgrade Easy
- BGP Fundamentals: Peering Sessions, Prefix Propagation, and Path Selection Easy
- Modeling and Proving Optimality in a Horses-and-Ladders Crossing Puzzle Hard Pro
- In-Memory Task Tracker with CRUD Operations Easy Pro
- Leftmost Longest Repeat-Free Substring Easy Pro
- Method Resolution Order in Python Multiple Inheritance Easy Pro
- Core Mechanics of pytest Fixtures, Function Wrappers, and Lazy Generators Easy Pro
- Memory Layout and Arithmetic of C Pointer vs. Array Declarations Easy Pro
- Designing a Feature Test Strategy and Taming Intermittent CI Failures Easy Pro
- Constant-Time LFU Cache Hard Pro