Windows cmd ping with port

To ping a specific port on Windows 10, you typically use a utility like Telnet or PowerShell, as the traditional ping command is used to test network connectivity by sending ICMP Echo Requests to an IP address. It does not allow you to specify a port number.

To ping a port on Windows 10, you will need to use the Command Prompt.

  1. To do this, type «cmd» into the search bar and click on the Command Prompt app.
  2. Once the Command Prompt is open, type «ping» followed by the IP address and the port number that you want to ping.

For example, if you wanted to ping port 80 on the IP address 192.168.1.1, you would type «ping 192.168.1.1 80» into the Command Prompt.

In order to ping an Ethernet port, you will need to have access to a computer with an Ethernet port and an Internet connection. Once you have these two things, you can ping an Ethernet port by following these steps:

  • 1. Connect the computer to the Ethernet port.
  • 2. Open a command prompt and type «ping [Ethernet port’s IP address].«
  • 3. Press Enter.
  • 4. Wait for the results of the ping test.

To ping a port on Windows 10 Using Telnet:

First, ensure Telnet is installed on your Windows 10 machine:

  • Go to Control Panel.
  • Choose Programs and Features.
  • Select Turn Windows features on or off.
  • Scroll down and check Telnet Client.
  • Click OK and wait for it to install.

Once installed, open the Command Prompt and use the following command:

telnet <Hostname_or_IP> <PortNumber>

If the port is open, the window will go blank or display a connected message. If it’s closed or if there’s an issue, you’ll see a «Could not open connection» error.

Remember that even if a port is not responding to a telnet or PowerShell check, it doesn’t mean the port isn’t being used or active; it might be set to not respond, or there could be a firewall or other security measures in place. Always approach port checks and scans with caution and ensure you have permission to probe the target system.

How do I ping a specific port?

How do I test a port?

Nmap (Network Mapper) is a versatile and powerful tool for network discovery and security scanning. One of its primary uses is to check if specific ports on a system are open. Here’s how you can use Nmap to test a port:

  1. Install Nmap:
    • If you haven’t installed Nmap on your system, you can download and install it from the official website: https://nmap.org/download.html
  2. Basic Port Scan:
    • Open a command-line interface or terminal.
    • To test a specific port, use the following command:

      nmap -p <PortNumber> <Hostname_or_IP>

  3. Scan Multiple Ports:
    • You can also test multiple ports by separating them with commas or using a range with a hyphen.

code

nmap -p 80,443 example.com # Tests port 80 and 443
nmap -p 20-30 example.com # Tests ports from 20 to 30 inclusive

     4. Scan Most Common Ports:

  • Nmap has a list of the 1,000 most common ports. To scan these, you don’t need to specify any port:
  • Use the -T4 option for faster execution (be cautious as this might be flagged by intrusion prevention systems).
  • Use the -v option for verbose mode to get more details.
  • Use the -sV option to determine the version of the service running on the port.

Example combining the options:

nmap -p 80,443 -T4 -v -sV example.com

Note: Always ensure you have permission to scan the target. Unauthorized scanning can be illegal and unethical. If you’re scanning a system or network that you do not own or have explicit permission to test, you could face legal consequences.

How do I check if port 22 is open?

If you are using a Windows operating system, you can use the telnet command to check if port 22 is open. Simply open the Command Prompt and type «telnet {hostname} 22«. If the port is open, you will see a blank screen. If the port is closed, you will see an error message.

If you are using a Linux operating system, you can use the nmap command to check if port 22 is open. Simply open the terminal and type «nmap -p 22 {hostname}«. If the port is open, you will see the message «22/tcp open«. If the port is closed, you will see the message «22/tcp closed«.

To ping a port in Windows, you can use the Command Prompt. To do this, open the Command Prompt and type «ping» followed by the IP address and the port number. For example, to ping port 80 on the IP address 192.168.1.1, you would type «ping 192.168.1.1 80«.

How do I test port 8080?

To test port 8080, you can use a tool like nmap or telnet.

How do I check if a port is running?

