Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 stackoverflow.com Jan 11 '12 at 8:54

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

2 Answers 2

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

 
discard

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