SkillPilotAI

arp, arping, ndp, ndisc6, rdisc6

These tools work at the boundary between IP and MAC addresses: arp shows and edits the IPv4 ARP cache, arping is a layer 2 ping, and ndp, ndisc6 and rdisc6 do the same jobs for IPv6 Neighbor Discovery. They are the go-to tools when ping is blocked or a duplicate IP is suspected.

56.1 What they do, where they run

ToolJobWhere
arpShow/edit the ARP cache (IP -> MAC)Windows built-in, Linux net-tools, macOS built-in
arpingARP ping, duplicate IP check, gratuitous ARPLinux: iputils-arping
ndpIPv6 neighbor cache, routers, prefixesmacOS built-in
ndisc6 / rdisc6IPv6 neighbor MAC lookup / router discoveryLinux: package ndisc6

56.2 How it works: ARP and Neighbor Discovery

  • arping does not use ICMP: it sends an ARP who-has broadcast, so it works even when a firewall blocks ping.
  • Only the owner of the IP sends a unicast reply with its MAC; other hosts ignore it.
  • IPv6 has no ARP: Neighbor Discovery (on ICMPv6) does the job.
  • Neighbor Solicitation (NS) goes to a special multicast address (not broadcast); the owner answers with a Neighbor Advertisement (NA) carrying its MAC.
  • Router Solicitation (RS) to ff02::2; the router answers with a Router Advertisement (RA) carrying the prefix and DNS server, so the PC builds its own IPv6 address (SLAAC).
arping when the router blocks ICMP
  1. 1.PC 192.168.76.10 pings the router: ICMP dropped, 100% loss

  2. 2.PC sends ARP who-has 192.168.76.1 to ff:ff:ff:ff:ff:ff

  3. 3.The switch delivers it to every device on the LAN

  4. 4.The server sees it is not its IP and ignores it

  5. 5.The router sends a unicast reply: 192.168.76.1 is at 02:00:00:00:76:01

ARP is layer 2, so it only works inside the same LAN

IPv6: NS finds the MAC, RS finds the router
  1. 1.ndisc6 sends NS "who has fe80::1?" to ff02::1:ff00:1 (ICMPv6 type 135)

  2. 2.Router answers NA: target link-layer address 02:00:00:00:76:01

  3. 3.rdisc6 sends RS to ff02::2 (all routers)

  4. 4.Router (radvd) answers RA: prefix 2001:db8:76::/64, DNS 2001:db8:76::53, lifetime 300 s

  5. 5.PC builds 2001:db8:76::ff:fe00:7610 (SLAAC) and a default route via fe80::1 (proto ra)

56.3 Windows arp

PowerShell
arp -a -varp -a -N 127.0.0.1arp -a 192.168.76.99
Output
$ arp -a -vInterface: 127.0.0.1 --- 0x1  Internet Address      Physical Address      Type  224.0.0.22                                  static  224.0.0.251                                 static  239.255.255.250                             static$ arp -a -N 127.0.0.1No ARP Entries Found.$ arp -a 192.168.76.99No ARP Entries Found.
  • -a -v (verbose) also shows the loopback interface; here only static multicast entries.
  • -N filters one interface; no entry = No ARP Entries Found.
  • On a normal LAN you would see your gateway's MAC with type dynamic.
Output
arp -a              all ARP entriesarp -a 192.168.1.1  only that IP's entryarp -g              same as -aarp -a -N if_ip     only that interfacearp -a -v           verbose + loopbackarp -s ip mac       add static entryarp -s ip mac if_ip add on that interfacearp -d ip           delete entryarp -d ip if_ip     delete on that interfacearp -d *            delete all (admin)arp /?              helpMAC: 00-AA-00-4F-2A-9C (hyphens)
  • -s adds a static entry that lasts until the TCP/IP stack restarts; arp -d * needs an Administrator prompt.
  • For an entry that survives a restart: netsh interface ipv4 add neighbors.

56.4 Linux arp (net-tools): display

