How to use the arping command
Function description:
Arping:send ARP REQUEST to a neighbour host (sends arp requests to neighboring hosts)
Usage:
Arping [- AbDfhqUV] [- c count] [- w deadline] [- s source]-I interface destination
Common options:
Required parameters:
-A:ARP reply mode to update neighbor arp
-D: check whether an IP is used, followed by an IP address
-f: quit when arp receives the first reply
-U: active ARP mode, updating neighbor's arp table
Optional parameters:
-c: number of packets sent
-w: set the timeout
-I: specifies the Ethernet device to be used, using eth0 by default
-s: specify the source IP address
Usage 1:
Send an arp request to get the MAC address of the other party
# arping 192.168.0.1 / / send an arp request to the specified IP
Usage 2:
Sends an arp request to the specified host and automatically exits when the first packet is received
# arping-f 192.168.0.1
Usage 3:
Specify the number of times to send arp requests
# arping-c 3 192.168.0.1
Usage 4:
Test whether an IP in the local area network is occupied. A return value of 1 means it is used, and 0 means it is not used.
# arping-D 192.168.50.163-w 5
Usage 5: when an ip switch occurs when you write your own script, you only need to send an arp cleanup request command to the gateway.
Update the arp table of the specified host for this IP, mainly for cases where an ip was previously bound to one host and then switched to another host
# arping-U-s 192.168.50.164 192.168.50.198
-U: update the arp table of the specified host
-s: specify the source address (IP to be switched) and the destination address to update (usually refers to the gateway)
When you need to notify many destination addresses to update the arp table, you can write a script to execute