|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Print all Host on local network
Hello guys,
I would like to develop a script which takes a host name as argument and displays a message whether the host is on the local network or not. How can I accomplish that? Is there a file or command that I can use to list all host on the local network? ![]() |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
you can ping the host can compare it to you ip. If is is different than it is not local.
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
But this involves IP addresses, or is that also possible with a string host name i.e "UNIX01"?
|
|
#4
|
|||
|
|||
|
This pertains to linux machines, may be different on others:
arp -a dumps your machine's "Address Resolution Protocol" cache, i.e. your active connections. ping -b pings the entire local network BUT machines have to be setup to answer. Last edited by RudiC; 07-31-2012 at 05:11 AM.. |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Hi, You can try this; Code:
$ for ip in `echo '[1+pd254>aq]sa0 1-lax' | dc`; do ping -c 1 10.176.128.$ip>/dev/null; [ $? -eq 0 ] && echo "10.176.128.$ip UP" ; nslookup 10.176.128.$ip || : ; done Where the XXX.XXX.XXX is your first three octets. Regards Dave Last edited by gull04; 07-31-2012 at 05:32 AM.. Reason: Typo |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| what command for copy a filesystem (local host or remote host) | bora99 | Linux | 1 | 02-29-2012 07:05 AM |
| Help! How to find the local host after few ssh hops to remote host??? | gomes1333 | UNIX for Advanced & Expert Users | 3 | 03-27-2010 10:49 PM |
| ssh server is attachable from local network not from another network | old noob | IP Networking | 1 | 02-16-2009 07:24 PM |
| How to delete the files from local host to remote host | krishna176 | Solaris | 3 | 03-24-2007 04:48 PM |
| local host | tamemi | UNIX for Dummies Questions & Answers | 3 | 12-23-2003 04:44 PM |
|
|