Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the MAC address of a 'shutdown' system on local lan (is it possible?)

How to find out the mac address of a system which is:

  1. Shutdown
  2. Power plugged in
  3. Connected to Lan
  4. Nic card ON.

Update I am asking how to find out the mac address of some other system which is already shutdown.... and which is on lan..

I want to find out its mac from my system.... and to be clear... I want to tell that.. arp table can be populated by using ping .. i.e. if 172.16.3.12 is not in arp table then it can be added by just ping 172.16.3.12 but a system can be pinged only if its on ... a shutdown system can't be pinged...

like image 509
user304017 Avatar asked Mar 29 '10 07:03

user304017


3 Answers

Once the system is shutdown your best bet to finding the MAC address is looking for stickers somewhere on the case!


Seriously, I guess you are looking for some way to "wake on lan" a computer on a local lan?
I'm not certain that the machine would respond (be supposed to respond) to anything unless you know the mac already and can the correct magic packet.

From the wikipedia article I linked:

How it works

Wake-on-LAN is platform-independent, so any application on any platform that sends magic packets can wake up computers running on any platform. It is not restricted to LAN (Local area network) traffic.

The computer to be woken is shut down (sleeping, hibernating, or soft off; i.e., ACPI state G1 or G2), with power reserved for the network card, but not disconnected from its power source. The network card listens for a specific packet containing its MAC address, called the magic packet, broadcast on the broadcast address for that particular subnet (or an entire LAN, though this requires special hardware or configuration).

like image 155
lexu Avatar answered Sep 19 '22 22:09

lexu


arp -a ip-address if you know the IP address that the PC typically receives from DHCP, or if it has a static IP.

The PC on which you run the arp command may yet have this information in cache. I just did this from home by logging into a remote desktop session on one of my servers. The server I logged into still had my PCs infomation in the ARP cache even though my PC was not responding to ping.

Initially I logged into my DHCP server to see if my PC still had a lease because that will list your MAC address, and it will show your PC's name. Unfortunately for me, my PC has a very short lease and so it was not in the list.

Fortunately, I happen to know the IP address that my PC typically obtains from DHCP, so I was able to use the above arp command.

Using this information I was able to send a magic packet to my PC and wake it up. This I did using a free utility I found after a brief Google search.

like image 43
Matthew Avatar answered Sep 16 '22 22:09

Matthew


Yes, I once tried to implement a data-center-wide power management system based on Wake On Lan technology. I had a number of solutions, but never got to implement them because the data center people decided that the reliability costs involved in shutting down and powering back up were higher than the energy savings.

A couple of random observations:

My experience was that the routers forgot the mac addresses after the machines had been shut down for more than 20 minutes. After that, the mac addresses were lost until the machines next powered up. Obviously, this will vary depending on the actual router used, but 20 minutes is probably pretty typical.

This means that in practice, the only way to get the mac address is to obtain it BEFORE you shut the system down. I'm not sure what your application is, but I think you can probably find a way to do this one way or another.

Once the router has forgotten the mac address, there's no way to deliver the WOL packet to the machine to be woken from outside the network. From inside the network, you can still do it with a broadcast packet. Either way, you still need to know the mac address, since it's part of the WOL packet.

Now theoretically, you could modify the firmware in the NIC chip to allow it to respond to ARP packets even when the machine itself is powered off. This may even be common practice -- I don't know. If so, what you want to do is do-able, but would be highly dependent on the exact network interface you have.

like image 29
Edward Falk Avatar answered Sep 17 '22 22:09

Edward Falk