Quantcast
Channel: Veeam Support Knowledge Base
Viewing all articles
Browse latest Browse all 4362

How to Test Port Connectivity

$
0
0

How to Test Port Connectivity

KB ID: 4444
Published: 2023-05-05
Last Modified: 2023-05-05

Purpose

This article documents how to test connectivity between two machines over a specific port.
Product Service Ports

Most connection errors involving ports in the 61xx, 93xx, 94xx, and 10xxx ranges are related to Veeam product-related services. Determine if the port in the connection error is associated with a Veeam product service. If so, ensure that the service is running on the target machine specified in the error.

Each product's user guide includes a comprehensive list of all the ports utilized by the respective product. Below are convenient links to the most frequently accessed port lists for popular products.

Ports 2500-3300 are dedicated to data transport. Those ports will only be associated with a VeeamAgent process when data is actively being transferred. When testing connection issues related to ports in that range, you will likely have to start a listener on the target machine manually.

Solution

Check Port Ownership

To test the connection to a specific port, you must first ensure that a process is actively listening on that port.

  • If a process is associated with the port, proceed to the Testing Connection section of this article.
  • If no process is associated with the port specified, proceed to the Creating a Listener section of this article.

Check Port Ownership in Windows

Use the following PowerShell command to check which process is locking a specific port.
Update the -LocalPort value to specify the port being tested.

Get-Process -Id (Get-NetTCPConnection -LocalPort 6160).OwningProcess
Port Owned
In this example, the port is owned by the VeeamDeploymentSvc process.
No Port Owner
In this example, no process is associated with the specified port.
Legacy OS Method

The Get-NetTCPConnection cmdlet is not available in older versions of PowerShell installed with Server 2012 or older. For those legacy operating systems, you can use the following netstat command and then manually associate the process ID with a process in Task Manager.

Use the following command to list processes associated with the specified port:
Replace the port placeholder in this example with the port being tested.

netstat -aon | findstr :port | findstr LISTENING | findstr /C:":"
Legacy Port In this example, the port is owned by the process with ID# 340.
An empty output indicates that no process was found listening on the port specified.

Check Port Ownership in Linux

Use the following command to check which process is associated with a specific port.
Replace the portnumber placeholder with the port being tested.

sudo lsof -i :portnumber
Port Owned
In this example, the port is owned by veeamdeployment.service.
No Port Owner
In this example, no process is associated with the specified port.

Creating a Listener

If the port you are testing does not currently have a process associated with it, you must create a listener to own that port before attempting to test if the port can be reached.

Creating a Listener in Windows

Use the following PowerShell command to start a listener on the specified port.
Replace 6160 in this example with the port you are testing.

$listener = [System.Net.Sockets.TcpListener]6160; $listener.Start();

The above command will start a process in the background on the specified port. You can reuse the command from the Check Port Owner section to verify that the port is now associated with a process.

Below is an example of:

  1. Identifying that no process is associated with a port.
  2. Creating a listener on that port
  3. Verifying the port ownership.
Listener Start Example
The listener will remain active on the port specified until the PowerShell window that started it is closed or the following command is run:
$listener.Stop();

Creating a Listener in Linux

Use the following command to start a listener on the specified port.
Replace 6160 in this example with the port you are testing.

nc -l -v -k -p 6160

This example uses Netcat (nc), which may not be installed by default on all Linux systems. Although other applications can also be used, Netcat is a commonly used tool for this purpose.

To stop the netcat listener, use Ctrl+C to stop the process.

Testing Connection

When testing connectivity to a port, it's important to test first from the machine that Veeam used to initiate communication. If the test fails, test locally from the target machine, and then test from other machines. We test from multiple locations because firewalls within the environment may allow connections from some sources while blocking others.

Testing Connection From Windows

The following native PowerShell command will test connectivity to the specified computer and port.
Update the -ComputerName and -Port values.

Test-NetConnection -ComputerName TargetMachine -Port ####
Review the Interpreting the Results section of this article for examples of output from this command.
Legacy OS Method

The Test-NetConnection cmdlet is not available in older versions of PowerShell installed with Server 2012 or older. For those legacy operating systems, use the following command to test the connection:

Replace the targetmachine and port placeholders in this example.

(New-Object System.Net.Sockets.TcpClient).Connect("targetmachine", port)
An empty output indicates that the connection was successful. The command will only display an output message if there is an issue connecting to the port specified on the target machine.

Testing Connection From Linux

The following command will test connectivity to the specified computer and port.
Replace the targetmachine and port placeholders in this example.

nc -zv targetmachine port
This example uses Netcat (nc), which may not be installed by default on all Linux systems. Although other applications can also be used, Netcat is a commonly used tool for this purpose.

Interpreting the Results

If the connection test is successful, but the task within Veeam still fails, do the following:

  • Review the error and determine which machine Veeam was using to initate the connection, and test with that machine.
    It's important to note that some Veeam products rely on a central control server with components on other machines. Therefore, it's possible that the primary Veeam-machine is not at fault and that the issue lies with one of the remote component machines.
  • In environments with a signature-based firewall, the test packets may be permitted to pass, but Veeam traffic may be blocked—review Troubleshooting Signature-Based Firewalls for more information.

After a failed connection test do the following:

  • Double check that you specified the correct IP and Port.
  • Double check that there is a process on the target machine listening on the port.
  • Run the test command from the target machine to test if it can talk to itself on that port.
  • Run the test command on another remote machine to to isolate whether the port connection is blocked for all remote machines or only the first machine you tested from.

If the target machine can test the port to itself succesfully, but remote machines are unable to reach that same port, it is highly likely that a firewall is blocking connections.

Windows Test Results

Below are a series of screenshot demonstrating results you will see while testing.

Successful Connection Test

This is an example of a complete success, indicated by the "TcpTestSucceeded: True."

Win Complete Success
Failed Connection Test

The Test-NetConnection cmdlet will first attempt to connect to the port, if that fails it will attempt to ping the remote machine. While a succesful Ping is not a requirement of Veeam, in the first example it serves to show us that some connection is possible, just not to the port specified.

Partial Success In this example, the port test failed, but a ping test was successful.
Complete Failure In this example, no connection could be made, neither to the port nor via ping.

Linux Test Results

Successful Connection Test

This is an example of a success, indicated by the "Connect to x.x.x.x:xxxx."

Win Complete Success
Failed Connection Test

The following example is of a complete failure, indicated by the "Ncat: TIMEOUT" meaning the connection to the port timed out.

Complete Failure
To submit feedback regarding this article, please click this link: Send Article Feedback
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.

Viewing all articles
Browse latest Browse all 4362

Trending Articles