Перейти к содержимому

Как пропинговать ip через командную строку

  • автор:

Методы пропинговки IP-адреса через «Командную строку»

Как пропинговать IP-адрес через командную строку

В операционной системе Windows есть целых две консольных утилиты, которые позволяют проверить доступность IP-адреса. Самая часто используемая называется ping и дает возможность проверить, насколько стабильно происходит обмен пакетами между указанным адресом и компьютером пользователя. Для ее применения потребуется выполнить такие действия:

  1. Откройте «Пуск» и запустите «Командную строку», отыскав ее через поиск. Перейти к консоли можно и любым другим удобным образом. Запуск командной строки для использования утилиты ping для пропинговки адреса
  2. Там введите ping IP-адрес , а затем нажмите на Enter. Ввод команды ping для пропинговки адреса через командную строку
  3. Ожидайте завершения обмена пакетами с указанным IP-адресом, следя за ответами в отдельных строках. Процесс проверки адреса через командную строку утилитой ping

Рассмотренный метод отлично подойдет для того, чтобы определить доступность IP-адреса, а также задержку при обмене пакетами без прямого перехода по его доменному адресу через браузер или соединение при помощи серверных средств. Однако иногда требуется отследить сам маршрут, с чем поможет справиться другая утилита.

Способ 2: Утилита tracert

Другая одна стандартная утилита операционной системы Windows под названием tracert пригодится, если при пропинговке требуется учитывать маршрут от компьютера к роутеру. Будет протестировано несколько маршрутов по введенному IP-адресу, а запуск этого процесса происходит так:

Использование команды tracert для пропинговки адреса через командную строку

    Вызовите «Командную строку» и введите там tracert IP-адрес .

Способ 3: Веб-интерфейс маршрутизатора

Иногда юзеров не устраивает использование «Командной строки» в Windows, что вызывает необходимость поиска другого средства пропинговки. Во многих веб-интерфейсах роутеров есть встроенная консоль, позволяющая выполнить те же действия, однако для ее использования потребуется сначала войти в интернет-центр, о чем более детально читайте далее.

Далее остается только следовать приведенной ниже инструкции. Она будет базироваться на внешнем виде маршрутизатора от ASUS, а обладателям других графических центров останется только найти соответствующие меню и начать процесс пропинговки.

  1. Через меню слева переместитесь в раздел «Network Tools». Еще этот раздел может называться «Системные инструменты» или «Дополнительно». Переход в раздел веб-интерфейса для пропинговки IP-адреса
  2. Там откройте консоль и задайте метод проверки IP-адреса. Выбор режима пропинговки IP-адреса через веб-интерфейс маршрутизатора
  3. Далее введите сам адрес и запустите диагностику. Запуск пропинговки IP-адреса через веб-интерфейс маршрутизатора
  4. В отдельном консольном окне отобразятся результаты, соответствующие тем, о которых мы уже говорили при разборе «Командной строки» в Windows. Результат пропинговки IP-адреса через веб-интерфейс маршрутизатора

Уточним, что часто причиной проблем с пропинговкой становится неправильная работа роутера или отсутствие соединения с интернетом. Если у вас при выполнении поставленной задачи возникли какие-либо проблемы, обратитесь к следующим инструкциям, чтобы оперативно решить их и проверить IP-адрес заново.

How to Ping an IP on Windows, macOS, and Linux

Checking network latency and server availability is important, and one way to do it is to ping an IP address. However, there are specific commands to use the feature, and you need a tool to perform it.

Fortunately, most operating systems have the tool built-in. For example, Windows users can use Command Prompt, while Linux and macOS users can utilize Terminal. Though they are different tools, the key steps and the information delivered will still be the same.

This article will explore how the ping command works and how to run it on Windows, macOS, and Linux. In addition, we will also explain how to read the ping results.

What Is the Ping Command and How Does It Work?

Ping (Packet Inter-Network Groper) is a computer network utility that allows users to verify and test the existence of a particular IP address and whether it can handle requests. It monitors network latency, device availability, and packet loss within a network.

