LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-26-2008, 01:35 PM   #1
Critcho
LQ Newbie
 
Registered: Feb 2006
Posts: 20

Rep: Reputation: 0
Return MAC Address with Ping


How do I get the MAC address of my remote equipment? I have a Windows utility called Angry IP Scanner that pings all IPs in the range I give it (e.g. to avoid ipAddresses clashing on my LAN). Angry returns a stack of info about the remote, including
- Host Name
- Computer Name
- User currently logged in
- MAC Address

Is this program running Ping or something else? I can't seem to find any details on MAC in the man pages for PING.

In short, how do I determine the MAC of a remote device, running linux at both ends.
 
Old 02-26-2008, 01:53 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well angry ip runs on linux too, but that mac only comes from an arp request, it's nothing "interesting" really, and is only the information that you'll have in your local arp cache anyway. you won't get it if the scan is done on a non-local network as that data doesn't persist through a router.
 
Old 02-26-2008, 02:08 PM   #3
Critcho
LQ Newbie
 
Registered: Feb 2006
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks for your help acid_kewpie, looks like I'm SOL... My remote device is on the other end of a mobile network, so I am jumping through a VPN and several routers to get there.
 
Old 02-26-2008, 02:10 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
if you're looking to manage these assets then you'd look to use a formal protocol like snmp to poll this sort of data in a civilized manner.
 
Old 11-02-2008, 03:50 PM   #5
Gadzila
LQ Newbie
 
Registered: Nov 2008
Posts: 8

Rep: Reputation: 0
I'm search very much and don't find how to find MAC address of some external user...
 
Old 11-02-2008, 03:51 PM   #6
Gadzila
LQ Newbie
 
Registered: Nov 2008
Posts: 8

Rep: Reputation: 0
And all network tools like Improved Network Tools say nothing about MAC address
 
Old 11-02-2008, 04:36 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
so you didn't actually bother reading what i wrote here 8 months ago?
 
Old 11-03-2008, 01:05 AM   #8
Gadzila
LQ Newbie
 
Registered: Nov 2008
Posts: 8

Rep: Reputation: 0
It's theme is actual for me now too.
 
Old 11-03-2008, 05:06 AM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Sorry, that makes no sense, and your question is *STILL* answered above.
 
Old 11-04-2008, 01:42 PM   #10
Gadzila
LQ Newbie
 
Registered: Nov 2008
Posts: 8

Rep: Reputation: 0
You sure that MAC of external user are really unaccessible ?
 
Old 11-04-2008, 02:02 PM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well how about you give me a *good* reason for wanting it.
 
Old 11-05-2008, 02:38 AM   #12
Critcho
LQ Newbie
 
Registered: Feb 2006
Posts: 20

Original Poster
Rep: Reputation: 0
To describe my original reason for wanting to get the mac: We manufacture RTUs (Remote Telemetry Units), which we configure and test in shop before we send to the customer. A customer may get 5 RTUs and 5 cellular modems in a shipment. Each modem is in the RTU box that it belongs to, but the customer still has to install them, so they sometimes get shuffled.

The devices should connect automatically, they will be assigned a static IP address from the cellular network. Once it has connected, I can log in remotely and check if it is working OK. However, if RTU#1 has been given modem #2, when I telnet to the IP address of modem #1, the password for RTU#1 will not work. If I can get the mac of the remote, I can see what RTU is actually at that IP Address, then I can start work.

Nothing malicious, but I guess again the many suffer inconvieniences brought on by the evils of the few.
 
Old 11-05-2008, 03:57 PM   #13
rg.viza
Member
 
Registered: Aug 2006
Posts: 74

Rep: Reputation: 15
Quote:
Originally Posted by Critcho View Post
To describe my original reason for wanting to get the mac: We manufacture RTUs (Remote Telemetry Units), which we configure and test in shop before we send to the customer. A customer may get 5 RTUs and 5 cellular modems in a shipment. Each modem is in the RTU box that it belongs to, but the customer still has to install them, so they sometimes get shuffled.

