ThomasHabets / arping

ARP Ping
http://www.habets.pp.se/synscan/programs.php
GNU General Public License v2.0
398 stars 62 forks source link

Getting Timeout on mac and FreeBsd #30

Closed arymangupta closed 6 years ago

arymangupta commented 6 years ago

arping is displaying Timeout on mac and FreeBSD. Not tried on other platform.

Example:- $ ./a.out -i en0 -c 3 localhost or $ arping -i en0 -c 3 localhost ARPING 127.0.0.1 Timeout Timeout Timeout Timeout Timeout Timeout

Got this comment from http://freshmeat.sourceforge.net/projects/arping arping 2.13 Release Notes: This release prints "Timeout" when pings time out, fixes a bug with -w for fractions of seconds, works around a bug in libpcap on Solaris, and implements gratuitous ARP (-U).

ThomasHabets commented 6 years ago

From the README:

Q: After compiling arping without any problem, i test it first with
   localhost... but it doesn't respond. Isn't that strange?

A: Not really, as you can see by typing 'ifconfig' the lo (local) interface
   does not have a MAC address. It's not a physical device! MAC addresses are
   there to differentiate computers on a shared medium (the aether, or ether)
   and since packets to localhost does not go over any wire there is no need
   to identify which box is talking to which. There is only one.
arymangupta commented 6 years ago

Still Getting timeout.I am using mac OS for this.

$ ifconfig lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 nd6 options=201<PERFORMNUD,DAD> gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 stf0: flags=0<> mtu 1280 en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 ether :::: inet6 fe80::888:3687::%en0 prefixlen 64 secured scopeid 0x4 inet 10.222.41.27 netmask 0xfffff000 broadcast 10.222.47.255 nd6 options=201<PERFORMNUD,DAD> media: autoselect status: active

First I did this $ sudo ./a.out -v -c 3 google.com arping: lookup dev: No matching interface found using getifaddrs(). arping: Unable to automatically find interface to use. Is it on the local LAN? arping: Use -i to manually specify interface. Guessing interface en0. This box: Interface: en0 IP: 10.222.41.27 MAC address: :::: ARPING 172.217.160.46 Timeout Timeout Timeout

After knowing the active interface I finally I did this $ sudo ./a.out -i en0 -c 3 -v google.com This box: Interface: en0 IP: 10.222.41.27 MAC address: :::: ARPING 172.217.160.46 Timeout Timeout Timeout

--- 172.217.160.46 statistics --- 3 packets transmitted, 0 packets received, 100% unanswered (0 extra)

ThomasHabets commented 6 years ago

Please read the whole README. Now you're just asking another question that's already answered in it:

Q: I tried to ping my own MAC address, but it doesn't work.

A: A sane OS will think it's suspicious if you send packets to yourself over
   the wire and will ignore them.

   And why would you want to lookup the IP or MAC of yourself? ifconfig
   can tell you that.

And you can't arping google because google is not on the same LAN segment as you.