When you run a ping test, it sends a data packet to the target host and transmits it over the network’s switch and router. Usually, it submits four to five pings at once to ensure the test is accurate.

A ping test works similarly to sonar technology. Upon receiving a data packet, the device with the specified address returns an echo reply or pong, confirming that it is online.

Ping measures the duration of response or approximate round-trip-times (RTT) – the time between the request being sent to a reply received, measured in milliseconds.

It also includes the number of bytes received, the time it takes to receive a response, and time-to-live (TTL), which measures how long a data packet should exist inside a network before being discarded by the router.

The ping test results provide helpful information to check or troubleshoot network problems. For example, if the test is successful but takes a long time to receive a response, it may indicate network congestion or speed and routing issues.

How to Ping an IP Address or a Domain Name

Generally, you can ping IP addresses as well as domain names. However, the process will depend on your operating system since different tools may differ.

This section will use Google’s public IP address 8.8.8.8 for the ping test.

Running Ping Using Command Prompt (Windows)

Here’s how to run the ping command on Windows 10:

  1. Open the search bar or press the Windows key + R simultaneously and type in “cmd”.
  2. Click Open to access the Command Prompt window.
  1. Run the command by typing “ping” along with the IP address or domain name you want to check. In this example, we’re entering ping 8.8.8.8.
  1. Press Enter – the request will be sent four times.
  1. The ping statistics will be presented at the end of the fourth reply.
  1. To stop the ping command from running, use the Ctrl + C shortcut.

Running Ping Using Terminal (Linux and macOS)

If you use Ubuntu or a similar Linux distro, follow these steps to run the ping command on Terminal:

  1. Click Show Applications at the bottom left of your screen.
  2. Type “terminal” in the search bar.
  1. Type in “ping” and hit Enter.
  1. Hit Ctrl + C to close the connection, and the statistics will appear.

Here’s how to do it on macOS:

  1. Click the Launchpad icon on the Dock.
  2. Type “terminal” in the search field.

Locating Terminal on macOS.

  1. Input “ping” and press Enter to start.

Running the ping command on macOS.

  1. The ping statistics will appear once the connection is closed by pressing the Ctrl + C shortcut.

The results of a successful ping test on macOS.

When running the ping command, there are some tips you can follow:

  • To initiate a continuous ping command, add -t after the IP address. For example:
  • To specify the number of packets or requests you want to perform, add -c before or after the IP address. For example:
Suggested Reading

Not sure how to specify the number of packets? Take a look at our guide on how to use the Linux ping command.

Reading the Ping Results

After running the ping command, the following line will contain the server’s hostname and the number of bytes being sent to it.

The following few lines indicate the echo replies from the server. Usually, each consists of three parts – bytes, time, and TTL. In most cases, the ping request is sent four times. After that, the ping statistics will follow.

The Packets line shows how many packets were sent, received, and lost. Any lost packets indicate a connection problem on the network.

The last line of the ping statistics features the approximate RTT that describes the connection speed in milliseconds. The higher the average time, the slower the connection to the server is.

Here’s what a successful ping test looks like on Command Prompt:

A successful ping on the Windows Command Prompt.

However, if the ping results show a request timeout, that means the destination IP address or domain name didn’t respond, and the pong reply wasn’t received.

This may be caused by various issues, such as the host or domain name not existing, the local network adapter not working, the DNS is still propagated, or the server experiencing downtime or a null route.

In some cases, if an IP address can be pinged from one device but can’t be pinged using another, it may indicate the IP being blocked.

Here’s what an unsuccessful ping test will look like:

An unsuccessful ping attempt on the Windows Command Prompt.

Conclusion

Pinging helps gather information and discover any connectivity issues early. When you ping an IP address or a domain name, a data packet is sent to the target host and transmitted over the network.

This is done to verify and test the existence of the IP address or domain name and whether it can handle requests. If the ping is successful, the target host will respond with echo replies. However, an error message like “Request timed out” may appear if it doesn’t.

While most operating systems have this utility, each uses a different command-line interface to access it. No matter the tool, the results will be the same.

We hope this article has helped you figure out how to use the ping command and understand its results. If you have any questions or suggestions, please leave them in the comments section below.

Noviantika is a web development enthusiast with customer obsession at heart. Linux commands and web hosting are like music to her ears. When she’s not writing, Noviantika likes to snuggle with her cats and brew some coffee.

Как пропинговать IP адрес через командную строку

При возникновении проблем с работой локальной сети или подключения к Интернет часто рекомендуют использовать команду «ping». Например, не редко можно услышать рекомендацию выполнить команду «ping» до удаленного компьютера или сервера. В данной статье мы рассмотрим именно этот вопрос. Здесь вы узнаете, как пропинговать IP адрес через командную строку. Статья будет актуальной для всех современных версий Windows, включая Windows 7 и Windows 10.

Команда « ping » — это программа для командной строки Windows, которая используется для проверки соединения между узлами в сетях на базе TCP/IP. Проверка соединения выполняется с помощью отправки на другой компьютер эхо-сообщения по протоколу ICMP (Internet Control Message Protocol). Если сообщения достигает получателя, то он должен отправить сообщение в ответ, после чего в командной строке появляется информация о получении ответа.

С помощью команды « ping » можно получать разную информацию. Например, вы можете узнать, работает ли компьютер по определенному IP адресу, есть ли связь с этим компьютером, а также какое качество соединения. Кроме этого, таким образом узнать IP-сервера по его доменному имени (или наоборот) и проверить работу DNS-сервера.

Нужно отметить, что удаленный компьютер может быть настроен таким образом, что он не будет отвечать на « ping » запросы. В этом случае не вы не сможете успешно пропинговать IP-адрес, даже в том случае, если компьютер работает, подключен к сети и соединение с ним хорошее.

В операционных системах Windows команда « ping » имеет следующий синтаксис:

  • ping [опции] [узел]

Самыми часто используемыми опциями команды « ping » являются:

  • /t — Продолжать отправлять ping запросы без остановки. Для прекращения нужно нажать Ctrl-C .
  • /a — Преобразовать IP-адрес компьютера в имя узла.
  • /n <количество> — Отправлять указанное количество ping-запросов. По умолчанию, 4.
  • /? – Просмотр справочной информации.

Для того чтобы посмотреть список всех доступных опций вы можете выполнить « ping /? » или ознакомиться с официальной документацией на сайте Майкрософт.

Команда « ping » работает очень просто и не требует прав администратора. Для того чтобы пропинговать IP адрес через командную строку вам будет достаточно запустить командную строку, ввести « ping » и через пробел указать IP адрес.

Чтобы запустить командную строку нужно открыть меню « Пуск » и ввести в поиск фразу « командная строка ». Поиск работает как в Windows 7, так и в Windows 10.

командная строка в поиске меню Пуск

Также командную строку можно запустить через меню « Выполнить ». В этом случае нужно нажать комбинацию клавиш Win-R и ввести « cmd ». Этот способ также работает как в Windows 7, так и в Windows 10.

cmd в меню Выполнить

После запуска командной строки можно выполнять команду « ping ». Например, для того чтобы пропинговать IP адрес 192.168.1.1 вам нужно ввести « ping » и через пробел указать IP-адрес « 192.168.1.1 ».

выполнение команды ping для ip адреса

Аналогичным образом мы можем выполнить пинг указывая не IP-адрес, а имя компьютера или домен. Это может быть полезно для проверки работы подключения к интернету. Например, чтобы пропинговать сайт Google.com нужно выполнить следующую команду:

выполнение команды ping для домена

Используя опции, которые поддерживает команда « ping », можно получить больше информации. Например, добавив опцию «/ a » можно узнать имя компьютера или домен, который связан с указанным IP-адресом. Например, для того чтобы узнать имя компьютера по IP-адресу « 192.168.1.111 » нужно выполнить следующую команду:

получение имени компьютера по ip адресу

Для того чтобы проверить стабильность соединения можно выполнить постоянный « ping ». Для этого команду нужно выполнять с опцией « /t ».

постоянный ping

Чтобы остановить постоянную отправку эхо-запросов нужно нажать Ctrl-C . После этого появится собранная статистика: количество отправленных, полученных и потерянных пакетов, а также процент потерь и время передачи в миллисекундах.

статистика команды ping

В целом команда « ping » – это простой и эффективный инструмент для диагностики локальной сети и проверки подключения к интернету, использовать который должен уметь любой пользователь.

  • Забыл пароль от WiFi
  • Сетевой кабель не подключен
  • Как расшарить папку в Windows 7
  • Как узнать IP адрес своего компьютера
  • Выключение компьютера через командную строку

Создатель сайта comp-security.net, автор более 2000 статей о ремонте компьютеров, работе с программами, настройке операционных систем.

Задайте вопрос в комментариях под статьей или на странице «Задать вопрос» и вы обязательно получите ответ.

Introduction

Avocado Aun

Ping is a network utility to check network connectivity to a target destination. Ping is built-in on Windows, Linux and MAC OS. Ping operates based on the Internet Control Message Protocol (ICMP). It is commonly used to find out whether a destination host is reachable or not.

Intuition

In this quarantine period, people stay at home during the lockdown restrictions. After spending countless day binge watching Netflix, you suddenly miss your friends. The natural thing to do is to reach out to our iPhone and call them — “Hey <insert weird name here>, are you still alive?”.

Machine also needs to know if their peers (target destination) are alive to communicate. Instead of iPhones, the machines use the PING command to check if their peers are still reachable on the network.

There are two ways for machines to check for host reachability;

(A) using Keepalive message (periodical)

Some devices like routers use keep alive messages that are sent out periodically to check if their peers are still alive. For example, routers that run on RIPv1 sends out updates every 30s to all their peers to keep the heartbeat alive.

(B) using Ping command (triggered)

End devices normally send PING request to a destination host and waits for the PING reply to determine if the target is reachable after a period of inactivity. For the devices that are already in a TCP session, there is no need to PING since we are sure these devices are already connected.

The Internet Control Message Protocol (ICMP) is a helper protocol that supports IP for error reporting and simple queries. Imagine throwing a stone at your neighbour’s house — your neighbour might throw the same piece of stone back at you; or if you got lucky, he might throw a piece of gold back at you. ICMP provides machines the same capability to throw this ‘are you alive’ message back and forth.

ICMP is a simple protocol; there are only 2 types of ICMP messages.

In this example, Host_A pings Host_B. Here, the Host_A sends the ICMP request to Host_B. If Host_B is reachable, it sends ICMP reply back to Host_A. If Host_B is not reachable, an ICMP error message is generated by the router and sent to Host_A.

There are two outcomes of the ICMP operations —

(A) Ping is successful

the source host successfully received the ICMP reply from the destination host. In this case, the connection metrics will be shown.

(B) Ping failed

the source host did not received the ICMP reply from the destination after a period of time. In this case, an ICMP error message will be generated to the source host.

There are many types of options for these two ICMP messages. This options made ICMP error messages to be intuitive; so we can quickly guess what’s causing the connectivity issues. The full table of ICMP codes can be found here. The two most common errors are Destination network unreachable and Request timed out.

How to use PING command

Ping is pre-installed as part of the network utilities in most modern OS. The syntax for ping is:

To use PING on Windows:

1. Launch command prompt.

2. Type the command ‘ping’ followed by the ‘destination host IP address’

To use PING on MAC OS

1. Launch terminal.

2. Type the command ‘ping’ followed by the ‘destination host IP address’

To use PING on Linux

1. Launch Shell

2. Type the command ‘ping’ followed by the ‘destination host IP address’

As you can see, the ping command is universal across most OS. The only differences is the types of options we can add while using the ping command. For example, on Windows; 4 ICMP request are sent for each ping command. Meanwhile, on Linux; the ICMP requests are sent indefinitely until the user manually stop it.

We can find out the options for PING using the -h parameter.

If we issue a ping to Google web server on a MAC; the machine will continuously ping until we press ctrl+c to terminate it.

To send only 2 ICMP request, we use the -c options. Here, we simply type ‘ping google.com -c 2’ to set the ICMP count.