If you want to check if a port is running, you can use the netstat command. This command will show you a list of all the currently active ports on your system. You can use the -a flag to see all the ports, and the -n flag to see the port numbers.

How do I check if port 443 is open?

If you want to check if port 443 is open on a remote server, you can use the telnet command. For example:

telnet example.com 443

If the port is open, you will see a blank screen. If the port is closed, you will see a message like «Connection refused.«

How can I tell if port 443 is open?

If you want to check if port 443 is open on a remote server, you can use the telnet command to attempt to connect to the server on that port. For example, if you’re trying to check if port 443 is open on http://www.example.com, you would run the following command:

telnet http://www.example.com 443

If the port is open, you will see a blank screen. If the port is closed, you will see a message saying «Could not open connection to the host, on port 443: Connect failed.«

How check port is open in CMD?

To check if a port is open in CMD, you can use the netstat command. This command will show you a list of all the open ports on your computer. To use the netstat command, open the Command Prompt and type «netstat -a«.

One of the things I do the most when troubleshooting deployments of services exposing data to the internet is pinging the IP and port where the service is supposed to be alive. In this tutorial, I will show you how to ping IP and port on Linux and Windows.

I think most system administrators know the commands for this, but if you like me normally don’t work like an IT admin (at least not anymore) I tend to forget the commands. Due to that, I have written this article as a reference for myself but also for everyone else, who is in need of pinging services they expect at a location.

Often it’s enough to just ping an IP to validate that you got “life” on the server. However if you like me often got many services running on one server (often when using Docker), I need to ping the specific port number on the server. One of the Kubernetes clusters I manage is running more than 100 services and here I use it a lot.

In this article/reference post, I will show you how to ping IP and port on your Windows or Linux machine using different commands in the terminal (CLI).

Ping IP and port using Telnet

This is my favorite when working on both Windows and Linux. I also think that it’s the easiest one to use and it’s called Telnet. You can with a simple command using Telnet ping IP and port on the remote server you would like to check.

Telnet — Wikipedia

Wikimedia Foundation, Inc.Contributors to Wikimedia projects

If you want to, you can also use a domain instead of the IP. A domain is often easier for humans to remember instead of numbers to multiple different servers locally or externally.

Below are the commands to ping IP and port on a server using Telnet:

$ telnet <server_ip_address> <server_port_number>

$ telnet <server_domain_name> <server_port_number>

As I mentioned above, you can use Telnet on both Windows and Linux computers/servers which makes it a great choice for most sys-ops.

On most computers, telnet is not installed by default. If you get the annoying error “telnet: command not found”, you have to install Telnet on the machine using the commands below:

Install Telnet on Linux

If you are working on a Linux Server or Desktop, you can use the below command to install Telnet on that machine:

$ sudo apt install telnet

Install Telnet on Windows

By default, Telnet is not an enabled Windows Feature. If you run Telnet on your computer in a Command Prompt, you will get the following error: “Telnet is not recognized as an operable program or batch file.”. So – to install Telnet on Windows, you have to do the following:

  1. Click on Start.
  2. Select Control Panel.
  3. Choose Programs and Features.
  4. Click Turn Windows features on or off.
  5. Select the Telnet Client option.
  6. Click OK.
    A dialog box appears to confirm installation when it’s done. The telnet command should now be available in your Command Prompt. Remember to restart your CMD window.

Ping IP and port with Telnet example

Let’s check out how Telnet works. This website is running at IP: 172.67.161.26 – this is the public IP address of the website to which the domain is mapped to.

By default, all requests are redirected to HTTPS (port 443) if a request is made at port 80. This means that the server accepts connections on port 80 too – let’s try and ping both ports:

$ telnet 172.67.161.26 80

Trying 172.67.161.26...
Connected to 172.67.161.26.
Escape character is '^]'.

$ telnet 172.67.161.26 443

Trying 172.67.161.26...
Connected to 172.67.161.26.
Escape character is '^]'.

That went well. We got connected and could see that the server is responding on both ports. This simply means that the service on the port is up and running.

If you would like to escape out of the Telnet utility when connected, you can use “CTRL + ] or the “q” command.

