Alternate methods to verify network communications other than telnet
search cancel

Alternate methods to verify network communications other than telnet

book

Article ID: 239707

calendar_today

Updated On:

Products

Workload Automation Agent Autosys Workload Automation CA Workload Automation AE - Business Agents (AutoSys) CA Workload Automation AE - Scheduler (AutoSys) CA Workload Automation AE - System Agent (AutoSys) CA Workload Automation DE CA Workload Automation DE - Business Agents (dSeries) CA Workload Automation DE - Scheduler (dSeries) CA Workload Automation DE - System Agent (dSeries)

Issue/Introduction

Most companies disable telnet due to security policy. This article provides alternate methods to perform and capture network communications tests.

Environment

Any

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

  • Option 4: (Windows only) Use Powershell.
    Command Syntax: Test-NetConnection -ComputerName machine.example.com -port 7523

    Example of successful connection:
    PS C:\Users\Administrator> Test-NetConnection -ComputerName machine.example.com -port 7523
    C
    omputerName     : machine.example.com
    RemoteAddress    : <IP_MASKED>
    RemotePort       : 7523
    InterfaceAlias   : xxxxxxxxxxxxx
    SourceAddress    : <IP_MASKED>
    TcpTestSucceeded : True


    Example of failed connection:
    PS C:\Users\Administrator> Test-NetConnection -ComputerName machine.example.com -port 7523

    WARNING: TCP connect to (<IP_MASKED> : 7523) failed


    ComputerName           : machine.example.com
    RemoteAddress          : <IP_MASKED>
    RemotePort             : 7523
    InterfaceAlias         : xxxxxxxxxxxxx
    SourceAddress          : <IP_MASKED>
    PingSucceeded          : True
    PingReplyDetails (RTT) : 1 ms
    TcpTestSucceeded       : False