clinuxmacosip-addressremote-host

How to get remote host MAC address by using its ip address in c programming in linux


Can some one tell me, how to get remote host MAC address by using its ip address in linux by using c programming(could be netlink sockets or BSD sockets)?


Solution

  • This can't be done using C programming. If it was possible then there wouldn't be any protocol like ARP to get the link layer address.

    You can implement ARP request and reply using socket programming. But that's not what you want in this case I think. Anyway in that case you can refer to this discussion link.

    You can have a look at this for that purpose source code.