Acquiring MAC Address of Remote System

Hey drop us a line about the show. Feel free to ask questions, provide feedback and criticism, or just ramble on about anything your little heart desires.

Moderators: snarkout, Patrick, dann

Post Reply
User avatar
dann
Site Admin
Posts: 1132
Joined: Mon Apr 26, 2004 10:55 pm
Location: Hampton, Va, USA
Contact:

Acquiring MAC Address of Remote System

Post by dann » Thu May 25, 2006 11:04 am

Generally speaking MAC addresses will not cross routers. But there must be a way to get the MAC address of a remote system. I've seen it done with a program called Network View. So why can I not do this on Linux?

We need to inventory some information on all our computers: Ip Address, Mac Address, building, room, id number, hostname etc. I figured on putting up a form but have it pull the system's ip address and mac address automatically so it can be easily dropped into a database. It works fine locally, but if we go to another building, I cannot get the MAC address as we are now on a seperate network.

User avatar
Gomer_X
Posts: 901
Joined: Fri Jun 03, 2005 1:31 pm
Location: Cincinnati, Ohio, USA
Contact:

Re: Acquiring MAC Address of Remote System

Post by Gomer_X » Fri May 26, 2006 10:34 am

dann wrote:Generally speaking MAC addresses will not cross routers. But there must be a way to get the MAC address of a remote system. I've seen it done with a program called Network View. So why can I not do this on Linux?
I don't have my TCP/IP book handy, but I'm pretty sure the MAC is not in the IP packet. The mapping happens at the LAN level. The router knows which IP belongs to which MAC. You may have to get the router to give you that info.

HOw to do that is an exercise left to the student. :D

Can you run something on a machine on the remote network?

User avatar
dann
Site Admin
Posts: 1132
Joined: Mon Apr 26, 2004 10:55 pm
Location: Hampton, Va, USA
Contact:

Post by dann » Fri May 26, 2006 12:59 pm

Running something on the target machine begins to extend beyond the simplicity I wanted to achieve here. The person will be sitting down in front of the remote system and going to a web page. They could just run ipconfig /all and paste the MAC address into a form field, but I was hoping this would be able to be culled automatically.

I'm wondering how netview does it. There has been no special configuration on our end for this app to work. We pointed it to a remote netware server and it pulled up the proper MAC address.

User avatar
snarkout
Site Admin
Posts: 1342
Joined: Tue Aug 16, 2005 9:35 pm

Post by snarkout » Fri May 26, 2006 1:35 pm

look at the arp cache on your router local to that machine?
Shared pain is lessened, shared joy is increased; thus do we refute entropy.
--Spider Robinson

User avatar
dann
Site Admin
Posts: 1132
Joined: Mon Apr 26, 2004 10:55 pm
Location: Hampton, Va, USA
Contact:

Post by dann » Sat May 27, 2006 12:00 pm

But now I have to connect to the router to do that which defeats the purpose.

StoneChucker
Posts: 16
Joined: Tue Aug 23, 2005 9:57 pm
Location: Brantford, Ontario
Contact:

Post by StoneChucker » Sat May 27, 2006 10:49 pm

How about having the end user execute a batch file, containing:

Code: Select all

ipconfig /all X:\%COMPUTERNAME%.txt
where X: is a shared network location (could be mapped within the batch file if not already present), and %COMPUTERNAME% is a standard system variable of the "computername".

I think that will get you what you want, on a Windows PC anyways (as you mentioned ipconfig).

Hope this helps,

StoneChucker

vagrant
Posts: 8
Joined: Tue May 30, 2006 6:00 pm

Post by vagrant » Tue May 30, 2006 6:29 pm

Ok, well I work a *lot* on writing code in this space and here's the problem. Network View uses WMI to gather this information. So on Windows machines there is a WMI namespace called Win32_NetworkAdapterConfiguration.

The problem is that there is no implementation on *nix which allows querying of WMI, well natively on Linux anyway.

But Dann, what exactly is the problem? Is it just that you can't do this from Linux or what? My development is mainly focused solving problems like this. If I could gather WMI information from Linux my entire development system would be totally different!

Unfortunately, writing a program to solve this problem for Windows is a no-brainer but on Linux its very different (until someone decides to implement the DCOM interfaces to make it possible).

Post Reply