How to identify a network device before trying to connect to it?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to identify a network device before trying to connect to it?
# 1  
Old 10-19-2012
How to identify a network device before trying to connect to it?

Hello all,

Here is the explanation of my problem:
I have a cronjob that connects to a NAS to do backups from my laptop to this NAS device.
The script that I wrote does check if there is a host (the NAS) responding on 192.168.1.10 and tries to connect to it with the following command:
Code:
mount -v -t cifs -o user=fred_fedora%passwd //192.168.1.10/share /media/Big

And well, it works perfectly when I am at home, but:
Problem:
When I am connected on a network at some clients, I realized that it is also trying to connect to some computer on 192.168.1.10 if there is a host responding at this address on the network...

Question:
How would you check the hostname of the host on 192.168.1.10 before trying to connect to it?
What is the best way to check that you are in touch with the host you know and trust before trying to connect to it?

Many thanks for your help and keep up the good work!
freddie50
# 2  
Old 10-19-2012
Since you only want the home machine, check the mac address? After all, you cannot be sure it is something you can log in to but it has to be something you can ARP. Of course, you need a tool that can do an ARP on the local network.

Alternatively, since you can log into your own host, just "ssh -n nas_host uname -n" with PPK authentication.
# 3  
Old 10-19-2012
Many thanks for your reply!

Indeed I thought about ssh on to the NAS with a private key installed but there is no ssh server on this old NAS...
For the Address Resolution Protocol (arp -ev 192.168.10) works great to give me the MAC address of my device.
Therefore it seems I have the right tools to arp!!
Good!! But could you please be a bit more specific on the kind of tool I have to ARP on my network in order to check the MAC address associated with the ip?
On other network how to check if I have such a tool?
I guess I just try the command arp..? But How to get this arp tool if I do not have it?
Please any links to more resource about this is more than appreciated.

Thanks again for your help, that is great advice!
freddie50
# 4  
Old 10-22-2012
It occurs to me that if you just ping the local collision domain Ethernet host, the mac will be in your host's ARP cache, if you can find where it is or list it.

Google time: How to display/clear ARP cache?

How to display ARP cache in Linux ?
There are two commands to display ARP cache.
Command 1 : ip neighbor show
[root@avas-2 ~]# ip neighbor show
Command 2 : arp
[root@avas-2 ~]# arp
Image
This User Gave Thanks to DGPickett For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

USB device not recognised after re-connect

Hi all unixware 7.1.3 I'm afraid ! I connected a usb tape drive and it was automatically recognised in the device list (sdiconfig -l) and created devices in /dev/rmt (ctape1 etc.). I could successfully read and write to the device. Then unplugged the usb cable and plugged it back in again... (0 Replies)
Discussion started by: deel
0 Replies

2. Red Hat

Unable To Activate Ethernet Network Device in RHEL 5.5 - e100 device eth0 does not seem to be presen

Hi All, Could anyone please help to resolve the below problem. I installed RHEL5.5 in my desktop.But when i try to activate the ethernet connection then it gives me the error. I spent 2 days for the above and go through with several suggestion found by googling. But no luck. ... (0 Replies)
Discussion started by: Tanmoy
0 Replies

3. Hardware

identify wireless network card

hi Howto identify wireless network card using Live CD? (2 Replies)
Discussion started by: ccc
2 Replies

4. IP Networking

What is a fake network device?

Thanks in advance! Ben (1 Reply)
Discussion started by: bigben1220
1 Replies

5. AIX

entstat: 0909-003 Unable to connect to device

Hello All, at our client VIOS Server there is shared ethernet adapter ent6, when I run lsattr -El ent6 the output shows real adapter ent1 lsattr -El ent6 accounting disabled Enable per-client accounting of network statistics True ctl_chan ent5 Control Channel... (2 Replies)
Discussion started by: Vit0_Corleone
2 Replies

6. IP Networking

how to identify network activity?

Hi there, I have a computer that is not a server. I mean it should have no network activity as it is meant to display videos and not to provide any ftp, web or whatever service. The probleme is that the computer actualy reports a constant network activity. How can I identify the processes that... (1 Reply)
Discussion started by: chebarbudo
1 Replies

7. IP Networking

Can AnyOne Help Me (connect two network)

Hi.. I have problem about connecting two network. First let me tell about my project. I use Quagga to build up IPv6 Island Network. At first, i build one (1) PC Router or one (1) network, i call it as Network A. All PC's or Laptop's (node's) that connect to Network A can communicated to each other... (4 Replies)
Discussion started by: Lieyza
4 Replies

8. Solaris

How to identify which device from ssd29?

Platform: Sun Solaris ver 9. Get alert notification from Oracle and the device stated: Disk utilization for ssd29 reached 98%. How can we map this ssd device with something like c1t2d0s0? Pls help. Thank you. (10 Replies)
Discussion started by: KhawHL
10 Replies

9. Programming

Network device driver

HI, I am writing a network device driver for RTL8139c card on 2.6.18 kernel ... I am facing few queries listed below 1. Can i able to at all write a driver for RTL8139C or Realtek had designed new chip for 2.6 series kernel? 2. If no then which driver file 2.6.18 uses .. Is it 8139too.c or... (1 Reply)
Discussion started by: niketan
1 Replies
Login or Register to Ask a Question