Ping IP and port using Nmap

Another well-used tool is Nmap. In Nmap, you can ping a port by using the “-p” option including the IP or domain you would like to scan.

Nmap: the Network Mapper — Free Security Scanner

Nmap Free Security Scanner, Port Scanner, & Network Exploration Tool. Download open source software for Linux, Windows, UNIX, FreeBSD, etc.

Free Security Scanner

$ nmap -p <server_port_number> <server_ip_address>

$ nmap -p <server_port_number> <internet_domain_name>

A heads up – be aware of legal issues!

“When used properly, Nmap helps protect your network from invaders. But when used improperly, Nmap can (in rare cases) get you sued, fired, expelled, jailed, or banned by your ISP.” – Nmap website.

If you get an error telling you that Nmap is not available on your computer/server, you would have to install it.

Install Nmap on Linux

To install Nmap on your Linux machine, you can use the below command:

$ sudo apt install nmap

Install Nmap on Windows

Not as simple as Linux, but it’s still easy to use the official installer from Nmap’s website. Go to this page: Download Nmap and look under the Windows Binaries for the latest available installer file.

Once the installer has completed installing, you are now ready to use Nmap on your Windows computer.

Ping IP and port using Nmap

Let’s try to ping a website at IP “172.67.161.26” on the global internet at the default HTTPS port – 443. If you test this yourself, then don’t use that IP. Cloudflare is protecting the website and will block your access and in the worst-case ban your IP from their global network. Only do this at IPs you own or services that won’t do any damage to others.

C:\Users\christian>nmap -p 443 172.67.161.26
Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-10 06:50 Romance Standard Time
Nmap scan report for 172.67.161.26
Host is up (0.028s latency).

Well, once again the port is returned as open on the server. This means that there is a service accepting data at port 443, which was just verified by Nmap.

Ping IP and port using PowerShell

Normally when I’m not on my own machines, which means I’m working on production servers not related to my own business/platform and it’s a Windows Server Environment, I always use PowerShell to ping IP and port.

A great thing about PowerShell is that you can use the methods in scripts running automated stuff in the background or during the setup of service or multiple services. A great thing if deploying with PowerShell would be to check if the ports were active after deployment and return a status to the terminal.

In PowerShell, we got something called Test-NetConnection which is a command where you specify either an IP or a domain followed by the port you would like to ping.

PS C:\Users\christian> Test-NetConnection <server_ip_address> -p <server_port_number>

Below is an example of what this would look like on a local network:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
                                                                                                                                                                                                                                                                             PS C:\Users\christian> Test-NetConnection 192.168.1.1 -p 80                                                                                                                                                                                                                                                                                                                   ComputerName     : 192.168.1.1
RemoteAddress    : 192.168.1.1
RemotePort       : 80
InterfaceAlias   : Wi-Fi
SourceAddress    : 192.168.1.68
TcpTestSucceeded : True

In the test above you can see that the TCP call to my gateway at home succeeded at port 80. If you can’t get through to the service you will status False in TcpTestSucceeded.

Summary

In this quick article on how to ping IP and port using different tools on Windows or Linux machines, we learned how we can use the terminal to check if a given port is open and accepting requests.

If you got any issues, questions, or suggestions, please let me know in the comments below. Happy pinging!

Christian Schou

My name is Christian. I am a 27-year-old pragmatic DevOps engineer with a passion for .NET, Cloud, and Containers. In my spare time, I share my knowledge and love teaching other people about tech.

Introduction

The ping command is a network tool for checking whether a remote system is up and running. In other words, the command determines if a certain IP address or a host are accessible. Ping uses a network layer protocol called Internet Control Message Protocol (ICMP) and is available on all operating systems.

On the other hand, port numbers belong to transport layer protocols, such as TCP and UDP. Port numbers help identify where an Internet or other network message is forwarded when it arrives.

In this tutorial, you will learn how to ping a port in Windows and Linux using different tools.

How to ping a specific port number.

Prerequisites

  • A Linux or Windows system
  • Access to the command line
  • An account with sudo/admin privileges

