Ping ports in linux

Как сделать пинг порта в Linux и Windows

👋🏻 Привет! С вами снова Merion Academy — платформа доступного IT образования . Сегодня мы поговорим о том, как сделать пинг порта в Linux и Windows. Гооу.

Команда ping — это сетевой инструмент для проверки работоспособности удаленной системы. Другими словами, команда определяет, доступен ли определенный IP-адрес или хост. Ping использует протокол сетевого уровня, называемый Internet Control Message Protocol ( ICMP ), и доступен во всех операционных системах.

С другой стороны, номера портов принадлежат протоколам транспортного уровня, таким как TCP и UDP . Номера портов помогают определить, куда пересылается Интернет или другое сетевое сообщение, когда оно приходит.

В этом руководстве вы узнаете, как проверить связь с портом в Windows и Linux с помощью различных инструментов.

Можно ли пропинговать конкретный порт?

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

Ping использует пакеты ICMP, а ICMP не использует номера портов, что означает, что порт не может быть опрошен. Однако мы можем использовать ping с аналогичным намерением — чтобы проверить, открыт порт или нет.

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

Как пропинговать определенный порт в Linux?

Вы можете использовать три инструмента для проверки связи порта в Linux:

Пинг определенного порта с помощью Telnet

Telnet — это протокол, используемый для интерактивной связи с целевым хостом через соединение виртуального терминала.

1. Чтобы проверить, установлен ли уже telnet, откройте окно терминала и введите:

Источник

How to ping port in Linux

It is possible to determine whether or not a specific port is open on a remote system by using tools such as nmap or telnet on a Linux system.

New users may be surprised that a command like ping is rather useless in this context, as the tool cannot tell us whether a specific port is open or not. Instead, it just tests connectivity to another system by sending ICMP packets.

In this tutorial, we will show you how to install the nmap and/or telnet utility on major Linux distros, and then go over example commands that can be used to check whether or not a specific port on a remote system is open and listening.

Читайте также:  Linux открыть страницу из терминала

In this tutorial you will learn:

  • How to install nmap and telnet on major Linux distros
  • How to perform a broad or specific port scan with nmap
  • How to test a specific port with telnet command

How to ping port in Linux

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux system
Software nmap, telnet
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install nmap and telnet on major Linux distros

The two tools we will be covering in this tutorial are nmap and telnet . By default, one or both tools may not be already installed on your Linux disto.

You can use the appropriate command below to install nmap and/or telnet with your system’s package manager.

To install nmap and/or telnet on Ubuntu, Debian, and Linux Mint:

$ sudo apt install nmap telnet

To install nmap and/or telnet on Fedora, CentOS, AlmaLinux, and Red Hat:

$ sudo dnf install nmap telnet

To install nmap and/or telnet on Arch Linux and Manjaro:

$ sudo pacman -S nmap inetutils

How to ping a specific port with nmap

How to ping a specific port with telnet

  1. The other way to test whether a specific port is open on a remote server is to use telnet command. You can specify a target device via hostname, domain name, or IP address. Try connecting to a specific port by specifying the number after the host. Below we test whether a port 443 on host google.com is open:
$ telnet google.com 443 Trying 74.125.237.19. Connected to google.com. Escape character is '^]'.
GET /index.html HTTP/1.0 Host: example.com

Closing Thoughts

In this tutorial, we saw how to install and use nmap and telnet on a Linux system in order to ping specific ports on a remote server. Either tool works very well to quickly determine whether or not a port is open and listening.

Comments and Discussions

NEWSLETTER

Subscribe to Linux Career Newsletter to receive latest news, jobs, career advice and featured configuration tutorials.

WRITE FOR US

LinuxConfig is looking for a technical writer(s) geared towards GNU/Linux and FLOSS technologies. Your articles will feature various GNU/Linux configuration tutorials and FLOSS technologies used in combination with GNU/Linux operating system.

When writing your articles you will be expected to be able to keep up with a technological advancement regarding the above mentioned technical area of expertise. You will work independently and be able to produce at minimum 2 technical articles a month.

TAGS

  • VIM tutorial for beginners
  • How to install the NVIDIA drivers on Ubuntu 20.04 Focal Fossa Linux
  • Bash Scripting Tutorial for Beginners
  • How to check CentOS version
  • How to find my IP address on Ubuntu 20.04 Focal Fossa Linux
  • Ubuntu 20.04 Remote Desktop Access from Windows 10
  • Howto mount USB drive in Linux
  • How to install missing ifconfig command on Debian Linux
  • AMD Radeon Ubuntu 20.04 Driver Installation
  • Ubuntu Static IP configuration
  • How to use bash array in a shell script
  • Linux IP forwarding – How to Disable/Enable
  • How to install Tweak Tool on Ubuntu 20.04 LTS Focal Fossa Linux
  • How to enable/disable firewall on Ubuntu 18.04 Bionic Beaver Linux
  • Netplan static IP on Ubuntu configuration
  • How to change from default to alternative Python version on Debian Linux
  • Set Kali root password and enable root login
  • How to Install Adobe Acrobat Reader on Ubuntu 20.04 Focal Fossa Linux
  • How to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux
  • How to check NVIDIA driver version on your Linux system
  • Nvidia RTX 3080 Ethereum Hashrate and Mining Overclock settings on HiveOS Linux
Читайте также:  Просмотр прав доступа папка linux

LATEST TUTORIALS

  • Enabling SSH on Raspberry Pi: A Comprehensive Guide
  • Boot Your Raspberry Pi from a USB: A Tutorial
  • Checking Your Raspberry Pi’s OS Version
  • Install an OS on Your Raspberry Pi: Step-by-Step
  • Finding Your Raspberry Pi’s IP Address: A Quick Guide
  • Easy Steps to Update Your Raspberry Pi
  • Connecting Your Raspberry Pi to Wi-Fi: A How-To
  • How to install RealVNC viewer on Linux
  • How to check Raspberry Pi RAM size and usage
  • How to check Raspberry Pi model
  • Understanding UEFI and BIOS in Relation to Linux Nvidia Driver Installation
  • How to orchestrate Borg backups with Borgmatic
  • How to monitor filesystem events on files and directories on Linux
  • Debian USB Firmware Loader Script
  • How to install and self host an Ntfy server on Linux
  • How to backup your git repositories with gickup
  • How to bind an SSH public key to a specific command
  • Creating a Bootable USB for Windows 10 and 11 on Linux
  • How to list all displays on Linux
  • List of QR code generators on Linux

Источник

How to Ping a Specific Port Number

Ping is probably the most used tool for checking the network connection to a remote system. Using ping is very easy. You just use the command ping together with the IP address or URL of the remote server.

ping faebook.com PING faebook.com (157.240.24.20) 56(84) bytes of data. 64 bytes from edge-star-shv-01-sin2.facebook.com (157.240.24.20): icmp_seq=1 ttl=51 time=307 ms 64 bytes from edge-star-shv-01-sin2.facebook.com (157.240.24.20): icmp_seq=2 ttl=51 time=225 ms

But what is the default port for the ping command? The answer is none.

Ping is based on ICMP, not TCP or UDP and ICMP protocol doesn’t have port numbers.

So how do you ping a specific port number of the remote server?

You cannot do that with the ping command. However, there are other tools that allow you to ping specific TCP or UDP ports.

Let me show you a couple of such tools and how to use them for pinging a given port number.

Ping specific port with Nmap

Nmap is a network scanning tool. While you can do a lot with Nmap, I’ll show you how to use it for pinging a specific port.

But first, make sure that you have Nmap installed on your system. On Debian/Ubuntu based distributions, you can use the command below to install Nmap.

Читайте также:  Running jar file linux

Once you have made sure that you have Nmap installed, you can use it in the following manner to ping a port:

The output will be something like this:

Starting Nmap 7.60 ( https://nmap.org ) at 2019-01-07 10:40 IST Nmap scan report for facebook.com (157.240.24.35) Host is up (0.49s latency). Other addresses for facebook.com (not scanned): 2a03:2880:f10c:83:face:b00c:0:25de rDNS record for 157.240.24.35: edge-star-mini-shv-01-sin2.facebook.com PORT STATE SERVICE 443/tcp open https Nmap done: 1 IP address (1 host up) scanned in 10.35 seconds

As you can see in the output, the server is up and it responded that the port number 443 of type TCP is open.

If you want to scan more than one ports, you can do that as well. For example, you can provide a range of port numbers like this:

The output will provide information on each individual port:

Starting Nmap 7.60 ( https://nmap.org ) at 2019-01-07 10:48 IST Nmap scan report for facebook.com (157.240.24.35) Host is up (0.34s latency). Other addresses for facebook.com (not scanned): 2a03:2880:f139:183:face:b00c:0:25de rDNS record for 157.240.24.35: edge-star-mini-shv-01-sin2.facebook.com PORT STATE SERVICE 80/tcp open http 81/tcp filtered hosts2-ns 82/tcp filtered xfer 83/tcp filtered mit-ml-dev 84/tcp filtered ctf 85/tcp filtered mit-ml-dev 86/tcp filtered mfcobol 87/tcp filtered priv-term-l 88/tcp filtered kerberos-sec Nmap done: 1 IP address (1 host up) scanned in 4.49 seconds

You may also use the port name instead of the port number:

The output remains the same as the previous command.

If you want to specifically ping the TCP port, you can specify that as well:

nmap -p 443 -sT facebook.com
nmap -p 443 -sU facebook.com

Nmap is not the only tool. You can use some other tools as well.

Using telnet to ping a specific port on remote server

Telnet is a remote connection tool similar to SSH however SSH is more secure by design than Telnet.

Before using Telnet, you should make sure that it is installed. On Debian/Ubuntu, you can use this command to install Telnet:

Once you have Telnet, you can use it to connect to a specific port of a remote system.

If it’s successful, you should see an output like this:

telnet facebook.com 443 Trying 157.240.24.35… Connected to facebook.com. Escape character is '^]'.

You can close the connection using the keyboard shortcut Ctrl+] or simply press Ctrl+C.

Why there is no response from the port?

All the examples I showed so far had a successful response. But what if there is no response. What does it mean?

There could be a few possible reasons why I port may not respond.

  • There are no services listening to the port so there is nothing that will respond.
  • A firewall is blocking the incoming traffic on the specific port.
  • There is actually a network connection issue between you and the server in question.

I hope you liked this tutorial and learned how to ping a specific port number. If you have any questions or suggestions, please leave a comment below.

Источник

Оцените статью
Adblock
detector