Ping with Port | cmd vs. PowerShell: Test-Netconnection

 

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 Tcp-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

Test in the terminal whether a specific network port is responding

Effort

Reading time: approx. 6 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.

Yes, it is possible: Ping a specific port

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.

Windows PowerShell is a fixed component of Windows,
therefore a port check can be done via PowerShell without additional software or features.

Type in the following command:

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 ??? is LISTENING". 

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

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

FAQ

What is a port?

A network port is a number between 0 and 65535. The port number is used for IP network communication via User Diagram Protocol (UDP) or Transmission Control Protocol (TCP). Different network ports allow multiple simultaneous connections to one IP address. Certain port numbers are intended for certain services: As an example, port 80 is usually used for unencrypted access to a website, port 443 for encrypted access to a website. In order for the connection to be established to the network service, it keeps the port open: In the case of the web server, it constantly listens for ports 80 and 443 to accept connections.

What port does the ping command use?

ICMP is a protocol of its own, along with TCP and UDP, which is why the ping command does not use ports, unlike TCP or UDP. Unlike TCP/IP, when pinging, the client sends an ICMP type8 - echo request and the remote device responds with an ICMP type0 echo response. Thus, the ping does not take place over TCP/IP, but over its own IP protocol: ICMP.

Can I use a specific port for the ping command?

Strictly speaking, a ping to a specific TCP port is not a ICMP-Ping, but a TCP connection attempt. Tools like test-netconnection, telnet or psping try to establish a TCP connection to a specific service and thus test a network connection on TCP/IP level.

What does a high ping mean in games?

A ping measures the duration between the sending of an echo request and the received response, also called round-trip delay (RTD), round-trip-time (RTT), latency or colloquially simply ping. A high ping is therefore a delayed network response. In many online games, a delayed network response has a negative effect on gameplay, and since the ping command also outputs the latency, the term "ping" is also frequently used in online games for the delays. Depending on the game, a ping of about 20-70 milliseconds (ms) is fine, but certain games can also handle higher response times.

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 port scan on all ports: Port scan - 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