Terminal
arparp -narp -aarp -v -narp -H arcnet -n
Output
$ arpAddress                  HWtype  HWaddress           Flags Mask            Ifacehome-router              ether   02:00:00:00:76:01   C                     eth0file-server              ether   02:00:00:00:76:20   C                     eth0$ arp -nAddress                  HWtype  HWaddress           Flags Mask            Iface192.168.76.1             ether   02:00:00:00:76:01   C                     eth0192.168.76.20            ether   02:00:00:00:76:20   C                     eth0$ arp -ahome-router (192.168.76.1) at 02:00:00:00:76:01 [ether] on eth0file-server (192.168.76.20) at 02:00:00:00:76:20 [ether] on eth0$ arp -v -n192.168.76.1             ether   02:00:00:00:76:01   C                     eth0192.168.76.20            ether   02:00:00:00:76:20   C                     eth0Entries: 2	Skipped: 0	Found: 2$ arp -H arcnet -n!arp: arcnet: unknown hardware type.exit=255
  • Plain arp shows host names; -n is numeric and faster. Flag C = complete entry.
  • -a gives one-line BSD style output; -v adds the entry count.
  • -H arcnet: unknown hardware type, that old type is not built into this version.
Output
arp               table with namesarp 192.168.1.1   only that host's entryarp -n            numeric, no DNS lookuparp -a            BSD style, one linearp -e            Linux style columnsarp -n -i eth0    only eth0 entriesarp -v -n         verbose + countarp -H ether -n   only Ethernet (default)arp -H arcnet     ARCnet (old)arp -H pronet     PROnet (old)arp -H ax25       AX.25 packet radioarp -t netrom     NET/ROM (-t = -H)Flags: C complete, M permanent, P publishedModern: ip neigh show

56.5 Linux arp: add, delete and proxy ARP

Terminal
arp -s 192.168.76.80 02:00:00:00:76:80arp -s 192.168.76.81 02:00:00:00:76:81 temparp -narp -d 192.168.76.80cat /tmp/ethers.labarp -f /tmp/ethers.labarp -n
Output
$ arp -nAddress                  HWtype  HWaddress           Flags Mask            Iface192.168.76.81            ether   02:00:00:00:76:81   C                     eth0192.168.76.1             ether   02:00:00:00:76:01   C                     eth0192.168.76.20            ether   02:00:00:00:76:20   C                     eth0192.168.76.80            ether   02:00:00:00:76:80   CM                    eth0$ cat /tmp/ethers.lab192.168.76.83 02:00:00:00:76:83192.168.76.84 02:00:00:00:76:84 temp$ arp -f /tmp/ethers.lab; arp -n192.168.76.1             ether   02:00:00:00:76:01   C                     eth0192.168.76.83            ether   02:00:00:00:76:83   CM                    eth0192.168.76.84            ether   02:00:00:00:76:84   C                     eth0192.168.76.20            ether   02:00:00:00:76:20   C                     eth0
  • -s gives a permanent entry: flag CM (M = permanent). temp entries show only C and expire.
  • -d deletes an entry; -f loads many entries from an ethers file.
Terminal
# on rtrarp -i eth0 -Ds 192.168.76.90 eth0 pubarp -n# on pcarping -c 2 -I eth0 192.168.76.90
Output
rtr$ arp -nAddress                  HWtype  HWaddress           Flags Mask            Iface192.168.76.10            ether   02:00:00:00:76:10   C                     eth0192.168.76.90            *       <from_interface>    MP                    eth0pc$ arping -c 2 -I eth0 192.168.76.90ARPING 192.168.76.90 from 192.168.76.10 eth0Unicast reply from 192.168.76.90 [02:00:00:00:76:01]  315.978msUnicast reply from 192.168.76.90 [02:00:00:00:76:01]  0.573msReceived 2 response(s)
  • pub = proxy ARP: the router publishes its own eth0 MAC (-D) for 192.168.76.90, flag MP (P = published).
  • The PC's arping gets the router's MAC and believes the host is on the same LAN.
Output
-s ip mac            permanent entry-s ip mac temp       temporary entry-i eth0 -s ip mac    bind to eth0-s ip mac pub        proxy ARP (publish)-s net mac netmask nm pub  subnet proxy-i eth0 -Ds ip eth1 pub  eth1's MAC-d ip                delete entry-i eth1 -d ip        delete on eth1-d ip pub            delete proxy entry-f                   load /etc/ethers-f file              load from fileNeeds root or CAP_NET_ADMINModern: ip neigh add / del
  • Modern Linux replacements: ip neigh show / add / del.

56.6 Linux arping (iputils)

