Test if a TCP port is reachable without telnet or nc
test if port is open without telnet | check remote port bash dev tcp | test firewall rule between servers | bash | ports | firewalltimeout 3 bash -c '</dev/tcp/db.example.com/3306' && echo offen || echo "geschlossen oder gefiltert"Uses the Bash built-in /dev/tcp to open a TCP connection without needing telnet or nc installed. If the connection is established within three seconds, offen (German for open) is printed. Useful for checking firewall rules between servers.
Note: This only works in Bash, not in sh or dash. UDP ports cannot be tested reliably this way.
Also searched as
- test if port is open without telnet
- check remote port bash dev tcp
- test firewall rule between servers