大家好,又见面了,我是你们的朋友全栈君。arping是用于发送arp请求到一个相邻主机的工具;
arping使用arp数据包,通过ping命令检查设备上的硬件地址。
语法:
[root@ha01 ~]# arping
Usage: arping [-fqbDUAV] [-c count] [-w timeout] [-I device] [-s source] destination
-f : quit on first reply
-q : be quiet
-b : keep broadcasting, don’t go unicast
-D : duplicate address detection mode
-U : Unsolicited ARP mode, update your neighbours
-A : ARP answer mode, update your neighbours
-V : print version and exit
-c count : how many packets to send
-w timeout : how long to wait for a reply
-I device : which ethernet device to use (eth0)
-s source : source ip address
destination : ask for what ip address
该命令的各选项含义如下:
-f 表示在收到第一个响应包后就退出;
-q quiet output 不显示任何信息;
-b 用于发送以太网广播帧(FFFFFFFFFFFF)。arping一开始使用广播地址,在收到响应后就使用unicast地址。
-c count表示发送指定数量的 ARP 请求数据包后就停止。如果制定了deadline选项,则arping会等待相同数量的arp响应包,直到超时为止;
-d hostname 删除指定 hostname 的所有入口;
-w timeout设定一个超时时间,单位是秒。如果到了指定时间,arping 还没有完全收到响应则退出;
-V 显示版本信息
-H type设置和查询arp缓存时检查 type 类型的地址;
-a [hostname] 显示指定 hostname 的所有入口;
-s hostname hw_addr 手工加入 hostname 的地址映射;
范例1 :发送ARP请求
[root@ha01 ~]# arping 10.0.0.101
ARPING 10.0.0.101 from 10.0.0.121 eth0
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.121ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 0.804ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.431ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.019ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.289ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 0.831ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.480ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.024ms
范例2 :向指定主机发送ARP请求,当收到第一个包自动退出
[root@ha01 ~]# arping -f 10.0.0.101
ARPING 10.0.0.101 from 10.0.0.121 eth0
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.145ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
范例3 : 指定发送次数
[root@ha01 ~]# arping -c 5 10.0.0.101
ARPING 10.0.0.101 from 10.0.0.121 eth0
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.145ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.041ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.345ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.004ms
Unicast reply from 10.0.0.101 [78:E4:00:4C:9E:E9] 1.014ms
Sent 5 probes (1 broadcast(s))
Received 5 response(s)
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/132670.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...