How can I verify port communications outside of telnet?
book
Article ID: 239707
calendar_today
Updated On:
Products
Workload Automation AgentCA Workload Automation AECA Workload Automation AE - Business Agents (AutoSys)CA Workload Automation AE - Scheduler (AutoSys)CA Workload Automation AE - System Agent (AutoSys)CA Workload Automation DECA Workload Automation DE - Business Agents (dSeries)CA Workload Automation DE - Scheduler (dSeries)CA Workload Automation DE - System Agent (dSeries)
Issue/Introduction
The telnet command is disabled by security policy. Is there another command based utility that we can use to test port communications?
Environment
Release : 12.0
Component : Workload Automation System Agent
Resolution
There are a number of ways that one can test network communications to validate port connectivity.
Option 1 - (Linux only) Requires the nmap-ncat package to be installed. This can be done through yum install. (yum install nmap-ncat) Command syntax: nc -zv <host_name_or_ip> <port>
Example of a successful connection: [root@machine tmp]# nc -zv machine.example.com 7523 Ncat: Version 7.70 ( https://nmap.org/ncat ) Ncat: Connected to <IP_MASKED>:7523. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.
Example of a failed connection: [root@machine 12.3]# nc -zv machine.example.com 7523 Ncat: Version 7.70 ( https://nmap.org/ncat ) Ncat: Connection refused.
Option 2 - (Any OS) Requires the curl package to be installed. (On Linux, yum install curl) Command syntax: curl -v telnet://hostname:8443
Example of a successful connection: [root@machine tmp]# curl -v telnet://machine.example.com:7523 * Rebuilt URL to: telnet://machine.example.com:7523/ * Trying <IP_MASKED>... * TCP_NODELAY set * Connected to machine.mycompany.net (IP_MASKED) port 7523 (#0)
Example of a failed connection: [root@machine 12.3]# curl -v telnet://machine.example.com:7523 * Rebuilt URL to: telnet://machine.example.com:7523/ * Trying <IP_MASKED>.. * TCP_NODELAY set * connect to <IP_MASKED> port 7523 failed: Connection refused * Failed to connect to machine.example.com port 7523: Connection refused * Closing connection 0 curl: (7) Failed to connect to machine.example.com port 7523: Connection refused
Option 3 - (Linux or UNIX only) Use cat /dev/tcp Command syntax: cat </dev/null >/dev/tcp/1.2.3.4/7163; echo $? This will return a value of either 0 or 1, with 0 being successful and 1 being failed.
Example of successful connection: [root@machine tmp]# cat </dev/null >/dev/tcp/machine.example.com/7523; echo $? 0 Example of failed connection: [root@machine tmp]# cat </dev/null >/dev/tcp/machine.example.com/7523; echo $? 1