Showing posts with label ICMP. Show all posts
Showing posts with label ICMP. Show all posts

Ping Multiple Ip Addresses At Once In Linux Using Nmap

FREQUENTLY ASKED QUESTIONS  (Linux)
Q: How to ping to multiple ip addresses at once in linux Operating system?

          Nmap is a tool for pinging multiple ip address or hostnames at once from command line in Linux distributions. With Nmap you can easily identify the alive Machines in your LAN network ip address range.


Install Nmap first
If Nmap package is not installed in your linux, install it from yum repository (Here tested in Fedora linux. Should work in RPM based distributions like Redhat, CentOS, etc.)

[root@server ~]# yum install nmap
Loaded plugins: langpacks, presto, refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nmap.x86_64 2:5.50-2.fc15 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================
 Package        Arch             Version                 Repository        Size
========================================================================
Installing:
 nmap           x86_64           2:5.50-2.fc15           fedora           2.7 M
Transaction Summary
========================================================================
Install       1 Package(s)
Total download size: 2.7 M
Installed size: 9.7 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 2.7 M
nmap-5.50-2.fc15.x86_64.rpm                              | 2.7 MB     00:15
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 2:nmap-5.50-2.fc15.x86_64                                    1/1
Installed:
  nmap.x86_64 2:5.50-2.fc15
Complete!

Create a file with servers to ping
[root@server ~]# vim server_list
google.com
facebook.com
8.8.8.8
#(Add the server's ipaddress/hostnames to ping and save the file)


Send Pings
[root@server ~]# nmap -sP -iL server_list

Starting Nmap 5.50 ( http://nmap.org ) at 2012-05-19 16:56 IST
Nmap scan report for google.com (74.125.236.38)
Host is up (0.0096s latency).
Other addresses for google.com (not scanned): 74.125.236.39 74.125.236.33 74.125.236.41 74.125.236.32 74.125.236.36 74.125.236.40 74.125.236.37 74.125.236.46 74.125.236.34 74.125.236.35
rDNS record for 74.125.236.38: maa03s04-in-f6.1e100.net
Nmap scan report for facebook.com (69.171.229.11)
Host is up (0.0096s latency).
Other addresses for facebook.com (not scanned): 69.171.242.11 66.220.158.11 66.220.149.11
rDNS record for 69.171.229.11: www-10-06-prn1.facebook.com
Nmap scan report for google-public-dns-a.google.com (8.8.8.8)
Host is up (0.0094s latency).
Nmap done: 3 IP addresses (3 hosts up) scanned in 2.85 seconds

Where....
-sP :is for pinging
-iL :is for input a file name.


Check Related Posts:

[SOLVED] Time to live exceeded ping error


"Time to live exceeded" this ICMP ping error is due to the time to live (TTL) field reaches a zero value or there is a timeout for the reassembly of segments . As a solution I will  recommend to increase the TTL (Time To Live) value (highest is 255).


Solution for time to live exceeded error
For example,  run traceroute to ipaddress 8.8.8.8 (Google's publc DNS server). And find number of hops to the destination.
      [root@server ~]# traceroute 8.8.8.8      (in linux distro)
      C:\>tracert 8.8.8.8                                (in Windows OS)
For me its 6 hops to 8.8.8.8. 
So a minimum TTL value of 6 is required to reach icmp packets to 8.8.8.8 and get ping replay. And cannot ping to 8.8.8.8 with a TTL value of 5 or less.


Ping Results with different TTL values
[root@server ~]# ping 8.8.8.8 -t 5                 (-t 5  is for custom TTL value of 5)

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.1.1  icmp_seq=1 Time to live exceeded
From 192.168.1.1  icmp_seq=2 Time to live exceeded
From 192.168.1.1  icmp_seq=3 Time to live exceeded
From 192.168.1.1  icmp_seq=4 Time to live exceeded


[root@server ~]# ping 8.8.8.8 -t 6             (-t 6  is for custom TTL value of 6)
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=55 time=48.9 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=55 time=49.5 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=55 time=50.4 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=55 time=49.4 ms

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons