How to test TCP port connectivity from a Vault

How to test TCP port connectivity from a Vault

170
Created On 11/10/26 10:58 AM - Last Modified 11/10/26 13:00 PM


Objective


How do I test the TCP connectivity to my remote server from the vault?


Environment


10.5;10.10;11.1;11.2;11.3;11.4;11.5;11.6;11.7;12.0;12.1;12.2;12.6;12.7;13.0 Privileged Access Manager (PAM, self-hosted) Vault

Procedure


 
Note: You will need to manually create a Windows firewall rule on the vault to allow communications on the TCP port since it is blocked by default from PowerShell.
 
With PowerShell on Windows 2012 R2, Microsoft introduced a new Cmdlet:  Test-NetConnection
 
This cmdlet can be used to test TCP connectivity to any target on any TCP port.  As an added bonus, it also tests ICMP connectivity.
 
Example:
PS C:\> Test-NetConnection -ComputerName 10.0.5.2 -Port 25
 
Successful:
ComputerName           : 10.0.5.2
RemoteAddress          : 10.0.5.2
RemotePort             : 25
InterfaceAlias         : Ethernet0
SourceAddress          : 10.0.1.2
PingSucceeded          : True
PingReplyDetails (RTT) : 2 ms
TcpTestSucceeded       : True
 
Failure:
WARNING: TCP connect to 10.0.5.2:23 failed
 
ComputerName           : 10.0.5.2
RemoteAddress          : 10.0.5.2
RemotePort             : 23
InterfaceAlias         : Ethernet0
SourceAddress          : 10.0.1.2
PingSucceeded          : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded       : False
 
 


Additional Information


Details

Q:
How do I test the TCP connectivity to my remote server from the vault?
 
A:
Note: You will need to manually create a Windows firewall rule on the vault to allow communications on the TCP port since it is blocked by default from PowerShell.
 
With PowerShell on Windows 2012 R2, Microsoft introduced a new Cmdlet:  Test-NetConnection
 
This cmdlet can be used to test TCP connectivity to any target on any TCP port.  As an added bonus, it also tests ICMP connectivity.
 
Example:
PS C:\> Test-NetConnection -ComputerName 10.0.5.2 -Port 25
 
Successful:
ComputerName           : 10.0.5.2
RemoteAddress          : 10.0.5.2
RemotePort             : 25
InterfaceAlias         : Ethernet0
SourceAddress          : 10.0.1.2
PingSucceeded          : True
PingReplyDetails (RTT) : 2 ms
TcpTestSucceeded       : True
 
Failure:
WARNING: TCP connect to 10.0.5.2:23 failed
 
ComputerName           : 10.0.5.2
RemoteAddress          : 10.0.5.2
RemotePort             : 23
InterfaceAlias         : Ethernet0
SourceAddress          : 10.0.1.2
PingSucceeded          : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded       : False
 
With PowerShell on Windows 2008 R2, you can use .Net: New-Object System.Net.Sockets.TcpClient('<IP of Server>',<port>)
 
Example:
PS C:\> New-Object System.Net.Sockets.TcpClient('10.0.5.2',389)
 
Successful:
Client              : System.Net.Sockets.Socket
Available           : 0
Connected           : True
ExclusiveAddressUse : False
ReceiveBufferSize   : 8192
SendBufferSize      : 8192
ReceiveTimeout      : 0
SendTimeout         : 0
LingerState         : System.Net.Sockets.LingerOption
NoDelay             : False
 
Failure:
New-Object : Exception calling ".ctor" with "2" argument(s): "A connection attempt failed because the connected party d
id not properly respond after a period of time, or established connection failed because connected host has failed to r
espond 10.0.5.2:389"
At line:1 char:11
+ New-Object <<<<  System.Net.Sockets.TcpClient('10.0.5.2',389)
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj0000000m3ACAQ&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail