Get IP Address of Machine from Hostname or Mac-address












4















Is that possible to get the IP address of my machine from the hostname or the machine's own mac address?



If yes, how?
If not, could you suggest an alternative way?










share|improve this question




















  • 2





    Of your system or a remote system?

    – muru
    Feb 13 '15 at 23:06






  • 4





    I'm not sure exactly what you're trying to accomplish, but the hostname --all-ip-addresses command relates the hostname to IPs, nslookup and dig can be used for general DNS resolving and the arp -na command can list all IPs and MAC addresses in the local network that you have connected to at some point.

    – muru
    Feb 13 '15 at 23:15








  • 1





    ping -c1 hostname

    – Panther
    Feb 13 '15 at 23:24






  • 1





    @muru is correct. If the machine is one hop away, arp will help you find the IP from the MAC address. nmap or zenmap can also be helpful to identify machines on your network

    – noleti
    Feb 13 '15 at 23:32






  • 1





    In addition to @noleti's suggestion: superuser.com/q/261818/334516

    – muru
    Feb 13 '15 at 23:33
















4















Is that possible to get the IP address of my machine from the hostname or the machine's own mac address?



If yes, how?
If not, could you suggest an alternative way?










share|improve this question




















  • 2





    Of your system or a remote system?

    – muru
    Feb 13 '15 at 23:06






  • 4





    I'm not sure exactly what you're trying to accomplish, but the hostname --all-ip-addresses command relates the hostname to IPs, nslookup and dig can be used for general DNS resolving and the arp -na command can list all IPs and MAC addresses in the local network that you have connected to at some point.

    – muru
    Feb 13 '15 at 23:15








  • 1





    ping -c1 hostname

    – Panther
    Feb 13 '15 at 23:24






  • 1





    @muru is correct. If the machine is one hop away, arp will help you find the IP from the MAC address. nmap or zenmap can also be helpful to identify machines on your network

    – noleti
    Feb 13 '15 at 23:32






  • 1





    In addition to @noleti's suggestion: superuser.com/q/261818/334516

    – muru
    Feb 13 '15 at 23:33














4












4








4








Is that possible to get the IP address of my machine from the hostname or the machine's own mac address?



If yes, how?
If not, could you suggest an alternative way?










share|improve this question
















Is that possible to get the IP address of my machine from the hostname or the machine's own mac address?



If yes, how?
If not, could you suggest an alternative way?







networking command-line ip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 15 '15 at 16:59









Seth

34.2k26110162




34.2k26110162










asked Feb 13 '15 at 23:05









FahadkalisFahadkalis

12114




12114








  • 2





    Of your system or a remote system?

    – muru
    Feb 13 '15 at 23:06






  • 4





    I'm not sure exactly what you're trying to accomplish, but the hostname --all-ip-addresses command relates the hostname to IPs, nslookup and dig can be used for general DNS resolving and the arp -na command can list all IPs and MAC addresses in the local network that you have connected to at some point.

    – muru
    Feb 13 '15 at 23:15








  • 1





    ping -c1 hostname

    – Panther
    Feb 13 '15 at 23:24






  • 1





    @muru is correct. If the machine is one hop away, arp will help you find the IP from the MAC address. nmap or zenmap can also be helpful to identify machines on your network

    – noleti
    Feb 13 '15 at 23:32






  • 1





    In addition to @noleti's suggestion: superuser.com/q/261818/334516

    – muru
    Feb 13 '15 at 23:33














  • 2





    Of your system or a remote system?

    – muru
    Feb 13 '15 at 23:06






  • 4





    I'm not sure exactly what you're trying to accomplish, but the hostname --all-ip-addresses command relates the hostname to IPs, nslookup and dig can be used for general DNS resolving and the arp -na command can list all IPs and MAC addresses in the local network that you have connected to at some point.

    – muru
    Feb 13 '15 at 23:15








  • 1





    ping -c1 hostname

    – Panther
    Feb 13 '15 at 23:24






  • 1





    @muru is correct. If the machine is one hop away, arp will help you find the IP from the MAC address. nmap or zenmap can also be helpful to identify machines on your network

    – noleti
    Feb 13 '15 at 23:32






  • 1





    In addition to @noleti's suggestion: superuser.com/q/261818/334516

    – muru
    Feb 13 '15 at 23:33








2




2





Of your system or a remote system?

– muru
Feb 13 '15 at 23:06





Of your system or a remote system?

– muru
Feb 13 '15 at 23:06




4




4





I'm not sure exactly what you're trying to accomplish, but the hostname --all-ip-addresses command relates the hostname to IPs, nslookup and dig can be used for general DNS resolving and the arp -na command can list all IPs and MAC addresses in the local network that you have connected to at some point.

– muru
Feb 13 '15 at 23:15







I'm not sure exactly what you're trying to accomplish, but the hostname --all-ip-addresses command relates the hostname to IPs, nslookup and dig can be used for general DNS resolving and the arp -na command can list all IPs and MAC addresses in the local network that you have connected to at some point.

– muru
Feb 13 '15 at 23:15






1




1





ping -c1 hostname

– Panther
Feb 13 '15 at 23:24