Can You Ping a Specific Port?

Network devices use ICMP to send error messages and information on whether communication with an IP address is successful or not. ICMP differs from transport protocols as ICMP is not used to exchange data between systems.

Ping uses ICMP packets, and ICMP does not use port numbers which means a port can’t be pinged. However, we can use ping with a similar intention – to check if a port is open or not.

Some network tools and utilities can simulate an attempt to establish a connection to a specific port and wait to see if the target host responds. If there is a response, the target port is open. If not, the target port is closed, or the host is unable to accept a connection because there is no service configured to listen for connections on that port.

You can use three tools to ping a port in Linux:

  • ‎Telnet
  • Netcat (nc)
  • ‎Network Mapper (nmap)

See our tutorial on how to use the ping command in Linux to learn about additional ping options and variations in Linux.

Ping a Specific Port Using Telnet

Telnet is a protocol used for interactive communication with the target host via a virtual terminal connection.

1. To check whether telnet is already installed, open a terminal window and enter telnet.

Install Telnet on Linux.

2. If telnet is not installed, install it using the following command

  • For CentOS/Fedora: yum -y install telnet
  • For Ubuntu: sudo apt install telnet

3. To ping a port using telnet, enter the following command in the terminal:

telnet <address> <port_number>

The <address> syntax is the domain or the IP address of the host, while <port_number> is the port you want to ping.

telnet google.com 443
Ping a port in Linux using Telnet

If the port is open, telnet establishes a connection. Otherwise, it states a failure.

4. To quit telnet, press Ctrl + ] and run the q command.

Ping a Specific Port Using Netcat

Netcat (nc) reads and writes from connections using TCP and UDP protocols. This command-line tool can perform many network operations.

1. To check if netcat is installed:

  • For Debian, Ubuntu, and Mint: enter netcat -h
  • For Fedora, Red Hat Enterprise Linux, and CentOS: ncat -h

2. If netcat is not installed, run the following command in the terminal:

sudo apt install netcat

3. To ping a port using netcat enter the following:

nc -vz <address> <port_number>
Ping a port using netcat

The output informs the user if the connection to the specified port is successful or not. If it is successful, the port is open.

Ping a Specific Port Using Nmap

Nmap is a network tool used for vulnerability scanning and network discovery. The utility is also useful for finding open ports and detecting security risks.

Important: Be aware of legal ramifications regarding improper Nmap use, for example, flooding a network or crashing a system.

1. Check if you have Nmap installed by entering nmap -version in the terminal.

Check nmap version on Linux

If Nmap is installed, the output informs the user about the app version and platform it runs on.

2. If there is no Nmap on your system, enter the following command:

  • For CentOS or RHEL Linux: sudo yum install nmap
  • For Ubuntu or Debian Linux: sudo apt install nmap

3. Once Nmap is installed on the system, use the following command to ping a specific port:

nmap -p <port_number> <address>
Ping a port using nmap on Linux

The output informs the user about the port’s state and service type, latency, and the time elapsed until the completion of the task.

4. To ping more than one port, enter nmap -p <number-range> <address>.

The <number-range> syntax is the range of port numbers you want to ping, separated by a hyphen.

For example:

nmap -p 88-93 google.com
Ping several ports using nmap on Linux

Learn in-depth how to use nmap to scan ports with our guide How To Scan & Find All Open Ports With Nmap.

How to Ping a Specific Port in Windows?

There are two ways to ping a port in Windows:

  • Telnet
  • PowerShell

Ping a Port Using Telnet

Before using telnet, make sure it is activated:

1. Open the Control Panel.

2. Click Programs, and then Programs and Features.

3. Select Turn Windows features on or off.

4. Find Telnet Client and check the box. Click OK.

You activated the Telnet Client on the system.

After completing the activation, you are ready to ping a port using telnet.

Follow these steps:

1. Search for “cmd” in the start menu. Click the Command Prompt.

2. In the command prompt window, enter

telnet <address> <port_number>

The <address> syntax is the domain or the IP address of the host, while <port_number> is the port number you want to ping.

