How to Ping a Specific Port in 2023

To make Ping to the It is one of the most effective troubleshooting techniques to see if a service is alive or not. Used by system administrators on a daily basis, the ping command, based on the protocol ICMPretrieves operational information about remote hosts.

However, ping hosts is not always enough: you may need ping a specific port from your server. This specific port may be related to a database, or to an Apache web server, or even to a proxy server on your network.

How to Ping a Specific Port

In this tutorial, we are going to see how can you ping to a specific port using a variety of different commands.

Ping a specific port using telnet

The easiest way to ping a specific port is to use the command telnet followed by the IP address and port you want to ping.

You can also specify a domain name instead of an IP address followed by the specific port you want to ping.

Read Also

$telnet

$telnet

The command “telnet” It is valid for Windows and Unix operating systems.

If you encounter the error “telnet : command not found” on your system, you will have to install telnet on your system by running the following commands.

$ sudo apt-get install telnet

As an example, let’s say we have a website running on an Apache web server at IP address 192.168.178.2 on our local network.

By default, websites run on the port 80: This is the specific port we are going to ping to see if our website is up.

Read Also

$telnet 192.168.178.2 80

Trying 192.168.178.2…

Connected to 192.168.178.2.

Escape character is ‘^]’.

$telnet 192.168.178.2 389

See also  How to Rebuild PS4 Database: A Beginner's Guide - Premium Tutorial

Connected to 192.168.178.2.

Read Also

Escape character is ‘^]’.

Being able to connect to your remote host simply means that your service is up and running.

To exit the Telnet utility, you can use the keys “Ctrl” + “]” to escape and execute the command “q” to go out.

Ping a specific port using nc

To ping a specific port number, run the command “nc” with the option “v” for “verbose”, “z” for “scanning” and specifies the host as well as the port to ping.

You can also specify a domain name instead of an IP address followed by the port you want to ping.

Read Also

$nc -vz

$nc -vz

This command works for Unix systems, but you can find alternatives netcat online for Windows.

If the command “nc” is not found on your system, you will have to install it by running the command “apt-get install” as sudo user.

$ sudo apt-get install netcat

As an example, let’s say you want to ping a website HTTP remote on your port 80, you would run the following command.

$nc -vz .com 80

Read Also

Amazon.com 80 (http) open

As you can see, the connection was successfully opened on port 80.

On the other hand, if you try to ping a specific port that is not open, you will get the following error message.

$nc -vz amazon.com 389

Amazon.com 389 (ldap) : Connection refused

Read Also

Ping ports using nmap

A very easy way to ping a specific port is to use the command nmap with the option “-p” for the port and specify the port number as well as the name of the host to be scanned.

See also  How to Fix an Unhandled Exception Error in Windows 10 - Premium Tuto

$nmap -p

$nmap -p

Note: If you use nmap, keep in mind that you should be aware of the legal issues that may arise with it. For this tutorial, we are assuming that you are scanning local ports for monitoring purposes only.

If the command “nmap” is not available on your host, you will have to install it.

$ sudo apt-get install nmap

As an example, let’s say you want to ping the “192.168.178.35/24” on your local network on the default LDAP port: 389.

$nmap -p 389 192.168.178.35/24

As you can see, the port is said to 389 is open in this virtual machine indicating that a server OpenLDAP is running there.

Scanning a range of ports using nmap

To scan a range of ports using nmap, you can run “nmap” with the option “p” for “ports” and specify the range to be pinged.

$nmap -p 1-100

$nmap -p 1-100

Again, if we try to scan a range of ports on the “192.168.178.35/24”we would execute the following command

$nmap -p 1-100 192.168.178.35/24

Ping a specific port using Powershell

If you are running a computer in a Windows environment, you can ping specific port numbers using powershell.

This option can be very useful if you plan to include this functionality in automated scripts.

To ping a specific port using Powershell, you have to use the command “Test-NetConnection” followed by the IP address and port number to ping.

$Test-NetConnection -p

As an example, let’s say we want to ping the host “192.168.178.35/24” at port 389.

To achieve this, we would execute the following command

$Test-NetConnection 192.168.178.35 -p 389

On the last line, you can see if the call TCP Whether it was successful or not: in our case, it reached the port at port 389.

See also  Discover How to Show Hidden Songs on Spotify - Premium Tuto

Words about Ping terminology

Technically, there is no such thing as “to make Ping” to a specific port on a host.

Submit a request “ping” to a remote host means you are using the protocol ICMP in order to check network connectivity.

ICMP is primarily used to diagnose network problems that prevent reaching hosts.

when you do “ping a port”you are actually establishing a TCP connection between your computer and a remote host on a specific port.

However, it is very common for engineers to say that they are “pinging a port” but actually they are scanning or opening TCP connections.

Conclusion

In this tutorial, you have learned all the ways that can be used to ping a specific port. Most of the commands used in this tutorial can be used on operating systems Windows, Unix or MacOS.

They may not be available directly to you, but you can find free and open source alternatives for your operating system. If you’re interested in Linux systems administration, we have an entire section dedicated to it on the website, be sure to check it out!

If you want to know other articles similar to How to Ping a Specific Port you can visit the category.

Loading Facebook Comments ...
Loading Disqus Comments ...