简介
arping 实用程序向指定主机发送 ARP 和/或 ICMP 请求并显示回复。主机可以通过其主机名、IP 地址或其 MAC 地址来指定。
arping发送数据包时可以指定源和目标的ip地址以及mac地址,也可以使用虚假地址进行伪造,这使得apring具有网络攻击性。
官网
安装
# ubuntu 20.04
root@ubuntu:~# sudo apt install arping
使用帮助
root@ubuntu:~# arping --help
ARPing 2.20, by Thomas Habets <thomas@habets.se>
usage: arping [ -0aAbdDeFpPqrRuUv ] [ -w <sec> ] [ -W <sec> ] [ -S <host/ip> ]
[ -T <host/ip ] [ -s <MAC> ] [ -t <MAC> ] [ -c <count> ]
[ -C <count> ] [ -i <interface> ] [ -m <type> ] [ -g <group> ]
[ -V <vlan> ] [ -Q <priority> ] <host/ip/MAC | -B>
Options:
-0 Use this option to ping with source IP address 0.0.0.0. Use this
when you haven't configured your interface yet. Note that this
may get the MAC-ping unanswered. This is an alias for -S
0.0.0.0.
-a Audiable ping.
-A Only count addresses matching requested address (This *WILL*
break most things you do. Only useful if you are arpinging many
hosts at once. See arping-scan-net.sh for an example).
-b Like -0 but source broadcast source address (255.255.255.255).
Note that this may get the arping unanswered since it's not nor-
mal behavior for a host.
-B Use instead of host if you want to address 255.255.255.255.
-c count
Only send count requests.
-C count
Only wait for this many replies, regardless of -c and -w.
-d Find duplicate replies. Exit with 1 if there are answers from
two different MAC addresses.
-D Display answers as exclamation points and missing packets as dots.
-e Like -a but beep when there is no reply.
-F Don't try to be smart about the interface name. (even if this
switch is not given, -i overrides smartness)
-g group
setgid() to this group instead of the nobody group.
-h Displays a help message and exits.
-i interface
Use the specified interface.
-m type
Type of timestamp to use for incoming packets. Use -vv when
pinging to list available ones.
-q Does not display messages, except error messages.
-Q pri 802.1p priority to set. Should be used with 802.1Q (-V).
Defaults to 0.
-r Raw output: only the MAC/IP address is displayed for each reply.
-R Raw output: Like -r but shows "the other one", can be combined
with -r.
-s MAC Set source MAC address. You may need to use -p with this.
-S IP Like -b and -0 but with set source address. Note that this may
get the arping unanswered if the target does not have routing to
the IP. If you don't own the IP you are using, you may need to
turn on promiscious mode on the interface (with -p). With this
switch you can find out what IP-address a host has without tak-
ing an IP-address yourself.
-t MAC Set target MAC address to use when pinging IP address.
-T IP Use -T as target address when pinging MACs that won't respond to
a broadcast ping but perhaps to a directed broadcast.
Example:
To check the address of MAC-A, use knowledge of MAC-B and IP-B.
$ arping -S <IP-B> -s <MAC-B> -p <MAC-A>
-p Turn on promiscious mode on interface, use this if you don't
"own" the MAC address you are using.
-P Send ARP replies instead of requests. Useful with -U.
-u Show index=received/sent instead of just index=received when
pinging MACs.
-U Send unsolicited ARP.
-v Verbose output. Use twice for more messages.
-V num 802.1Q tag to add. Defaults to no VLAN tag.
-w sec Specify a timeout before ping exits regardless of how many
packets have been sent or received.
-W sec Time to wait between pings.
Report bugs to: thomas@habets.se
Arping home page: <http://www.habets.pp.se/synscan/>
Development repo: http://github.com/ThomasHabets/arping
使用示例
# 向192.168.21.1发送1个arp请求,-c 1表示发送1个请求
root@ubuntu:~# arping 192.168.21.1 -c 1
# arp欺骗,-s arp请求的源mac,-S arp请求中的源ip,192.168.21.1 目标ip
root@ubuntu:~# arping -s 11-11-11-11-11-11 -S 192.168.21.11 192.168.21.1 -c 1
ARPING 192.168.21.1
Timeout
--- 192.168.21.1 statistics ---
1 packets transmitted, 0 packets received, 100% unanswered (0 extra)
# 以上命令执行完成后,192.168.21.1的主机将生成一条arp缓存,如下所示
接口: 192.168.21.1 --- 0xc
Internet 地址 物理地址 类型
192.168.21.11 11-11-11-11-11-11 动态
# 发送icmp ping,-s 源mac, -S 源ip, -T 目标ip,00-50-56-C0-00-08 目标mac
root@ubuntu:~# arping -s 00:0c:29:2b:39:27 -S 192.168.21.128 -T 192.168.21.1 00-50-56-C0-00-08
注意
arping可以作为网络攻击工具;使用不当可能造成他人网络中断,请不要滥用此工具。
种草
本文为"计算机网络实用工具系列"的内容之一,会持续更新其它相关博文
我的博文内容主要针对“计算机网络”、“安全”、“运维”和“云计算”方向,感兴趣朋友的请关注我,我将不定期发布新的博文并不断改进已发布博文。
后期依据大家对博文的评论,点赞及关注情况,针对大家感兴趣的内容我也会录制视频并整理出成套的学习资料免费分享给大家,期待能和大家一起交流学习。