views:

237

answers:

3

Hi all,

Does anybody know if there is a way to get the sender's MAC address from an HTTPServletRequest in Jetty? (Note: by sender, I mean immediate sender aka the last hop before my server). If there isn't a direct way, does anybody know a way to translate an IP address to a MAC address in Java?

Other note: I completely realize that MAC addresses do not leave the local subnet, and that's the intended functionality.

I know this seems like an odd question, but trust me, I know what I'm doing :-) If you're curious, I'd be happy to explain why I want this.

Thanks,

Chris

+1  A: 

Since the MAC address is not sent in the HTTP request, then no, you cannot get this from the HttpServletRequest (in Jetty or any app server).

You'd have to lookup the address yourself with ARP.

matt b
A: 

No, you only have the remote IP, the network layers below are out of the picture. You'd have to resort to some ARP lookup, as matt's answered, but that is not very straightforward, specially in Java. See this related question.

leonbloy
A: 

You should also consider what you want it for. It can be altered by the user, so it isn't a reliable way of identifying clients in the first place.

EJP