How to use the command 'arping' (with examples)

How to use the command 'arping' (with examples)

The ‘arping’ command is used to discover and probe hosts in a network using the ARP (Address Resolution Protocol) protocol. It is particularly useful for MAC address discovery. The command allows you to send ARP request packets to a specific host or broadcast them to update neighbors’ ARP caches.

Use case 1: Ping a host by ARP request packets

Code:

arping host_ip

Motivation:

This use case is helpful when you want to send an ARP request to a specific host and check if it is reachable in the network.

Explanation:

  • host_ip is the IP address of the host you want to ping using ARP request packets.

Example output:

ARPING 192.168.1.1 from <your_system_MAC> <interface>
Unicast reply from 192.168.1.1
Unicast reply from 192.168.1.1
Unicast reply from 192.168.1.1
...

Use case 2: Ping a host on a specific interface

Code:

arping -I interface host_ip

Motivation:

This use case is useful when you want to send ARP request packets to a specific host on a particular network interface.

Explanation:

  • -I interface specifies the network interface through which you want to send the ARP request packets.
  • host_ip is the IP address of the host you want to ping using ARP request packets.

Example output:

ARPING 192.168.1.1 from <your_system_MAC> eth0
Unicast reply from 192.168.1.1
Unicast reply from 192.168.1.1
Unicast reply from 192.168.1.1
...

Use case 3: Ping a host and stop at the first reply

Code:

arping -f host_ip

Motivation:

This use case is helpful when you only need to check if a host is reachable in the network and do not require continuous pinging.

Explanation:

  • -f option stops the arping command after receiving the first reply.
  • host_ip is the IP address of the host you want to ping using ARP request packets.

Example output:

ARPING 192.168.1.1 from <your_system_MAC> <interface>
Unicast reply from 192.168.1.1

Use case 4: Ping a host a specific number of times

Code:

arping -c count host_ip

Motivation:

This use case is beneficial when you want to send a specific number of ARP request packets to a host and monitor the replies.

Explanation:

  • -c count sets the number of ARP request packets to be sent.
  • host_ip is the IP address of the host you want to ping using ARP request packets.

Example output:

ARPING 192.168.1.1 from <your_system_MAC> <interface>
Unicast reply from 192.168.1.1
Unicast reply from 192.168.1.1
Unicast reply from 192.168.1.1
...

Use case 5: Broadcast ARP request packets to update neighbors’ ARP caches

Code:

arping -U ip_to_broadcast

Motivation:

This use case is useful when you want to broadcast ARP request packets in the network to update your neighbors’ ARP caches.

Explanation:

  • -U option broadcasts the ARP request packets.
  • ip_to_broadcast is the IP address you want to broadcast.

Example output:

ARPING 192.168.1.255 from <your_system_MAC> <interface>
Unicast reply from 192.168.1.2
Unicast reply from 192.168.1.3
Unicast reply from 192.168.1.4
...

Use case 6: Detect duplicated IP addresses in the network

Code:

arping -D -w 3 ip_to_check

Motivation:

This use case is helpful when you suspect that there are duplicated IP addresses in the network and want to detect them by sending ARP requests with a timeout.

Explanation:

  • -D option enables duplicate address detection mode.
  • -w 3 sets a 3-second timeout for each ARP request.
  • ip_to_check is the IP address you want to check for duplicates.

Example output:

ARPING 192.168.1.1 from <your_system_MAC> <interface>
Unicast reply from 192.168.1.1
Reply from 192.168.1.1 timed out
...

Conclusion:

The ‘arping’ command is a powerful utility for network administrators to discover and probe hosts in a network using the ARP protocol. It provides several useful features like pinging a host, broadcasting ARP requests, detecting duplicated IP addresses, and more. By understanding the various use cases and their corresponding command examples, you can effectively utilize the ‘arping’ command to troubleshoot and manage your network.

Related Posts

How to use the command `isisdl` (with examples)

How to use the command `isisdl` (with examples)

isisdl is a downloading utility specifically designed for ISIS of TU-Berlin.

Read More
How to use the command pdf-parser (with examples)

How to use the command pdf-parser (with examples)

The pdf-parser command is a tool used to identify fundamental elements of a PDF file without rendering it.

Read More
Docker Machine: Managing Docker Machines (with examples)

Docker Machine: Managing Docker Machines (with examples)

Docker Machine is a command-line tool that enables users to create and manage multiple virtual machines running Docker.

Read More