1.概述

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

2.arping各参数含义

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

1
2
3
4
5
[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包个数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[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 收到回复后退出

1
2
3
4
5
[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等共用

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

e. -I interface address,网卡

1
2
3
4
5
6
7
8
[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 指定源地址

1
2
3
4
5
6
[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)