Linux下ARP相关操作(2)

$ sudo arping -b  -I eth1  -s 10.1.1.12  10.1.1.19
ARPING 10.1.1.19 from 10.1.1.12 eth1
Unicast reply from 10.1.1.19 [00:16:3E:F2:38:3B]  0.764ms
Unicast reply from 10.1.1.19 [00:16:3E:F2:38:3B]  0.843ms
Unicast reply from 10.1.1.19 [00:16:3E:F2:38:3B]  0.744ms

-c 指定发送ARP REQUEST报文个数.如果再指定-w参数,arping将一直等待ARP REPLY报文,直到超时时间截止

$ sudo arping -c 5  -I eth1  -s 10.1.1.12  10.1.1.19
ARPING 10.1.1.19 from 10.1.1.12 eth1
Unicast reply from 10.1.1.19 [00:16:3E:F2:38:3B]  0.771ms
Unicast reply from 10.1.1.19 [00:16:3E:F2:38:3B]  0.744ms
Unicast reply from 10.1.1.19 [00:16:3E:F2:38:3B]  0.741ms
Unicast reply from 10.1.1.19 [00:16:3E:F2:38:3B]  0.806ms
Unicast reply from 10.1.1.19 [00:16:3E:F2:38:3B]  0.731ms
Sent 5 probes (1 broadcast(s))
Received 5 response(s)

-w deadline
以秒为单位指定超时时间。

-D 重复地址检查模式

$ sudo arping -D 10.1.1.200
ARPING 10.1.1.200 from 0.0.0.0 eth0
Unicast reply from 10.1.1.200 [00:16:3E:F2:37:6B]  0.692ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)

-I 指定发送ARP REQUEST的网卡

-s 指定源地址
 如果使用DAD模式,设置成为0.0.0.0

如果使用Unsolicited ARP mode,设置成为目的地址
 其他情况下,根据路由表计算

4.阻止ARP flux
ARP协议用于将IP地址转换成为物理地址,默认情况下,拥有多块网卡的Linux主机会响应该主机的任意网卡上接收到的任意网卡上绑定的IP地址的ARP请求。

假设一台Linux主机拥有两块网卡A和B,IP地址和MAC地址分别是
主机A 
IP  10.10.41.102

MAC  08:00:27:4B:63:93

主机B
IP  10.10.41.142
MAC  08:00:27:47:78:55

现在使用arping命令分别向两个IP发送ARP REQUEST
$ sudo arping 10.10.41.142
ARPING 10.10.41.142 from 10.10.41.17 eth0
Unicast reply from 10.10.41.142 [08:00:27:4B:63:93]  1.721ms
Unicast reply from 10.10.41.142 [08:00:27:4B:63:93]  1.774ms
Unicast reply from 10.10.41.142 [08:00:27:4B:63:93]  2.626ms
Unicast reply from 10.10.41.142 [08:00:27:4B:63:93]  1.174ms
Unicast reply from 10.10.41.142 [08:00:27:4B:63:93]  1.164ms
^CSent 5 probes (1 broadcast(s))
Received 5 response(s)
$ sudo arping 10.10.41.102
ARPING 10.10.41.102 from 10.10.41.17 eth0
Unicast reply from 10.10.41.102 [08:00:27:4B:63:93]  1.988ms
Unicast reply from 10.10.41.102 [08:00:27:4B:63:93]  1.266ms
Unicast reply from 10.10.41.102 [08:00:27:4B:63:93]  1.478ms
Unicast reply from 10.10.41.102 [08:00:27:4B:63:93]  1.243ms
^CSent 4 probes (1 broadcast(s))
Received 4 response(s)

可以看到10.10.41.142这个IP返回的不是它该有的MAC地址

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/16620.html