To check the SSH service (default port 22):
[code language=”bash” light=”true”]nc -z $IP 22[/code]
To check the XML Management Interface (default port 5550):
[code language=”bash” light=”true”]nc -z $IP 5550[/code]
To check the SNMP (UDP port 161):
[code language=”bash” light=”true”]nc -zu $IP 161[/code]
If connection is successful, it will report a message like:
[code language=”bash” light=”true”]Connection to $IP 22 port [tcp/ssh] succeeded![/code]
and exit with 0.
Reference: nc(1) – Linux man page