Ping a port using telnet on Windows

The output lets you know if the port is open and reachable. Alternatively, a connection failure message is shown.

Ping a Port Using PowerShell

PowerShell is a text-based shell that comes with Windows by default.

To ping a port using PowerShell, follow these steps:

1. Search for “PowerShell” in the start menu. Click the Windows PowerShell app.

2. In the PowerShell prompt window enter

Test-NetConnection <address> -p <port_number>
Ping a port using PowerShell on Windows

If the port is open and the connection passes, the TCP test is successful. Otherwise, a warning message appears saying the TCP connection failed.

Conclusion

Now you know how to ping and check if a port is open by using several network tools and utilities on Linux and Windows.

Bear in mind that you should not do TCP probing or scan a system unless you have the owner’s permission. Otherwise your actions may be interpreted as an attempt to compromise security.

Introduction

You will discover how to use several resources to ping a specific port on Windows and Linux in this article.

One of the best ways to diagnose problems and determine whether a service is operational is to ping with port number.

To be more precise, the command checks to see if a host or even an IP address is approachable. Various operating systems support the network layer protocol known as Ping, also known as Internet Control Message Protocol (ICMP).

In contrast, transport layer protocols like TCP and UDP get associated with port numbers. When an Internet or any other network message comes, port numbers make it easier to determine where it will get routed.

System Requirements

For this strategy, the following systems are needed:

  • an OS such as Linux or Windows
  • Using the command line
  • a user account with the sudo/admin rights

Can you Ping a Specific Port on Linux?

Can you Ping a Specific Port on Linux?

As ICMP does not require specific port numbers and utilizes ICMP packets instead, a port cannot be ping-ed. To verify when a port is either open or closed, we can use ping, though, which serves a similar purpose.

ICMP is a protocol used by network devices to communicate errors and information about whether or not they have successfully communicated with an IP address. Because ICMP is not used for data transmission between systems, it distinguishes it from transport protocols.

The ability to simulate an effort to connect to a certain port and wait for a response from the target host is provided by some networking tools and utilities. The goal port is open when there’s a reply. If not, either the target port is getting closed, or perhaps the host cannot accept a connection since no service has been set to monitor for requests on that port.

How to Ping a Specific Port in Linux?

You can Ping on Specific Port with one of three techniques:

  • ‎Telnet
  • Netcat (nc) 
  • Network Mapping (nmap)

Ping with Port number using Telnet

For interactive contact with the target host over a virtual terminal connection, the Telnet mechanism get utilized.

1. Launch a terminal window then type telnet to see if telnet is already installed.

2. Use the command listed below to install telnet if it isn’t already installed.

yum -y install telnet for Fedora/CentOS.

Ping with Port number using Telnet

In Ubuntu, type sudo apt and install telnet.

Ping with Port number using Telnet

3. Use the following command to ping specific port utilising telnet:

telnet <address> <port_number>

Ping with Port number using Telnet

The host’s domain and IP address get specified in the syntax address>, and the port you would like to ping gets specified in the syntax port number>.

telnet google.com 443

Ping with Port number using Telnet

The connection gets made through telnet if the port is open. If not, it declares a failure.

4. Use the ‘q’ command to end telnet by pressing ‘Ctrl + ]’

Ping with Port number using Telnet

Ping to Specific Port Using Netcat

TCP and UDP are the two protocols that get used by Netcat (nc) to read and write from contacts. There are multiple distributed tasks that this command-line program can handle.

1. To verify that Netcat is set up:

  • You should type netcat -h for Debian, Ubuntu, and Mint.

Ping to Specific Port Using Netcat

  • Use the command “ncat -h” for Fedora, Red Hat Enterprise Linux, and CentOS.

Ping to Specific Port Using Netcat

2. Use the command below in the terminal when Netcat is not already installed:

sudo apt install netcat

Ping to Specific Port Using Netcat

3. Type these commands into Netcat to ping with specific port:

nc -vz <address> <port number>

Ping to Specific Port Using Netcat

If a connection to the particular port was either successful or unsuccessful, it gets indicated in the response to the user. The port opens if the attempt is successful.

