GagA// 0n D nEt

It is currently Tue Aug 21, 2018 10:15 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Linux: Ping a Block of hosts (all the ips in a subnet)
PostPosted: Sat Jan 10, 2009 6:00 pm 
Offline

Joined: Wed Jul 18, 2007 1:14 am
Posts: 181
While troubleshooting network related problems there can be a time when you need to ping an entire block of IP addresses.

You can use the fping or ping command to do the same.

You need to use the -g flag for fping to enerate a target list from a supplied IP netmask, or a starting and ending IP. Specify the netmask or start/end in the targets portion of the command line.

Using fping

So if you want to ping all the IP addresses in the subnet 192.168.1.0/24, you can use the following command(s):
Quote:
[[email protected] ~]# fping -g 192.168.1.0/24

Or
Quote:
[[email protected] ~]# fping -g 192.168.1.1 192.168.1.254


Using ping

You can use the ping command for accomplishing the above task as well. The following is the procedure:
Quote:
[[email protected] ~]# for i in {1..254}; do ping -c1 192.168.1.$i; done


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group