ping -c1 hostname

– Panther
Feb 13 '15 at 23:24




1




1





@muru is correct. If the machine is one hop away, arp will help you find the IP from the MAC address. nmap or zenmap can also be helpful to identify machines on your network

– noleti
Feb 13 '15 at 23:32





@muru is correct. If the machine is one hop away, arp will help you find the IP from the MAC address. nmap or zenmap can also be helpful to identify machines on your network

– noleti
Feb 13 '15 at 23:32




1




1





In addition to @noleti's suggestion: superuser.com/q/261818/334516

– muru
Feb 13 '15 at 23:33





In addition to @noleti's suggestion: superuser.com/q/261818/334516

– muru
Feb 13 '15 at 23:33










2 Answers
2






active

oldest

votes


















4














Of all the suggestions in the comments this one seems easiest.



sudo apt-get install arp-scan



sudo arp-scan --interface=wlan0 --localnet where wlan0 is your interface if your on a wire you'll likely change wlan0 to eth0. You can find out your interface with ifconfig you'll get output similar to this that provides The IP and MAC Address of each machine on your local subnet.



$ sudo arp-scan --interface=eth0 --localnet
Interface: eth0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.15.2 XX:XX:XX:XX:XX:XX NETGEAR
192.168.15.24 XX:XX:XX:XX:XX:XX BROTHER INDUSTRIES, LTD.
192.168.15.103 XX:XX:XX:XX:XX:XX GIGA-BYTE TECHNOLOGY CO.,LTD.


Sources:



1) http://www.binarytides.com/scan-the-local-network-with-arp-scan-on-ubuntu/



2) https://superuser.com/questions/261818/how-can-i-list-all-ips-in-the-connected-network-through-terminal-preferably



3)Experience






share|improve this answer





















  • 2





    Today I learned the android app I use called fing is basically arp-scan

    – geoffmcc
    Feb 14 '15 at 15:47



















0














Technically it is possibly but Logically not. We can get IP by pinging hostname only if it is bind to that certain IP. In local host its hosts file do that work on business network it's DNS which do that work & on internet as well it's DNS but A records/cname which do that work. We can also get IPs assigned ot hostname set for particular MAC id, but that programatically possible not sure if you can do that with simple commands



To know what is your public IP address : www.ipconfig.in



Edit:



getent hosts <hostname> | awk


This works locally aswell.






share|improve this answer










New contributor




Bella is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f585286%2fget-ip-address-of-machine-from-hostname-or-mac-address%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    Of all the suggestions in the comments this one seems easiest.



    sudo apt-get install arp-scan



    sudo arp-scan --interface=wlan0 --localnet where wlan0 is your interface if your on a wire you'll likely change wlan0 to eth0. You can find out your interface with ifconfig you'll get output similar to this that provides The IP and MAC Address of each machine on your local subnet.



    $ sudo arp-scan --interface=eth0 --localnet
    Interface: eth0, datalink type: EN10MB (Ethernet)
    Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
    192.168.15.2 XX:XX:XX:XX:XX:XX NETGEAR
    192.168.15.24 XX:XX:XX:XX:XX:XX BROTHER INDUSTRIES, LTD.
    192.168.15.103 XX:XX:XX:XX:XX:XX GIGA-BYTE TECHNOLOGY CO.,LTD.


    Sources:



    1) http://www.binarytides.com/scan-the-local-network-with-arp-scan-on-ubuntu/



    2) https://superuser.com/questions/261818/how-can-i-list-all-ips-in-the-connected-network-through-terminal-preferably



    3)Experience






    share|improve this answer





















    • 2





      Today I learned the android app I use called fing is basically arp-scan

      – geoffmcc
      Feb 14 '15 at 15:47
















    4














    Of all the suggestions in the comments this one seems easiest.



    sudo apt-get install arp-scan



    sudo arp-scan --interface=wlan0 --localnet where wlan0 is your interface if your on a wire you'll likely change wlan0 to eth0. You can find out your interface with ifconfig you'll get output similar to this that provides The IP and MAC Address of each machine on your local subnet.



    $ sudo arp-scan --interface=eth0 --localnet
    Interface: eth0, datalink type: EN10MB (Ethernet)
    Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
    192.168.15.2 XX:XX:XX:XX:XX:XX NETGEAR
    192.168.15.24 XX:XX:XX:XX:XX:XX BROTHER INDUSTRIES, LTD.
    192.168.15.103 XX:XX:XX:XX:XX:XX GIGA-BYTE TECHNOLOGY CO.,LTD.


    Sources:



    1) http://www.binarytides.com/scan-the-local-network-with-arp-scan-on-ubuntu/



    2) https://superuser.com/questions/261818/how-can-i-list-all-ips-in-the-connected-network-through-terminal-preferably



    3)Experience






    share|improve this answer





















    • 2





      Today I learned the android app I use called fing is basically arp-scan

      – geoffmcc
      Feb 14 '15 at 15:47














    4












    4








    4







    Of all the suggestions in the comments this one seems easiest.



    sudo apt-get install arp-scan



    sudo arp-scan --interface=wlan0 --localnet where wlan0 is your interface if your on a wire you'll likely change wlan0 to eth0. You can find out your interface with ifconfig you'll get output similar to this that provides The IP and MAC Address of each machine on your local subnet.



    $ sudo arp-scan --interface=eth0 --localnet
    Interface: eth0, datalink type: EN10MB (Ethernet)
    Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
    192.168.15.2 XX:XX:XX:XX:XX:XX NETGEAR
    192.168.15.24 XX:XX:XX:XX:XX:XX BROTHER INDUSTRIES, LTD.
    192.168.15.103 XX:XX:XX:XX:XX:XX GIGA-BYTE TECHNOLOGY CO.,LTD.


    Sources:



    1) http://www.binarytides.com/scan-the-local-network-with-arp-scan-on-ubuntu/



    2) https://superuser.com/questions/261818/how-can-i-list-all-ips-in-the-connected-network-through-terminal-preferably



    3)Experience






    share|improve this answer















    Of all the suggestions in the comments this one seems easiest.



    sudo apt-get install arp-scan



    sudo arp-scan --interface=wlan0 --localnet where wlan0 is your interface if your on a wire you'll likely change wlan0 to eth0. You can find out your interface with ifconfig you'll get output similar to this that provides The IP and MAC Address of each machine on your local subnet.



    $ sudo arp-scan --interface=eth0 --localnet
    Interface: eth0, datalink type: EN10MB (Ethernet)
    Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
    192.168.15.2 XX:XX:XX:XX:XX:XX NETGEAR
    192.168.15.24 XX:XX:XX:XX:XX:XX BROTHER INDUSTRIES, LTD.
    192.168.15.103 XX:XX:XX:XX:XX:XX GIGA-BYTE TECHNOLOGY CO.,LTD.


    Sources:



    1) http://www.binarytides.com/scan-the-local-network-with-arp-scan-on-ubuntu/



    2) https://superuser.com/questions/261818/how-can-i-list-all-ips-in-the-connected-network-through-terminal-preferably



    3)Experience







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 20 '17 at 10:18









    Community

    1




    1










    answered Feb 14 '15 at 15:24









    Elder GeekElder Geek

    26.5k952126




    26.5k952126








    • 2





      Today I learned the android app I use called fing is basically arp-scan

      – geoffmcc
      Feb 14 '15 at 15:47














    • 2





      Today I learned the android app I use called fing is basically arp-scan

      – geoffmcc
      Feb 14 '15 at 15:47








    2




    2





    Today I learned the android app I use called fing is basically arp-scan

    – geoffmcc
    Feb 14 '15 at 15:47





    Today I learned the android app I use called fing is basically arp-scan

    – geoffmcc
    Feb 14 '15 at 15:47













    0














    Technically it is possibly but Logically not. We can get IP by pinging hostname only if it is bind to that certain IP. In local host its hosts file do that work on business network it's DNS which do that work & on internet as well it's DNS but A records/cname which do that work. We can also get IPs assigned ot hostname set for particular MAC id, but that programatically possible not sure if you can do that with simple commands



    To know what is your public IP address : www.ipconfig.in



    Edit:



    getent hosts <hostname> | awk


    This works locally aswell.






    share|improve this answer










    New contributor




    Bella is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

























      0














      Technically it is possibly but Logically not. We can get IP by pinging hostname only if it is bind to that certain IP. In local host its hosts file do that work on business network it's DNS which do that work & on internet as well it's DNS but A records/cname which do that work. We can also get IPs assigned ot hostname set for particular MAC id, but that programatically possible not sure if you can do that with simple commands



      To know what is your public IP address : www.ipconfig.in



      Edit:



      getent hosts <hostname> | awk


      This works locally aswell.






      share|improve this answer










      New contributor




      Bella is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.























        0












        0








        0







        Technically it is possibly but Logically not. We can get IP by pinging hostname only if it is bind to that certain IP. In local host its hosts file do that work on business network it's DNS which do that work & on internet as well it's DNS but A records/cname which do that work. We can also get IPs assigned ot hostname set for particular MAC id, but that programatically possible not sure if you can do that with simple commands



        To know what is your public IP address : www.ipconfig.in



        Edit:



        getent hosts <hostname> | awk


        This works locally aswell.






        share|improve this answer










        New contributor




        Bella is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        Technically it is possibly but Logically not. We can get IP by pinging hostname only if it is bind to that certain IP. In local host its hosts file do that work on business network it's DNS which do that work & on internet as well it's DNS but A records/cname which do that work. We can also get IPs assigned ot hostname set for particular MAC id, but that programatically possible not sure if you can do that with simple commands



        To know what is your public IP address : www.ipconfig.in



        Edit:



        getent hosts <hostname> | awk


        This works locally aswell.







        share|improve this answer










        New contributor




        Bella is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer








        edited 7 hours ago









        An0n

        89420




        89420






        New contributor




        Bella is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered Jan 11 at 14:36









        BellaBella

        11




        11




        New contributor




        Bella is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Bella is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Bella is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f585286%2fget-ip-address-of-machine-from-hostname-or-mac-address%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            GameSpot

            日野市

            Tu-95轟炸機