2

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!

2 Answers2

6

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.

Geoffrey
  • 63
  • 2
  • 14
5

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.

Alnitak
  • 21,191
  • 3
  • 52
  • 82