The devices should connect automatically, they will be assigned a static IP address from the cellular network. Once it has connected, I can log in remotely and check if it is working OK. However, if RTU#1 has been given modem #2, when I telnet to the IP address of modem #1, the password for RTU#1 will not work. If I can get the mac of the remote, I can see what RTU is actually at that IP Address, then I can start work.

Nothing malicious, but I guess again the many suffer inconvieniences brought on by the evils of the few.
Writing this up in the OP may have saved you a lot of grief.

If you can telnet to something on the same subnet, you can

$ arping 127.34.24.12
Unicast reply from 127.34.24.12 [00:50:56:10:00:FD] 1.611ms

it if the OS running on the gear supports it. You could also ping it:

$ ping 127.34.24.12

from something you do have access to, then run

$ arp

to print out the arp cache:
Code:
Address                  HWtype  HWaddress           Flags Mask            Iface
127.34.24.1             ether   00:1A:A1:94:AD:41   C                     eth0
127.34.24.12            ether   00:50:56:10:00:FD   C                     eth0
127.34.24.13            ether   00:50:56:10:00:FE   C                     eth0
See the mac address is how wire level network addressing happens. The IP address is easier and more logical for humans to route, deal with and organize in a much more orderly fashion than could be done with MAC (considering how ethernet works and the intended use of the MAC).

TCP IP was created to allow routing between broadcast domains, as opposed to enlarging them (a la bridging)

Much like a sort of wire level DNS, ARP stores a IP to MAC mapping in the arp cache in the network gear and stations. Any time you connect to a device over the network, within your broadcast domain, (often your subnet) you add that remote device's MAC to your ARP cache (aka table). Once you've communicated you need only to look up the MAC in your local ARP cache to address non routed packets.

Unfortunately ARP is only maintained and available within the broadcast domain. Outside of that it's been routed and this is done with a TCP/IP (and rarely IPX) address encoded in the packet headers. The network gear at the other end sorts out the ARP and routes the packet appropriately once it reaches the destination broadcast domain. The client doesn't need to know or care about the destination MAC unless it's communicating directly with it and there are no routers involved.

This is why you can't get the remote ARP unless you communicate with a program (such as an snmpd) running on the PC(or device) that will give it to you, or with a device on the same subnet where you can get a shell.

An interesting misconception about MACs is that you can use them for security to ID a NIC. Unfortunately a lot of gear can change the MAC on the fly, so that's kind of useless as a security identifier. The fact that it's "hard" set and burned into the NIC is a little misleading.

-Viz
 
Old 11-06-2008, 03:06 AM   #14
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
I would be looking at what is assigning those IP addresses, initially I'd assume DHCP reservations, but even if not there would be something presumably at MAC level involved in the assignment, and that in a log file would give you what you want.
 
Old 11-07-2008, 01:03 PM   #15
Gadzila
LQ Newbie
 
Registered: Nov 2008
Posts: 8

Rep: Reputation: 0
Tnx a lot... it's real way to find IP of closest host...

root@:~# arping 177.22.160.1
ARPING 177.22.160.1 from 177.22.167.220 eth0
Unicast reply from 177.22.160.1 [000:88:04:9E:72] 9.605ms
 
  


Reply

Tags
mac, ping



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Single DHCP server ,to provide the ip address to a MAC address in two different subne alix123 Linux - Software 5 05-08-2007 11:16 PM
can't ping local IP address but can ping remote hosts rob_xx17 Linux - Networking 4 12-02-2006 08:39 AM
changed mac address + got dhcp add ! but can't ping Mr_C Linux - Networking 3 03-19-2006 11:55 PM
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 04:33 AM
windows 98 m/c ping to ip address of red hat server but fails to ping hostname ravilohot Linux - Networking 2 09-07-2004 04:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration