Linux: пингаем всю сеть одной командой.Сегодняшняя статья о том как узнать какие ip адреса в сети свободны, какие заняты и какие отвечают на icmp запросы. Как обычно мы рассмотрим несколько вариантов решения задачи.

[ad#ad-2]
Вариант первый: nmap

nmap -sP 192.168.247.*
 
Starting Nmap 5.00 ( http://nmap.org ) at 2010-03-23 10:40 EET
Host 192.168.247.1 is up (0.00052s latency).
Host tester (192.168.247.2) is up (0.00038s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 3.32 seconds
nmap -sP 192.168.247.1-20
 
Starting Nmap 5.00 ( http://nmap.org ) at 2010-03-23 10:40 EET
Host 192.168.247.1 is up (0.00017s latency).
Host tester (192.168.247.2) is up (0.00046s latency).
Nmap done: 20 IP addresses (2 hosts up) scanned in 1.51 seconds

Если nmap не установлен у вас то в Ubuntu Linux вы можете установить его так

sudo aptitude install nmap

Вариант второй fping

fping -g 192.168.247.0/28
192.168.247.0 error while sending ping: Permission denied
 
192.168.247.2 is alive
192.168.247.15 error while sending ping: Permission denied
 
192.168.247.1 is alive
ICMP Host Unreachable from 192.168.247.1 for ICMP Echo sent to 192.168.247.3
ICMP Host Unreachable from 192.168.247.1 for ICMP Echo sent to 192.168.247.3
ICMP Host Unreachable from 192.168.247.1 for ICMP Echo sent to 192.168.247.3
ICMP Host Unreachable from 192.168.247.1 for ICMP Echo sent to 192.168.247.4
ICMP Host Unreachable from 192.168.247.1 for ICMP Echo sent to 192.168.247.4
.....
192.168.247.15 is unreachable

Или так

fping -g 192.168.247.1 192.168.247.3
192.168.247.1 is alive
192.168.247.2 is alive
ICMP Host Unreachable from 192.168.247.1 for ICMP Echo sent to 192.168.247.3
ICMP Host Unreachable from 192.168.247.1 for ICMP Echo sent to 192.168.247.3
ICMP Host Unreachable from 192.168.247.1 for ICMP Echo sent to 192.168.247.3
192.168.247.3 is unreachable

Если fping не установлен, то в Ubuntu Linux его можно установить так

sudo aptitude install fping



Similar Posts:

Теги:
 

One Response to Linux: пингаем всю сеть одной командой.

  1. admin:

    А еще можно башевским скриптом
    типа так for i in {1..254}; do ping -c1 192.168.1.$i; done

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

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

*

Можно использовать следующие HTML-теги и атрибуты: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">