Terminal
ping -c 2 -W 1 192.168.76.1arping -c 3 -I eth0 192.168.76.1arping -f -I eth0 192.168.76.1arping -w 2 -I eth0 192.168.76.99echo exit=$?
Output
$ ping -c 2 -W 1 192.168.76.12 packets transmitted, 0 received, 100% packet loss, time 1008ms$ arping -c 3 -I eth0 192.168.76.1ARPING 192.168.76.1 from 192.168.76.10 eth0Unicast reply from 192.168.76.1 [02:00:00:00:76:01]  0.576msUnicast reply from 192.168.76.1 [02:00:00:00:76:01]  0.599msUnicast reply from 192.168.76.1 [02:00:00:00:76:01]  0.592msSent 3 probes (1 broadcast(s))Received 3 response(s)$ arping -f -I eth0 192.168.76.1Unicast reply from 192.168.76.1 [02:00:00:00:76:01]  6.760msSent 1 probes (1 broadcast(s))Received 1 response(s)$ arping -w 2 -I eth0 192.168.76.99; echo exit=$?Sent 3 probes (3 broadcast(s))Received 0 response(s)exit=1
  • ICMP is blocked so ping fails, but arping gets 3 replies; only the first probe is a broadcast, the rest unicast.
  • -f exits on the first reply; -w 2 sets a deadline, no reply = exit status 1.
Terminal
arping -D -c 2 -I eth0 192.168.76.20echo exit=$?arping -D -c 2 -I eth0 192.168.76.50echo exit=$?arping -U -c 1 -I eth0 192.168.76.10arping -q -c 1 -I eth0 192.168.76.1echo exit=$?
Output
$ arping -D -c 2 -I eth0 192.168.76.20; echo exit=$?ARPING 192.168.76.20 from 0.0.0.0 eth0Unicast reply from 192.168.76.20 [02:00:00:00:76:20]  0.561msexit=1$ arping -D -c 2 -I eth0 192.168.76.50; echo exit=$?ARPING 192.168.76.50 from 0.0.0.0 eth0Sent 2 probes (2 broadcast(s))Received 0 response(s)exit=0srv$ tcpdump -l -n -e -i eth0 arp18:52:15.535000 02:00:00:00:76:10 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.76.10 (ff:ff:ff:ff:ff:ff) tell 192.168.76.10, length 28$ arping -q -c 1 -I eth0 192.168.76.1; echo exit=$?exit=0
  • -D (duplicate address detection) uses source IP 0.0.0.0: a reply + exit 1 means the IP is already in use; exit 0 means free.
  • -U sends a gratuitous ARP: the server's tcpdump shows the PC asking who-has for its own IP.
  • -q prints nothing, so scripts just check the exit status.
Output
-I eth0     interface to send on-c 4        stop after 4 requests-w 5        5 second deadline-i 2        seconds between requests-f          exit on first reply-b          broadcast only-s ip       source IP-D          duplicate IP check-U          gratuitous ARP request-A          gratuitous ARP reply-q          quiet, exit status only-h  -V      help, versionLab: -i 0.5 = invalid argument

56.7 macOS arp and ndp (from the PDF)

macOS commands could not run here; these option tables come from the PDF.

Output
arp -a  arp -n -a    all / numericarp 192.168.1.1      one hostarp -a -i en0        only en0arp -l -a  arp -x -a reachability info-d ip   -d -a        delete one / all-d ip pub            delete proxy entry-d ip ifscope en0    delete en0's entry-d -i en0 -a         delete all on en0-s ip mac [temp]     permanent / temporary-s ip mac pub        proxy ARP-s ip auto pub [only]  proxy with own MAC-s ip mac reject     drop + unreachable-s ip mac blackhole  drop silently-s ip mac ifscope en0  only on en0-S ip mac   -f file  replace / from file
  • reject drops traffic and tells the sender it is unreachable; blackhole drops silently.
  • ifscope binds an entry to one interface; -S replaces an old entry.
Output
ndp -a              all NDP entriesndp -an             numeric, no namesndp -a -l           link-layer reachabilityndp -a -x           extended infondp -a -t           timestamp per entryndp -A 5 -nt        repeat every 5 secondsndp -c              erase all entriesndp -d fe80::1%en0  delete one entryndp -s ip6 mac      permanent entryndp -s ip6 mac temp temporary entryndp -s ip6 mac proxy  proxy NDPndp -f file         load from fileStates: R reachable S stale D delay P probe
Output
ndp -p   ndp -P       prefixes / flushndp -r   ndp -R       routers / flushndp -H                sync routing tablendp -I [en0|delete]   default interfacendp -i en0            interface ND info-i en0 nud / -- -nud  NUD on / off-i en0 disabled       IPv6 off-i en0 -- -disabled   IPv6 on-i en0 proxy_prefixes proxy ND-i en0 insecure       no CGA-i en0 replicated     sleep proxy configndp -w   ndp -W cfg   CGA parametersndp -z   ndp -Z en0   RTI list / flush
  • ndp -an gives a numeric neighbor list; states: R reachable, S stale, D delay, P probe.
  • ndp -r shows default routers and ndp -p advertised prefixes: the same answer as rdisc6, but from the cache.
  • A setting that starts with - needs -- before it (e.g. -- -nud).

