深入解析Linux 常用命令--arping

深入解析Linux常用命令–arping

1.概述

arping常用于检测IP是否已经存在、某个IP的MAC的地址等。

2.arping各参数含义

a.无参数,持续的向特定IP地址请求arp

[root@smart Desktop]# arping 192.168.1.105 
ARPING 192.168.1.105 from 192.168.1.120 eth0
Unicast reply from 192.168.1.105 [3C:BD:3E:61:13:08]  1.324ms
Unicast reply from 192.168.1.105 [3C:BD:3E:61:13:08]  104.092ms
Unicast reply from 192.168.1.105 [3C:BD:3E:61:13:08]  8.286ms

b. -c count,发送arp包个数

[root@smart Desktop]# arping -c 1 192.168.1.105 
ARPING 192.168.1.105 from 192.168.1.120 eth0
Unicast reply from 192.168.1.105 [3C:BD:3E:61:13:08]  1.413ms
Unicast reply from 192.168.1.105 [3C:BD:3E:61:13:08]  101.567ms
Sent 1 probes (1 broadcast(s))
Received 2 response(s)
[root@smart Desktop]# arping -c 2 192.168.1.105 
ARPING 192.168.1.105 from 192.168.1.120 eth0
Unicast reply from 192.168.1.105 [3C:BD:3E:61:13:08]  1.321ms
[root@smart Desktop]# arping -c 3 192.168.1.105 
ARPING 192.168.1.105 from 192.168.1.120 eth0
Unicast reply from 192.168.1.105 [3C:BD:3E:61:13:08]  1.378ms
Unicast reply from 192.168.1.105 [3C:BD:3E:61:13:08]  45.732ms
[root@smart Desktop]# arping -c 4 192.168.1.105 
ARPING 192.168.1.105 from 192.168.1.120 eth0
Unicast reply from 192.168.1.105 [3C:BD:3E:61:13:08]  1.581ms
Unicast reply from 192.168.1.105 [3C:BD:3E:61:13:08]  14.577ms
Sent 4 probes (1 broadcast(s))
Received 2 response(s)

c. -f 收到回复后退出

[root@smart ~]# arping -f 192.168.1.1
ARPING 192.168.1.1 from 192.168.1.120 eth0
Unicast reply from 192.168.1.1 [6C:59:40:FC:C4:F3]  1.205ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)

d. -q 不输出结果,常与-c等共用

[root@smart ~]# arping -q 192.168.1.2 -c 1
[root@smart ~]# echo $?
1

e. -I interface address,网卡

[root@smart ~]# arping 192.168.1.1 -I eth0
ARPING 192.168.1.1 from 192.168.1.120 eth0
Unicast reply from 192.168.1.1 [6C:59:40:FC:C4:F3]  1.435ms
Unicast reply from 192.168.1.1 [6C:59:40:FC:C4:F3]  1.118ms
Unicast reply from 192.168.1.1 [6C:59:40:FC:C4:F3]  1.083ms
Unicast reply from 192.168.1.1 [6C:59:40:FC:C4:F3]  1.079ms
^CSent 4 probes (1 broadcast(s))
Received 4 response(s)

f. -s 指定源地址

[root@smart ~]# arping 192.168.1.1 -s 192.168.1.120
ARPING 192.168.1.1 from 192.168.1.120 eth0
Unicast reply from 192.168.1.1 [6C:59:40:FC:C4:F3]  1.183ms
Unicast reply from 192.168.1.1 [6C:59:40:FC:C4:F3]  1.153ms
^CSent 2 probes (1 broadcast(s))
Received 2 response(s)

Juyin@2017/12/21

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值