Ping Specific Port using Network Mapper (nmap)

A tool for networks called Nmap serves the purpose of network discovery and vulnerability analysis. The tool can also get used to find open ports and identify security problems.

It is key to remember that using Nmap improperly can have legal repercussions, such as overloading a network as well as disabling a system.

1. Run nmap -version inside the terminal to see if Nmap gets installed.

  • The output tells the user what version of the software and platform gets used, whether Nmap gets installed, and additional information.

Ping Specific Port using Network Mapper

2. Type the command below if your machine doesn’t already have Nmap running:

For Linux distributions based on CentOS or RHEL: sudo yum install nmap

Ping Specific Port using Network Mapper

  • sudo apt install nmap on a Linux system running Ubuntu or Debian.

Ping Specific Port using Network Mapper

3. To ping a particular port number after Nmap has got installed on the computer, utilize this command:

nmap -p <port_number> <address>

Ping Specific Port using Network Mapper

The output provides the user with data regarding the status, the type of service provided by the port, the latencies, and the remaining time till the task get finished.

4. Use nmap -p “number-range” “address” to ping with port number.

Ping Specific Port using Network Mapper

The range of ports you would like to ping, divided by a hyphen, would be the syntax of “number-range.”

  • For instance: nmap -p 88-93 google.com

Ping Specific Port using Network Mapper

Also Read: How to Setup Cron Job in Linux

How to Ping a Specific Port in Windows?

How to Ping a Specific Port in Windows?

Pinging a port with Windows can get done in one of two ways:

  • Telnet
  • PowerShell

Use Telnet to Ping a Port

Check to see if telnet is active before using it:

1. Access the Control Panel.

Use Telnet to Ping a Port

2. Choose Programs, followed by Programs and Features.

Use Telnet to Ping a Port

3. Click the On or Off Windows Functions option.

Use Telnet to Ping a Port

4. Click the box next to Telnet Client. Choose OK.

Use Telnet to Ping a Port

You now turned on the system’s Telnet Client.

You can get prepared to use telnet to ping a specific port only after the function gets finished.

Do the following actions:

1. Use the start menu to look up “cmd.” Choose the Command Prompt button.

Use Telnet to Ping a Port

2. Type the following in the command prompt window:

telnet <address> <port number>

Use Telnet to Ping a PortUse Telnet to Ping a Port

The host’s domain and IP address get specified in the syntax address>, and the port number you would like to ping gets specified in the syntax port number>.

You can determine whether the port is accessible and open from the output. 

Another option is to display a message about a connection failure.

Ping a Specific Port Using PowerShell

Windows by default include the text-based shell PowerShell.

By carrying out the subsequent actions, you can ping a port using PowerShell:

1. Look up “PowerShell” in the menu. To launch Windows PowerShell, click it.

2. Enter the following into the PowerShell command window.

Test-NetConnection <address> -p <port_number>

Ping a Specific Port Using PowerShell

A successful TCP test results from an open port and a working connection. If not, a notice stating that the TCP connection ended in failure shows.

Also Read: Check Python Version in Linux, Mac, & Window

Summing Up

By using a variety of network utilities and instruments on Linux and Windows, you now understand how to ping a specific port number.

Remember that without the owner’s authorization, you shouldn’t perform TCP probing or scans on a machine. If you don’t, your activities can be seen as a breach of security assault.

Обновлено Обновлено:
Опубликовано Опубликовано:

Тематические термины: Ping, Windows, Linux.

Мы рассмотрим использование команды ping для Windows и, немного, для Linux.

Параметры команды ping и их описание

В зависимости от используемой операционной системы опции команды будут иметь разные назначения. Поэтому, если мы хотим понять все возможности, стоит ознакомиться с опцией help.

Общий синтаксис

Независимо от системы, команду ping можно применять так:

ping [опции] <имя сервера или IP-адрес>

Windows

Для просмотра в Windows также используйте команду ping /?

Используются часто:

