How to troubleshoot network applications with PowerShell and tnc

There are many online tools for testing services offered by a server but those tests only indicate the view from the online tool. Sometimes you need to test connectivity from your local computer. This article describes how to use PowerShell and tnc to troubleshoot network applications.

About PowerShell and tnc

PowerShell is a task-based command-line shell and scripting language included with all currently supported versions of Windows. tnc is a PowerShell command that displays diagnostic information for a connection.

Not using Windows? See our network troubleshooting articles using telnet or using curl.

To launch PowerShell, press the Windows key on the keyboard and begin typing PowerShell until the PowerShell Desktop Application option is visible. Click on the PowerShell Desktop Application icon to launch PowerShell.

Using PowerShell and tnc to troubleshoot

To use tnc to test basic network connectivity, you need to know two things:

  • The remote server name or IP address.
  • The port number for the network application you want to test.

To test a connection to a remote server, open a PowerShell window on your computer, and then type tnc IP/host -port port, where IP/host represents the IP address or hostname of the server, and port represents the TCP port number. For example, to test to example.com on port 80, type the following command:

tnc example.com -port 80
For a complete list of assigned TCP port numbers, please visit http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers.

When you try to establish a connection to a remote server, one of two things happens:

  • The server accepts the connection. If this happens, tnc will report TcpTestSucceeded: True.
  • The server rejects the connection. If this happens, tnc will report TcpTestSucceeded: False.

The following sections demonstrate how to do basic telnet troubleshooting with some common network applications.

Troubleshooting web servers

Web server testing is probably the most common scenario for network troubleshooting. With tnc you can test a connection to a remote server on port 80. The following text shows the tnc test. Text in red represents commands typed by the user:

>tnc example.com -port 80
ComputerName     : toomanycats.com
RemoteAddress    : 192.168.0.62
RemotePort       : 80
InterfaceAlias   : Ethernet
SourceAddress    : 10.0.0.28
TcpTestSucceeded : True

tnc reports TcpTestSucceeded : True indicating a TCP connection can be made to the server on port 80


Troubleshooting mail (SMTP) servers

To test an SMTP server, use tnc to connect to port 25.

If you are testing connectivity to an A2 Hosting mail server, you can also use port 2525 or 587. Some ISPs block port 25 to help reduce spam on their networks.

The following text shows the tnc test of a remote mail server. Text in red represents commands typed by the user:

>tnc example.com -port 25
ComputerName     : example.com
RemoteAddress    : 192.168.0.62
RemotePort       : 25
InterfaceAlias   : Ethernet
SourceAddress    : 10.0.0.28
TcpTestSucceeded : True

tnc reports TcpTestSucceeded : True indicating a TCP connection can be made to the server on port 25

Troubleshooting FTP

To test an FTP server, use tnc to test port 21.

The following text shows the tnc test of a  remote FTP server. Text in red represents commands typed by the user:

>tnc example.com -port 21
ComputerName     : example.com
RemoteAddress    : 192.168.0.62
RemotePort       : 21
InterfaceAlias   : Ethernet
SourceAddress    : 10.0.0.28
TcpTestSucceeded : True

tnc reports TcpTestSucceeded : True indicating a TCP connection can be made to the server on port 21

Troubleshooting SSH

SSH uses encrypted connections. However, you can still use telnet to verify that the service is running on a server.

The following text shows the tnc test of a remote SSH server. Text in red represents commands typed by the user:

>tnc example.com -port 7822
ComputerName     : example.com
RemoteAddress    : 192.168.0.62
RemotePort       : 22
InterfaceAlias   : Ethernet
SourceAddress    : 10.0.0.28
TcpTestSucceeded : True

tnc reports TcpTestSucceeded : True indicating a TCP connection can be made to the server on port 7822

Remember that A2 Hosting servers use port 7822 for SSH instead of the default port 22.

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.