网络管理命令ping和arping

ping

ping        向目标主机发送icmp请求包

              常用来测试当前主机与目标主机网络连接状况

 

常见选项

                   -c              设置发包的个数

                   -s               设置发的包的块大小,最大不超过65507

                   -W            设置接收回应超时时间

                   -i               发包间隔时间

                   -I                指定网卡

                   -f               压力测试网络,向目标主机大量发送请求包

 

 

测试与ip为55.0.0.1/8主机的网络连接状态

[root@vathe-pc ~]#ping 55.0.0.1

PING 55.0.0.1 (55.0.0.1) 56(84) bytes of data.

64 bytes from 55.0.0.1: icmp_seq=1 ttl=64 time=0.434 ms

64 bytes from 55.0.0.1: icmp_seq=2 ttl=64 time=0.352 ms

     //提示可以连接,time=0.434ms表示,第一个包从发出来,到接收到回应的时间为0.434ms

 

向目标主机发送一个超大块包

[root@vathe-pc ~]#ping -c 1 -s 65507 55.0.0.1

PING 55.0.0.1 (55.0.0.1) 65507(65535) bytes of data.

65515 bytes from 55.0.0.1: icmp_seq=1 ttl=64 time=2.50 ms

arping

arping               向目标主机发送arp数据包,常用来检测一个ip是否在网络中已被使用

 

         -q              静默模式执行,不显示任何信息

         -f               在收到第一个响应之后就退出

         -w             设定超时时间

         -c              设定发送的包数量

 

[root@localhost ~]# arping www.baidu.com

ARPING 220.181.111.147 from 173.231.43.132 eth0

Unicast reply from 220.181.111.147 [00:D0:03:bc:48:00] 1.666ms

Unicast reply from 220.181.111.147 [00:D0:03:BC:48:00] 1.677ms

posted @ 2017-05-03 21:06  Vathe  阅读(4414)  评论(1编辑  收藏  举报