56.8 Linux ndisc6 and rdisc6

Terminal
ndisc6 fe80::1 eth0ndisc6 -q fe80::1 eth0ndisc6 -n -r 2 -w 500 2001:db8:76::99 eth0echo exit=$?ip -6 neigh show
Output
$ ndisc6 fe80::1 eth0Soliciting fe80::1 (fe80::1) on eth0...Target link-layer address: 02:00:00:00:76:01 from fe80::1$ ndisc6 -q fe80::1 eth002:00:00:00:76:01$ ndisc6 -n -r 2 -w 500 2001:db8:76::99 eth0Soliciting 2001:db8:76::99 (2001:db8:76::99) on eth0...Timed out.Timed out.No response.exit=2$ ip -6 neigh showfe80::1 dev eth0 lladdr 02:00:00:00:76:01 router REACHABLEfe80::ff:fe00:7620 dev eth0 lladdr 02:00:00:00:76:20 DELAY
  • ndisc6 needs both the target address and the interface; -q prints only the MAC.
  • A missing address times out on every attempt: exit 2 = no response.
  • ip -6 neigh shows the kernel's IPv6 neighbor cache (the router is marked router REACHABLE).
Terminal
rdisc6 eth0rdisc6 -q eth0ip -6 addr show dev eth0 | grep inet6ip -6 route show
Output
$ rdisc6 eth0Soliciting ff02::2 (ff02::2) on eth0...Router lifetime           :          300 (0x0000012c) seconds Prefix                   : 2001:db8:76::/64  On-link                 :          Yes  Autonomous address conf.:          Yes Recursive DNS server     : 2001:db8:76::53 Source link-layer address: 02:00:00:00:76:01 from fe80::1$ rdisc6 -q eth02001:db8:76::/64$ ip -6 addr show dev eth0 | grep inet6    inet6 2001:db8:76::ff:fe00:7610/64 scope global dynamic mngtmpaddr proto kernel_ra    inet6 fe80::ff:fe00:7610/64 scope link proto kernel_ll$ ip -6 route showdefault via fe80::1 dev eth0 proto ra metric 1024 expires 295sec hoplimit 64 pref medium
  • The router (radvd) returns lifetime 300 s, prefix 2001:db8:76::/64 and a DNS server; -q prints only the prefix.
  • The PC's SLAAC address is built from this prefix + its own MAC; the default route has proto ra.
Output
ndisc6 ip6 eth0      MAC of a neighborrdisc6 eth0          routers + prefixesrdisc6 fe80::1 eth0  query one router-1   exit on first answer (ndisc6 default)-m   all answers (rdisc6 default)-n   no DNS resolve-q   quiet: only MAC / prefix-v   verbose (default)-r 5     attempts (default 3)-w ms    wait: ndisc6 1000, rdisc6 4000-s ip6   source address-h  -V   help, versionExit: 0 found, 1 error, 2 no response

56.9 Comparison: ARP vs NDP

PointARP (IPv4)NDP (IPv6)
ProtocolOwn ethertype 0x0806ICMPv6
Find a MACBroadcast who-has, unicast is-at replyNeighbor Solicitation (multicast) / Neighbor Advertisement
Find a routerNot part of ARP (DHCP)Router Solicitation / Router Advertisement
Disturbs othersEvery host receives the broadcastMulticast: only interested hosts
Toolsarp, arping, ip neighndp, ndisc6, rdisc6, ip -6 neigh

56.10 Common mistakes

  • Myth: arping can ping any server on the internet. ARP never crosses a router; arping works only on your own LAN.
  • For remote servers use ping, traceroute or TCP-based tools.
  • Expecting a Windows arp -s entry to survive a restart: use netsh interface ipv4 add neighbors.
  • Using arping -i 0.5: this iputils version says invalid argument, use whole seconds.

56.11 Interview tips

  • ICMP blocked and ping shows 100% loss? Use arping: every IPv4 host answers ARP for its own IP (same LAN only).
  • IPv6 has no ARP: NDP on ICMPv6, NS/NA for the MAC, RS/RA for the router, prefix and DNS.
  • NDP uses multicast, not broadcast, so other devices are not disturbed.
  • arping -D checks for a duplicate IP before using an address; -U announces a new MAC (gratuitous ARP).
  • ARP cache flags: C complete, M permanent, P published (proxy ARP).