Port Testing & Diagnostics
Your JD names these tools explicitly:
Perform port testing using tools such as netstat, telnet, Test-NetConnection, nmap, and PowerShell scripts.
This is the page that answers that requirement. Learn to reach for the right one without thinking.
The core distinction
1. Is the host up? → ping, ICMP.
2. Is the TCP port open? → Test-NetConnection, telnet, nc, nmap.
3. Is the application healthy? → curl -v, application logs, SSL check.
A green ping tells you nothing about 2 or 3. That gap is where most support incidents actually live.
Test-NetConnection — the PowerShell default
Test-NetConnection -ComputerName dc01.corp.local -Port 445
Test-Connection is the ping command. It has no -Port parameter and
never will:
PS> Test-Connection -ComputerName 127.0.0.1 -Port 22
Test-Connection: A parameter cannot be found that matches parameter name 'Port'.
Use Test-NetConnection (alias tnc) for ports, Test-Connection for ICMP:
tnc 127.0.0.1 -Port 22 # port 22 open?
Test-Connection 127.0.0.1 -Count 4 # ping
Test-Connection 127.0.0.1 -Quiet # ping, True/False only
Two cmdlets, one word apart, doing completely different things. This is the single most common PowerShell mistake in this job.
The single most important line to remember. Read its output:
ComputerName : dc01.corp.local
RemoteAddress : 10.0.0.5
RemotePort : 445
InterfaceAlias : Ethernet
SourceAddress : 10.0.0.20
TcpTestSucceeded : True
If PingSucceeded is False but TcpTestSucceeded is True, the host is
blocking ICMP and is perfectly healthy. A common false alarm.
Useful variations:
# Does DNS resolve as well as connect?
Test-NetConnection dc01.corp.local -Port 389 -InformationLevel Detailed
# Range a set of ports
445, 389, 3389 | ForEach-Object {
$r = Test-NetConnection dc01.corp.local -Port $_ -WarningAction SilentlyContinue
"$_ -> $($r.TcpTestSucceeded)"
}
The port tester script — write this from memory
This is a standard take-home and a fair interview question:
$hosts = 'web01.corp.local', 'dc01.corp.local', '192.168.1.1'
$ports = 80, 443, 445, 3389
foreach ($h in $hosts) {
foreach ($p in $ports) {
$r = Test-NetConnection -ComputerName $h -Port $p -WarningAction SilentlyContinue
[pscustomobject]@{
Host = $h
Port = $p
Open = $r.TcpTestSucceeded
RemoteIP = $r.RemoteAddress
}
}
}
Without it, Test-NetConnection emits a warning per unreachable port and the
output becomes unusable. Interviewers notice this.
Be ready to explain it: the outer loop walks hosts, the inner walks ports,
Test-NetConnection does a TCP handshake, and [pscustomobject] emits objects
you can pipe to Export-Csv or Format-Table.
telnet and netcat
telnet 10.0.0.5 443
A successful connection shows a blank or garbled screen — that is the success signal. If it says "Connection refused", the host answered but nothing is listening. If it times out, a firewall is dropping the packets.
nc -zv 10.0.0.5 443 # Linux equivalent, with a verdict
| Result | Meaning |
|---|---|
| Connected | Port open, something is listening |
| Connection refused | Host reachable, nothing bound to that port |
| Timed out | Packet dropped — firewall, or wrong host |
netstat — what is listening on MY machine
netstat -ano # everything
netstat -ano | findstr :445 # a specific port
netstat -ano | findstr LISTENING # listening sockets only
netstat -e # interface errors and discards
The PID at the end is how you find the culprit process:
tasklist /FI "PID eq 4128"
# Or, one step:
Get-NetTCPConnection -LocalPort 445 |
Select-Object LocalPort, State, OwningProcess,
@{n='Process'; e={(Get-Process -Id $_.OwningProcess).ProcessName}}
ss -tulpn # Linux
netstat -tulpn # older Linux
"A user says a file share is slow. Netstat shows thousands of connections in TIME_WAIT. What does that mean?" — Answer: the local side is closing first and sockets are lingering in the 2×MSL wait before final teardown. Very high connection churn against a server that closes connections slowly.
nmap
nmap -Pn -p 445,3389,53 10.0.0.5 # specific ports, skip ping scan
nmap -sV -p 443 10.0.0.5 # service/version detection
nmap -A 10.0.0.5 # aggressive: OS + services + scripts
nmap -sn 192.168.1.0/24 # host discovery only
| Flag | Why it matters here |
|---|---|
-Pn | Treat the host as up even if it blocks ping — otherwise you get "0 hosts up" and no results |
-sV | Turns 445/tcp open into 445/tcp open microsoft-ds |
-p | Restrict to the ports the ticket is about |
nmap is a scanner. Only run it on networks you are authorised to test.
Running it across an employer's network without permission is a disciplinary
matter, and in some jurisdictions a legal one.
curl — the one that checks the application
curl -vk https://dc01.corp.local/ # -v verbose, -k ignore cert
curl -I https://example.com # headers only
curl -sS -o /dev/null -w "%{http_code}\n" https://example.com
This is the step that separates "the port is open" from "the service works".
Combining them — the real diagnostic
Being able to recite this layered escalation is worth more than memorising any individual command. It is what "troubleshoot connectivity issues" means in practice.
Linux equivalents
ss -tulpn # sockets
ip a ; ip r # addresses and routes
dig +short example.com # DNS
nc -zv host 443 # port test
curl -vk https://host/ # application
ping -c 4 host # ping (note -c on Linux)
traceroute host # path
Wireshark
| Filter | Captures |
|---|---|
tcp.port == 445 | SMB traffic |
udp.port == 67 or udp.port == 68 | DHCP DORA |
dns | All DNS |
arp | Address resolution |
tcp.flags.syn == 1 | SYN scan attempts |
You will not be asked to be a Wireshark expert. Knowing that you can filter
for tcp.port == 445 to prove traffic is leaving a machine is enough.
Reference
| Port | Proto | Service | Why support cares |
|---|---|---|---|
20 | TCP | FTP data | Passive FTP. Blocked by most firewalls. |
21 | TCP | FTP control | Cleartext credentials — avoid. |
22 | TCP | SSH | Linux/Unix remote administration. |
23 | TCP | Telnet | Cleartext. Your JD names it as a test tool. |
25 | TCP | SMTP | Outbound mail from a mail client. |
53 | TCP/UDP | DNS | UDP for lookups, TCP for zone transfers. |
67 | UDP | DHCP server | Offers and acknowledgements. |
68 | UDP | DHCP client | Discover and Request. |
69 | UDP | TFTP | Used during PXE network boot. |
80 | TCP | HTTP | Unencrypted web. |
88 | UDP/TCP | Kerberos | AD authentication ticket exchange. |
123 | UDP | NTP | Time sync — Kerberos fails without it. |
137 | UDP | NetBIOS name | Legacy Windows name service. |
139 | TCP | NetBIOS session | Legacy file sharing. |
143 | TCP | IMAP | Mail retrieval. |
161 | UDP | SNMP | Network monitoring polling. |
162 | UDP | SNMP trap | Unsolicited device alerts. |
389 | TCP/UDP | LDAP | AD directory queries. |
443 | TCP | HTTPS | Also RDP-over-Gateway, SQL Server TLS. |
464 | TCP/UDP | Kerberos password change | |
500 | UDP | IKE (IPsec) | VPN negotiation phase 1. |
514 | UDP | Syslog | Centralised log shipping. |
636 | TCP | LDAPS | LDAP over TLS. |
3389 | TCP/UDP | RDP | Remote Desktop. Almost guaranteed in a support call. |
4500 | UDP | NAT-T / IPsec | VPN when UDP 500 is blocked. |
3268 | TCP | Global Catalog | AD global catalogue search. |
3269 | TCP | Global Catalog TLS | |
5985 | TCP | WinRM (HTTP) | PowerShell Remoting. |
5986 | TCP | WinRM (HTTPS) | Remoting over TLS. |
1433 | TCP | MS SQL Server | |
3306 | TCP | MySQL | |
5432 | TCP | PostgreSQL | |
27017 | TCP | MongoDB | |
8080 | TCP | HTTP alternate | Proxies, Tomcat. |
8443 | TCP | HTTPS alternate |