Параметр Описание
-t Команда будет отправлять запросы на проверку постоянно, пока ее не прервать клавишами Ctrl + C. Удобно, если сеть не работает и чтобы постоянно не проверять, появилась ли связь.
-a Пытается определить имя узла через DNS.
-n Задает определенное число попыток отправки запроса.
-l Размер пакета. Используется для проверки стабильности сети, создания тестовой нагрузки и так далее.
-f По умолчанию ping разрешает фрагментацию, то есть пакет может быть разбит на несколько для соответствия минимальному пропускаемому размеру (MTU). Данный флаг это запрещает. Используется для определения вышеупомянутого MTU.
-i Задает срок жизни пакета (количество сетевых устройств, через которые может пройти сигнал). Может использоваться в случаях, когда количество оборудования слишком велико. Также можно определить его количества. 
-w Устанавливает время ожидания. Применяется, если существуют проблемы производительности на сети или расстояние до узла очень большое.
-S Позволяет выполнить проверку сети с определенного источника. Может быть использовано с узла с несколькими сетевыми адаптерами и отправкой запроса с определенного.
-4 Использовать только IPv4.
-6 Использовать только IPv6.

Используются редко

Параметр Описание
-r Записывает маршрут для указанного числа прыжков.
-s Задает метку времени для указанного числа прыжков.
-j Задает свободный выбор маршрута по списку узлов.
-k Задает жесткий выбор маршрута по списку узлов.
-R Использует заголовок маршрута для проверки и обратного маршрута.

Linux

При минимальной инсталляциии данной системы или использовании docker, утилиты ping может не быть. В таком случае мы увидим ошибку:

bash: ping: command not found

Для ее установки можно воспользоваться менеджером установки пакетов. В зависимости от типа операционной системы, наши команды будут немного отличаться.

а) для систем на базе deb (Debian, Ubuntu, Mint):

apt install iputils-ping

б) для систем на базе RPM (Rocky Linux, CentOS, Red Hat, Fedora):

yum install iputils

Готово, теперь можно пользоваться командой ping.

Список ключей можно посмотреть так:

ping -h

Примеры использования

Простой пример использования команды ping

ping yahoo.com

Примерный ответ с исправной связью:

Обмен пакетами с yahoo.com [206.190.36.45] с 32 байтами данных:
Ответ от 206.190.36.45: число байт=32 время=191мс TTL=47
Ответ от 206.190.36.45: число байт=32 время=191мс TTL=47

Пример ответа, если узел недоступен:

Обмен пакетами с yahoo.com [206.190.36.45] по с 32 байтами данных:
Превышен интервал ожидания для запроса.
Превышен интервал ожидания для запроса.

* до удаленного узла нет сигнала. Возможно, существуют неполадки на сети.

или

При проверке связи не удалось обнаружить узел
Проверьте имя узла и повторите попытку.

* не удалось определить имя узла. Возможные неполадки: нет связи с DNS, не работает DNS, запрашиваемого имени узла не существует.

В Linux при отсутствии ответа, мы ничего не увидим, но если нам нужно видеть неудачные попытки, то используем ping с опцией -O:

ping -O 206.190.36.45

Открытие порта для Ping

Справедливо заметить, что не во всех случаях отсутствие ответа на ping означает, что удаленный узел недоступен. Администратор ресурса может намеренно отключить ответы на эхо-запросы.

Также важно знать, что ping не использует конкретный номер порта. Чтобы открыть возможность пинга, необходимо либо найти соответствующую опцию (во многих домашних роутерах) или разрешить ICMP (Internet Control Message Protocol) на брандмауэре. Ну, или наоборот — чтобы закрыть возможность пинга, блокируем запросы ICMP.

Проверка портов

С помощью команды ping нельзя проверить открытость того или иного порта.

Для этих целей используется команда telnet или программа, например, nmap.

Дмитрий Моск — частный мастер

Была ли полезна вам эта инструкция?

Да            Нет

  • Windows bootcamp на внешний диск
  • Windows cloud not load required file winsetup dll
  • Windows cannot load the drivers required for this device code 31
  • Windows certificate server request certificate
  • Windows cloth тряпка для стекла