arping命令 《openstack 网络》

1. arping介绍

arping命令作用是使用arp数据包,通过ping命令检查来测试网络。arping命令能够测试一个ip地址是否是在网络上已经被使用,并能够获取更多设备信息。功能类似于ping。

由于arping命令基于ARP广播机制,所以arping命令只能测试同一网段或子网的网络主机的连通性,ping命令则是基于ICMP协议,是可以路由的,所以使用ping命令可以测试任意网段的主机网络连通性。

[root@lys-mysql ~]#  arping -h
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
  -s source : source ip address
  destination : ask for what ip address

语法格式:arping [参数]

参数作用
-A更新邻近主机的ARP缓存(使用ARP应答数据包代替ARP请求数据包)
-b仅发送MAC级广播
-c发送指定个数ARP请求数据包后停止
-D重复地址检测模式(DAD)
-f在第一个回复确认目标存活后退出命令
-h打印帮助手册并退出
-I指定ARP请求报文的网络接口
-q安静模式。不显示任何信息
-s指定发送ARP请求数据包的源IP地址
-U更新邻近主机的ARP缓存

2. 实践

由于多个网卡需要制订网卡

2.1 向目标主机发送3次(指定次数)ARP请求报文:

[root@lys-mysql ~]# arping -I eth0 -c 3 10.6.8.192
ARPING 10.6.8.192 from 10.6.8.238 eth0
Unicast reply from 10.6.8.192 [FA:16:3E:3C:F1:6A]  1.201ms
Unicast reply from 10.6.8.192 [FA:16:3E:3C:F1:6A]  0.733ms
Unicast reply from 10.6.8.192 [FA:16:3E:3C:F1:6A]  0.710ms
Sent 3 probes (1 broadcast(s))
Received 3 response(s)




[root@lys-mysql ~]# arping -I docker0 -c 3 172.17.0.2
ARPING 172.17.0.2 from 172.17.0.1 docker0
Unicast reply from 172.17.0.2 [02:42:AC:11:00:02]  0.567ms
Unicast reply from 172.17.0.2 [02:42:AC:11:00:02]  0.559ms
Unicast reply from 172.17.0.2 [02:42:AC:11:00:02]  0.554ms
Sent 3 probes (1 broadcast(s))
Received 3 response(s)

2.2 arp欺骗

指定发送一个请求报文给192.168.100.70就退出,发送报文的接口为eth1,并指定请求报文中的源地址为本机eth0接口上的地址192.168.100.54.
发送这样的arp请求包,将会使得目标主机192.168.100.70缓存本机的arp条目为”192.168.100.54 MAC_eth1”,但实际上,192.168.100.54所在接口的MAC地址为MAC_eth0。

arping -c 1 -I eth1 -s 192.168.100.54 192.168.100.70 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

liuyunshengsir

微信:lys20191020

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值