Ping using a Port | cmd vs. PowerShell: Test-Netconnection

Diese Seite gibt es auch in Deutsch

As is well known, the tool ping can be used to test the access to a certain network device and its response time. Not all devices will respond to a ping, but they may respond to a particular port if a particular network service is provided through it. Windows PowerShell allows you to test a specific port using Windows board tools. The psping tool can also measure the response time to a specific port.

 

Aim of this article

Using commands in the command prompt to test
whether certain Internet addresses or network devices
have a certain network port active

Effort

Reading time: approx. 2 Minutes

Prerequisite

Basic network knowledge and a Windows computer
Ping is a command used to send a test packet over the network, the devices usually respond to it and send back a response packet. Responsible for the response here is not a specific service, but a part of the network stack on the device. The test on a specific port is different, here it is tested whether the remote station on the port accepts a packet, i.e. whether the TCP connection setup to the port works. The connection is established directly to the service that uses the port. By the test on a certain port it can be tested whether a certain service answers on the device. To test a device for their open ports, see: Portscan commands.

PowerShell: Test Netconnection

PowerShell's built-in Test-NetConnection command can be used to test the connection on a specific port:

Test-NetConnection -computername google.com -port 443.

The command returns for TcpTestSucceeded: True if the port is reachable.

Command prompt: Telnet

Originally, the telnet command was very often misused in the command prompt to test a specific port. Telnet was a fixed part of the operating system in earlier Windows versions, but in Windows 10 / 11 the telnet command is no longer activated by default, so the command must be added beforehand via Programs and Features:

The call is then made in the command prompt: telnet IP/DNS Port

telnet 192.168.1.5 443

If the port is open, usually only a "_" flashes in the output:

Sysinternals: psping

The psping command can also be used to measure the response time of individual services or ports, as well as the bandwidth:

Ping on a port

Example: psping www.google.de:80

psping is included in the pstools from Sysinternals (Microsoft), 

measure bandwidth

the bandwidth can be measured with the following command

psping -b -l 8k -n 10000 www.libe.net:80

Download

Download see: https://docs.microsoft.com/de-at/sysinternals/downloads/psping

Check UDP ports

UDP ports can be tested most easily with the tool "portqry":

portqry -n 192.168.1.2 -p udp -o 161 

If the connection is successful, portqry should output the following as a response: "UDP port xxx is LISTENING". 

If "UDP port xxx:FILTERED" is output, the port cannot be reached.

Download, see https://www.microsoft.com/en-us/download/details.aspx?id=17148

Conclusion

The Windows built-in PowerShell command Test-NetConnection can be used to easily test whether a particular port is open on a device. In addition, the following commands can be used to perform a portscan on all ports: Portscan - Test devices on the network for their services. An overview of which devices are present in the local network is provided by the commands in the following article: Find IP addresses in the network even if their firewall is enabled

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!



Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details