Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to get the MAC address of every machine that connects via SSH to my server. Is this possible? If yes, can you provide me some references? Thank you in advance!

share|improve this question

migrated from Jan 11 '12 at 8:54

This question came from our site for professional and enthusiast programmers.

up vote 6 down vote accepted

The only way you could obtain this is if the device was on your LAN, TCP/IP does not encapsulate the MAC address, once your packets are forwarded via a router, the mac address becomes the router's mac address.

If it is on the same LAN you can use 'arp -a' to look-up the mac address.

share|improve this answer

It's only possible if they're on the same LAN as you, via inspection of the ARP table, e.g:

% arp -a

Packets received from outside your network will have your default gateway's internal MAC address on them, and their addresses won't appear in the ARP table.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.