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

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. 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. 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!

Updated: 2022-12-28 von Bernhard | Übersetzung Deutsch |🔔 | Comments:0

List all IP addresses in the network even if the firewall is enabled | Network | cmd commands for network analysis

Top articles in this section


Uninterrupted WiFi: Roaming (Fast Transition)

The marketing term "mesh WiFi" often refers to the desire for a WiFi that simply works everywhere in the house. But what actually is a mesh WiFi? And what is really needed for WiFi to work everywhere and even when switching from one receiving station to another? My setup consists of two access points, which as a unit provide a single WiFi SSID. As access points I use devices from different manufacturers and OpenWrt as firmware. The access points provide uninterrupted reception when I move from o...


show active network connections and processes | Windows

For a quick overview of which programs or services have an active network connection, they can be listed via simple commands or monitored and analyzed via specific tools. 


List all IP addresses in the network even if the firewall is enabled

A quick overview of all active devices in the network can be  listed - in addition to the router's management interface - by commands in the command prompt, in PowerShell or special IP scanners. The PowerShell commands presented at the beginning of this post give a quick overview of all devices on the local network and may make special programs for scanning the network unnecessary. If you would like to see the commands in action, you can do so in my YouTube video. For expanding your own network,...

Questions / Comments


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