Re: Translate MAC address to IP address

From: Nick Barnes (Nick.Barnes_at_pobox.com)
Date: 08/15/03

  • Next message: Nick Barnes: "Re: Translate MAC address to IP address"
    To: Lars Eggert <larse@ISI.EDU>
    Date: Fri, 15 Aug 2003 12:13:57 +0100
    
    

    At 2003-08-13 15:43:51+0000, Lars Eggert writes:
    > This is a cryptographically signed message in MIME format.
    >
    > --------------ms070709090404010406080107
    > Content-Type: text/plain; charset=us-ascii; format=flowed
    > Content-Transfer-Encoding: 7bit
    >
    > Nick Barnes wrote:
    >
    > > [-net seems to be the right forum for this.]
    > >
    > > I have some MAC addresses from a local Ethernet segment. I want to
    > > convert them into IP addresses. How can I do that programmatically?
    >
    > net/arping from port:

    Thanks for the reference. I had a look at arping. It works by sending
    a broadcast ping to the specified MAC address (not to the broadcast
    MAC). I note that FreeBSD machines do respond to such pings (unlike
    regular broadcast pings), but some machines do not (e.g. WinXPPro,
    NT4).

    Since asking the question, I have been rummaging around in user-space
    network code (e.g. in the sources for arp, ping, and ifconfig) and
    have written a couple of little utilities:

    - "ifget" lists IP addresses accessible on local subnets via active
       network interfaces (in fact I have two implementations of this, one
       written before I discovered getifaddrs() and one written after).
       This is all possible IP addresses (in the range defined by the
       netmask, for broadcast interfaces). It skips interfaces which are
       loopback, down, not running, not AF_INET, or not IFM_ACTIVE.

    - "pingall" sends a single ping packet to all such IP addresses and
      then exits. This causes an ARP exchange for any such address not
      currently in the local ARP table, so populates that table (including
      a lot of "incomplete" entries, for unassigned IP addresses).

    Next week I may spend the time to extend my "ethercount" program,
    using the "pingall" code and the guts of "arp -a", to report using IP
    addresses instead of MACs.

    I can provide sources on request any time; once these things are a bit
    more polished I will put them on the web.

    Nick B
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"


  • Next message: Nick Barnes: "Re: Translate MAC address to IP address"

    Relevant Pages

    • Re: Problem with Bridging ... and bge devices under FreeBSD 7.x?
      ... while arp -a also shows the 52:54 MAC, although MACs for the ifconfig -a are, ... Can you ping from A to C? ...
      (freebsd-net)
    • Re: Problem with Bridging ... and bge devices under FreeBSD 7.x?
      ... while arp -a also shows the 52:54 MAC, although MACs for the ifconfig -a are, ... Can you ping from A to C? ...
      (freebsd-stable)
    • Re: Getting an IP address from a MAC address
      ... Have you considered using arp and simply checking your arp tables? ... If you are on the same net, you can do a single ping to the broadcast to get ... Where <mac> is the MAC addr you are looking for. ... > Evaluating SSL VPNs' Consider NEOTERIS, chosen as leader by top analysts! ...
      (Security-Basics)
    • Re: How to get all arp entries for a certain network
      ... Ping the broadcast, but don't do this very much, as it can ... Some hosts will not respond to a broadcast ping, ... Some hosts have firewalls configured to block/ignore pings. ... looking for ARP request/reply packets. ...
      (comp.os.linux.networking)
    • Re: mac addresss
      ... You could ssh or telnet to them and ifconfig. ... Ifconfig will give the MAC ... Or ping them, then look at the arp map. ...
      (Debian-User)