Tester un port TCP

Vérifie si un port TCP quelconque d'un hôte est joignable.

HTTPS (443)

PowerShell (Windows)

Test-NetConnection Natif

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

nc / ncat Outil complémentaire

ncat -vz mail.example.com 443

Shell Unix (bash)

bash /dev/tcp Natif

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

nc Outil complémentaire

nc -vz mail.example.com 443

SMTP (25)

PowerShell (Windows)

Test-NetConnection Natif

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

nc / ncat Outil complémentaire

ncat -vz mail.example.com 25

Shell Unix (bash)

bash /dev/tcp Natif

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

nc Outil complémentaire

nc -vz mail.example.com 25

LDAPS (636)

PowerShell (Windows)

Test-NetConnection Natif

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

nc / ncat Outil complémentaire

ncat -vz dc01.example.com 636

Shell Unix (bash)

bash /dev/tcp Natif

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

nc Outil complémentaire

nc -vz dc01.example.com 636

Ping

Vérifie la joignabilité de base d'un hôte via ICMP.

PowerShell (Windows)

Test-Connection Natif

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

ping Natif

ping -n 4 mail.example.com

Shell Unix (bash)

ping Natif

ping -c 4 mail.example.com

fping Outil complémentaire

fping -c 4 mail.example.com

Traceroute

Affiche saut par saut le chemin réseau vers un hôte.

PowerShell (Windows)

Test-NetConnection Natif

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

tracert Natif

tracert -d mail.example.com

Shell Unix (bash)

tracepath Natif

tracepath mail.example.com

traceroute / mtr Outil complémentaire

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

traceroute n'est pas toujours installé sur les serveurs Linux minimalistes. mtr fournit une vue mise à jour en continu.

Qui écoute sur un port ?

Affiche quel processus écoute localement sur un port.

SMTP (25)

PowerShell (Windows)

Get-NetTCPConnection Natif

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

netstat Natif

netstat -ano | findstr ":25 "

Shell Unix (bash)

ss Natif

ss -tlnp "sport = :25"

lsof / netstat Outil complémentaire

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

Submission (587)

PowerShell (Windows)

Get-NetTCPConnection Natif

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

netstat Natif

netstat -ano | findstr ":587 "

Shell Unix (bash)

ss Natif

ss -tlnp "sport = :587"

lsof / netstat Outil complémentaire

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

Quel serveur DNS ?

Affiche les serveurs DNS actuellement utilisés par le système : important en cas de split DNS.

PowerShell (Windows)

Get-DnsClientServerAddress Natif

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

ipconfig Natif

ipconfig /all

Shell Unix (bash)

resolvectl Natif

resolvectl status

cat Natif

cat /etc/resolv.conf

Autres domaines