- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Shell script: list all hosts in a network
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2005 09:06 PM
тАО07-27-2005 09:06 PM
i want to discover which IPs are in used in a network.
I want to do something like:
nslookup 146.16.14.[1-254]
Any ideas?
Solved! Go to Solution.
- Tags:
- nslookup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2005 09:11 PM
- Tags:
- ping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2005 09:16 PM
тАО07-27-2005 09:16 PM
Re: Shell script: list all hosts in a network
You could do this in a script:
i=0;while [ $i -le 254 ]; do nslookup 146.16.14.$i ; i=$((i+1));done
but it assumes that reverse lookup has been set for each IP-address on the DNS server.
Perhaps instead of nslookup, you could get a list from the DNS server ?
You could also tried and ping every ip-address in that segment, and see which ip-addresses that doesn't respond. But this assumes that the hosts are up and allowing icmp.
Cheers,
- Tags:
- while loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2005 09:17 PM
тАО07-27-2005 09:17 PM
Re: Shell script: list all hosts in a network
If you want to find all IP addresses currently active on your subnet then do as martin says:
# ping 146.16.14.255
then every alive machine will respond.
However your question also mentions nslookup, so perhaps you want to query your DNS for all IP addresses that have names? If so then
i=1
while [ i -lt 255 ]; do
nslookup 146.16.14.$i | grep -i name
(( i = i + 1 ))
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2005 09:41 PM
тАО07-27-2005 09:41 PM
Re: Shell script: list all hosts in a network
Great!