Non-perl solution, but if this is something you need to do often I recommend running arpwatch on a machine that is always connected to the network. You can then simply retrieve the IP address under which a given MAC last showed up from the arpwatch database.

Alternatively (if you really just want to do this once), you can use the arping utility to check every IP address on your network segment until you get a response with the matching MAC address. This puts less load on the network than similar solutions using nmap or ICMP ping because only the initial ARP request is sent and no further packets (this also means it's a lot faster on large networks). arping also has an option to search for a MAC address directly, but that relies on the host in question to respond to an ICMP broadcast ping, which many hosts will not be configured to do.


All dogma is stupid.

In reply to Re: Getting Ip Address by tirwhan
in thread Getting Ip Address by flamel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.