Testare una porta TCP

Verifica se una porta TCP qualsiasi di un host è raggiungibile.

HTTPS (443)

PowerShell (Windows)

Test-NetConnection Integrato

Test-NetConnection -ComputerName mail.example.com -Port 443 -InformationLevel Detailed

nc / ncat Strumento aggiuntivo

ncat -vz mail.example.com 443

Shell Unix (bash)

bash /dev/tcp Integrato

timeout 5 bash -c "</dev/tcp/mail.example.com/443" && echo open || echo closed

nc Strumento aggiuntivo

nc -vz mail.example.com 443

SMTP (25)

PowerShell (Windows)

Test-NetConnection Integrato

Test-NetConnection -ComputerName mail.example.com -Port 25 -InformationLevel Detailed

nc / ncat Strumento aggiuntivo

ncat -vz mail.example.com 25

Shell Unix (bash)

bash /dev/tcp Integrato

timeout 5 bash -c "</dev/tcp/mail.example.com/25" && echo open || echo closed

nc Strumento aggiuntivo

nc -vz mail.example.com 25

LDAPS (636)

PowerShell (Windows)

Test-NetConnection Integrato

Test-NetConnection -ComputerName dc01.example.com -Port 636 -InformationLevel Detailed

nc / ncat Strumento aggiuntivo

ncat -vz dc01.example.com 636

Shell Unix (bash)

bash /dev/tcp Integrato

timeout 5 bash -c "</dev/tcp/dc01.example.com/636" && echo open || echo closed

nc Strumento aggiuntivo

nc -vz dc01.example.com 636

Ping

Verifica la raggiungibilità di base di un host tramite ICMP.

PowerShell (Windows)

Test-Connection Integrato

Test-Connection -TargetName mail.example.com -Count 4

ping Integrato

ping -n 4 mail.example.com

Shell Unix (bash)

ping Integrato

ping -c 4 mail.example.com

fping Strumento aggiuntivo

fping -c 4 mail.example.com

Traceroute

Mostra hop per hop il percorso di rete verso un host.

PowerShell (Windows)

Test-NetConnection Integrato

Test-NetConnection -ComputerName mail.example.com -TraceRoute

tracert Integrato

tracert -d mail.example.com

Shell Unix (bash)

tracepath Integrato

tracepath mail.example.com

traceroute / mtr Strumento aggiuntivo

traceroute mail.example.com
mtr -rw -c 10 mail.example.com

traceroute non è sempre installato sui server Linux minimali. mtr offre una vista aggiornata in continuo.

Chi è in ascolto su una porta?

Mostra quale processo è in ascolto localmente su una porta.

SMTP (25)

PowerShell (Windows)

Get-NetTCPConnection Integrato

Get-NetTCPConnection -State Listen -LocalPort 25 | Select-Object LocalAddress, LocalPort, OwningProcess
Get-Process -Id (Get-NetTCPConnection -State Listen -LocalPort 25).OwningProcess

netstat Integrato

netstat -ano | findstr ":25 "

Shell Unix (bash)

ss Integrato

ss -tlnp "sport = :25"

lsof / netstat Strumento aggiuntivo

lsof -iTCP:25 -sTCP:LISTEN
netstat -tlnp | grep ":25 "

Submission (587)

PowerShell (Windows)

Get-NetTCPConnection Integrato

Get-NetTCPConnection -State Listen -LocalPort 587 | Select-Object LocalAddress, LocalPort, OwningProcess
Get-Process -Id (Get-NetTCPConnection -State Listen -LocalPort 587).OwningProcess

netstat Integrato

netstat -ano | findstr ":587 "

Shell Unix (bash)

ss Integrato

ss -tlnp "sport = :587"

lsof / netstat Strumento aggiuntivo

lsof -iTCP:587 -sTCP:LISTEN
netstat -tlnp | grep ":587 "

Quale server DNS?

Mostra quali server DNS il sistema sta usando: importante in caso di split DNS.

PowerShell (Windows)

Get-DnsClientServerAddress Integrato

Get-DnsClientServerAddress -AddressFamily IPv4 | Select-Object InterfaceAlias, ServerAddresses

ipconfig Integrato

ipconfig /all

Shell Unix (bash)

resolvectl Integrato

resolvectl status

cat Integrato

cat /etc/resolv.conf

Altre aree