How to get Mac Address of Remote Computer

Hi All,
I tried to find out a solution for finding Mac Address of a remote system, then first i tried with finding it with local address using the following code it works fine for me.
public class MacAddressFinder {
     public static void main(String[] args) {
          try
               InetAddress ipAddr = InetAddress.getLocalHost();
               System.out.println("Current IP address : " + ipAddr.getHostAddress());
               NetworkInterface nwIntf;
               try
                    nwIntf = NetworkInterface.getByInetAddress(ipAddr);
                    byte[] hwAddr = nwIntf.getHardwareAddress();
                    System.out.print("Current MAC address : ");
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < hwAddr.length; i++)
                         sb.append(String.format("%02X%s", hwAddr, (i < hwAddr.length - 1) ? "-" : ""));          
                    System.out.println(sb);
               } catch (SocketException e) {
                    e.printStackTrace();
          catch (UnknownHostException e) {
               e.printStackTrace();
But when i tried this piece of code in jsp with the following code i am getting NeworkInterface object value as null and there by i am unable to get the Mac Address of a remote computer.
InetAddress ipAddr = InetAddress.getByName(request.getRemoteAddr());
NetworkInterface nwIntf = NetworkInterface.getByInetAddress(ipAddr);Can you please suggest me how to find out the Mac address of remote system?
Thanks,
Uday

first of all, NetworkInterface only exposes the NetworkInterfaces of the local computer. secondly, you cannot find the mac address of an arbitrary remote computer. that information is not available outside of the local subnet. and java doesn't expose a way to discover it even for computers on the local subnet.

Similar Messages

  • How to get MAC address from IP address in LAN

    Hi all,
    How to get MAC address from IP address in LAN (windows or any OS), I would have all IP addresses of my LAN, so I would like to know all MAC address.
    Code examples are highly appreciated.
    Thanks & Regards,
    abel...

    abel wrote:
    Yeah that is only working for local system, but how to get remote system's MAC ..?
    Thanks for quick reply ...
    Edited by: abel on Jan 28, 2009 12:10 AMIt is my understanding that only one person ever found the holy grail which you seek. But sadly [_he's dead_|http://forums.sun.com/profile.jspa?userID=649366]
    As a curious aside how did you manage to get the list of IPs?

  • How to get hostname of a remote computer by ip

    how to get hostname of a remote computer by ip

    In InetAddress class we have a method
    public String getHostName() which returns the name of the host. If applet security prevents the name, the same ipaddress entered is returned back.
    This program is the implementation of this method:
    import java.net.*;
    public class ipdemo
    public static void main(String arg[])
    try
    InetAddress add=InetAddress.getByName("207.228.236.39");
    System.out.println(add.getHostName());
    catch(UnknownHostException e)
    System.out.println("Exception raised");
    This will help you.
    Regards.
    Deepa Datar

  • Get ip address of remote computer

    How can i get the ip address of remote computer?I just find the InetAddress.getLocalhost() method to get local ip.
    How should I do ?

    You can use the jCIFS NTLM filter to authenticate the user against a
    domain and get their NT username via request.getRemoteUser(); this is available from:
    http://jcifs.samba.org
    The filter is transparent to your web application, so you shouldn't need to make any additional code changes.
    Eric

  • How to get MAC address list and HDD serial number from Windows and MAC machine?

    Hi,
    I'm developing a AIR application. I'm implementing the product key mechanishm. I need to identify the users' machines uniquely. I chose MAC address would be a better way. But a computer has list of MAC addresses including LAN card and Wi-Fi card addresses. So, I need to get the list of available MAC addresses from the computer and the Hard Disk Drive's serial number. HDD serial number would be helpful to cross verify the identity.
    I'm able to get the MAC address using NetworkInfo class. But I need to get a list of available MAC addresses and HDD serial number.
    Is there any classess to accomplish this task?
    Thanks in advance.

    See if this link can be of a little use to you.
    http://www.adobe.com/devnet/air/flex/articles/retrieving_network_interfaces.html#ionComHea ding

  • How to get MAC address using java code

    hi friends
    please write me, How can I get MAC Address of local machine using java code.I don't want to use JNI.
    Please reply me. Its urgent for me
    Thanks in advance
    US

    You have several ways under *nix
    ifconfig -a | grep HWwill output something like
    eth0      Lien encap:Ethernet  HWaddr 00:11:FF:74:FF:B4combined with Runtime.getRuntime().exec("")and Process.getInputStream()you should be able to read it easilly.
    Under Windows (and Linux of course) try jpcap (http://sourceforge.net/projects/jpcap)
    You can also use jnative as a generic tool (http://sourceforge.net/projects/jnative)
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to get MAC Address from device?

    Does any one knows, how we can get programmatically the MAC address of Blackberry device?
    Is it possible to get it through BES IT Policy?
    - Thanks

    abel wrote:
    Yeah that is only working for local system, but how to get remote system's MAC ..?
    Thanks for quick reply ...
    Edited by: abel on Jan 28, 2009 12:10 AMIt is my understanding that only one person ever found the holy grail which you seek. But sadly [_he's dead_|http://forums.sun.com/profile.jspa?userID=649366]
    As a curious aside how did you manage to get the list of IPs?

  • How to get MAC Address of my stolen HP-15d103tx laptop

     I do have my Serial No-[Moderator edited Serial] and product no- G2G48PA#ACJ. My laptop has been stolen on 2nd April 2015. When i lodge a F.I.R with police they told me to submit the MAC address of the Laptop. Is there any way to know my mac address? Please suggest .

    Alok_456 wrote:
     I do have my Serial No-[Moderator edited Serial] and product no- G2G48PA#ACJ. My laptop has been stolen on 2nd April 2015. When i lodge a F.I.R with police they told me to submit the MAC address of the Laptop. Is there any way to know my mac address? Please suggest .
    If you didn't write it down the first time it will almost next to impossible to find it also this doesn't gurantee in any way you can get your laptop back either. MAC is only good if you wrote it down or registered it but if none of this is written down. And if you don't have tracking software installed the chances of getting it back is harder to get it back. So unless you see it being sold by someone or online this is the only real way you can track it down.
    I am a Volunteer to help others on here-not a HP employee.
    Replies aren't online 24/7 because of Time Zone differences.
    Remember in this Day and Age of Computing the Internet is Knowledge at your fingertips if you choose understand it. -2015-

  • How to get MAC Address of a stolen laptop by using Serial number?

    Hi my Lenovo G560 laptop was stolen on 17/04/13. I have the serial number. In order to trace the laptop, I need the MAC address. Unfortunately I don't know the MAC address of my stolen laptop. My question is, is it possible to get the MAC address by using serial number? 
    Serial Number: xxxxxxxxxx
    Moderator Note; s/n edited for member's own protection

    hi Subrahmanya,
    Sorry to hear about your trouble. Unfortunately, the only way to get the MAC address is to run a query on the unit (physically or or remotely). Using the serial number to query information on the system will list the devices that are included on the unit (this doesn't include the MAC address).
    Regards,
    neokenchi
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • How to get MAC address from client machine ?

    Hi dear,
    We are implementing security measures for a banking system, so it is required that we track the MAC address of the registered clients along with other parameters. How do we get the MAC address from client machine using ADF or running scripts in client side?
    thanks all

    Hi,
    Welcome to OTN.
    Your question has nothing to do with ADF as such. Googling would give you plenty of such topics.
    -Arun

  • How to get MAC address of a phone

    Hi,
    I am able to retrieve phone details by sending Soap request to RisPort. But the response doesn't have MAC address of the phone. Can any one please let me know how to get this information.
    Here is my Soap request
    <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body><SelectCmDevice soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><CmSelectionCriteria href="#id0"/><StateInfo xsi:type="xsd:string"/></SelectCmDevice><multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns1:CmSelectionCriteria" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="tns:CmSelectionCriteria"><maxReturnedDevices xsi:type="xsd:unsignedInt">10</maxReturnedDevices><Class xsi:type="soapenc:string">Phone</Class><Model xsi:type="xsd:unsignedInt">255</Model><nodeName xsi:type="soapenc:string"/><selectBy xsi:type="soapenc:string">Name</selectBy><selectItems xsi:type="soapenc:Array" xsi:nil="true"/><status xsi:type="soapenc:string"/></multiRef></soapenv:Body></soapenv:Envelope>

    When you receive the response, you receive the name of the ip phone. The name is something like: SEPXXXXXXXXXXXX where all the X correspond to the MAC address of the phone.

  • How to get mac address?

    I have used NetworkInterface.getNetworkInterfaces() for get list of interfaces
    but under xp I not read interface informations.
    Is possible that the problem is permission level of user?
    Thanks.

    Some call in Java are OS dependent and work better on some OS than other. If there is a permissions issue it is at the OS level and Java would not be aware of it. (But I doubt this is the case)
    It is possible that information is not available under windows.
    However you can call "ipconfig /all" and parse the MAC address from that.

  • How to get MAC Address for maintaning unique client id at server side?

    Hi All,
    Can somebody tell how can i get MAC id for maintaing Unique client id at server.
    or is there any alternative way to do this?
    Thanks in advance..
    CK

    Usually people just use cookies for that.

  • How to get MAC ADDRESS in mais.asc using FMS

    Hello,
    i need to get the Mac Address of every machine connected to my fms, is that possible with FMS?
    THX

    It's also available in System Information, under the Network section.
    Hold down option and select System Information from the Apple menu.
    Select Network, then the particular service type: Airport, Ethernet, Firewire
    Scroll down till you see MAC Address:
    You can also reveal it in the Terminal with ifconfig. en0 is usually ethernet, en1 is Airport, but that depends on your configuration.

  • How to get mac address in macbook pro

    Go to System Preference -> Network -> Advanced -> Hardware

    It's also available in System Information, under the Network section.
    Hold down option and select System Information from the Apple menu.
    Select Network, then the particular service type: Airport, Ethernet, Firewire
    Scroll down till you see MAC Address:
    You can also reveal it in the Terminal with ifconfig. en0 is usually ethernet, en1 is Airport, but that depends on your configuration.

Maybe you are looking for

  • Sqlnet Connect Problem

    OK, I've installed Oracle & installed a database using the procedures listed in another thread (following the thread as best I could). But, I can't connect to the database remotely. I can connect from my local machine using sqlplus without difficulty

  • CS2 doesn't recognize DNG 5.4 converted files.

    Ran the new DNG converter files on Panasonic LX2 RW2 files.  The conversion went well. When I tried to open up the files in either Bridge or CS2 I get: Could Not Complete Your Request Because Photoshop Does Not Recognize This Type of File. The older

  • Install iTunes 7.1.1

    I tried installing iTunes 7.1.1 (from iTunes 6.something) and everytime it gets stuck in the "registering components" phase. i tried uninstalling and reinstalling, didn't work. if i shut down the installation at this point, i can launch itunes, but i

  • Pop up with certain songs.

    For many songs, I get a pop up that says "The song....could not be used because the original file could not be found. Would you like to locate it?" The song will not play through iTunes, but will still play on the iPod when I am not connected to the

  • Mail shuts down when loading incoming messages

    Hello! well, actually the title says it all. Since yesterday mail shuts itself down when it tries to load incoming messages. The strange thing is: when I deactivate WLAN (and LAN) mail operates just fine. I can answer mails and when I switch on the i