There are many other options that you can experiment with based on the guides from -h output.

The figure below visualise what just happened — a local host with IP 192.168.1.1 is trying to ping Google.com web server located somewhere on the Internet with the IP 172.217.174.174. Firstly, the local host sends DNS request to DNS server to resolve ‘google.com’. Secondly, the DNS server return the IP 172.217.174.174 to the local host. Thirdly, the local host builds the ICMP request to the destination 172.217.174.174. After a shortwhile, Google replied back to the local host.

Troubleshooting connectivity issues with PING

Continuing from the earlier example where PC1 failed to ping failure Google Web Server. How do we fix this connectivity issues? — The first step is to isolate the point of failure. In this case, any device starting from PC1 itself, to the routers in the middle, until the destination web server can be a point of failure. To find out where it fails, we need to systematically ping each of the node along the path to detect where the ICMP packets are dropped.

A systematic troubleshooting starts from the source; going to the direction of destination. Here’s how we can perform step by step troubleshooting:

(1) Perform Self Diagnostic on PC1

On PC1, we perform a self-ping using the command ping 127.0.0.1. This is a self diagnostic test to check if the TCP/IP stack on PC1 is working properly. If the ping is successful, this means the problem is on some other nodes after PC1.

If the ping fails, it means the NIC of PC1 might not be working properly.

(2) Perform Ping Test to Router1

If PC1 is cleared, next we try to ping next hop address; which is Router1. We can ping either interfaces; 192.168.1.254 or 10.10.10.1 directly connected to Router1. If the ping is successful, this mean the packet is discarded somewhere after Router1.

If the ping failed, this imply that Router1 is mis-configured with the wrong IP address or the interface is not yet set to UP (using the no shut command); or the router is simply broken.

(3) Perform Ping Test to Router2

If Router1 is cleared, next we ping 10.10.10.2 on Router2. If the ping is successful, this means Router2 has already forwarded the packet to the next hop.

If it fails, this can means several things:

(a) IP is configured wrongly on Router2

(b) Interfaces on Router2 is not set to UP

(c) Hardware issues with Router2

(d) Routing is not configured from PC1’s Network to Google’s Network

(e) Firewall is blocking ICMP request from entering Router2

(f) If the ping pass at 10.10.10.2 but failed at 172.217.174.174, this could indicate issues with NAT configurations on Router2

(4) Perform Ping Test to Google Web Server

If Router2 is cleared, this means that the packet has succesfully traveled from PC1 →Router1 →Router2; so the last possible point of failure is the Google Web server.

If the ping is successful, then Google Web server will send the ICMP reply back in the opposite direction back to PC1 and that’s how PC1 see this output on its end.

This could due to the server is down at the moment, or the load balancer in Google Data center is simpl not responding. Most of the time, Google has setup Firewall to prevent outsiders from pinging their servers to prevent the denial-of-service attack. In some rare cases, the server is actually reachable; but the ICMP reply going back from the server →PC1 is dropped on the way back due to security settings like ACL.

Normally, we would ping the destination host directly in ping test. Step by step troubleshooting is only nessecarily if the ping fails.

Checking end to end connectivity with Trace Route

So step by step troubleshooting is cool, but imagine isolating a point of failure on a topology with 200 routers in between the source and the destination. That’s where trace route comes in.

Trace route is a network service (like ping on steroid) that check end to end connectivity at per-hop basis. Think automatically ping each nodes in the path leading to the destination; all with one ‘tracert’ command. The syntax is:

Using the same example network, we can quickly check the point of failure by performing tracert on PC1 to Google Web Server.

The output shows that Google Web server is reachable from PC1, across 3 hops. The latency of each hops is also shown. Tracert is also useful to troubleshoot poor performing nodes, especially to find out which router is congested when online game is lagging. In our example, both hops are so fast that the packet is forwarded to the next hop in only 6ms.

We can measure the time it takes for packet to travel from source to destination back to source as Round trip time (RTT). RTT gives a clearer picture of the network quality since the path taken to go from source →destination and back from destination →source might be different.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *