14-network client tools
ping
send ICMP ECHO_REQUEST to network hosts
ping [OPTION] destination
-c #:发送ping包个数
-w #:ping命令超时时长
-W #:一次ping操作中,等待对方响应的超时时长
-s #:指定ping的包的大小,单位是字节,Maximum is 65507
Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.
[root@localhost ~]# ping -c 3 172.16.0.1
PING 172.16.0.1 (172.16.0.1) 56(84) bytes of data.
64 bytes from 172.16.0.1: icmp_seq=1 ttl=64 time=0.330 ms
64 bytes from 172.16.0.1: icmp_seq=2 ttl=64 time=0.301 ms
64 bytes from 172.16.0.1: icmp_seq=3 ttl=64 time=0.355 ms
--- 172.16.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.301/0.328/0.355/0.030 ms
[root@localhost ~]# ping -w 3 218.60.112.164
PING 218.60.112.164 (218.60.112.164) 56(84) bytes of data.
--- 218.60.112.164 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 3000ms
[root@localhost ~]# ping -s 65507 172.16.0.1
PING 172.16.0.1 (172.16.0.1) 65507(65535) bytes of data.
65515 bytes from 172.16.0.1: icmp_seq=1 ttl=64 time=3.16 ms
65515 bytes from 172.16.0.1: icmp_seq=2 ttl=64 time=3.20 ms
hping(hping3)
send (almost) arbitrary TCP/IP
--fast: Alias for -i u10000. Hping will send 10 packets for second.
--faster:Sent packets as fast as possible, without taking care to show incoming replies. This is ways faster than to specify the -i u0 option.
--flood:Sent packets as fast as possible, without taking care to show incoming replies. This is ways faster than to specify the -i u0 option.
-i uX:Wait the specified number of seconds or micro seconds between sending each packet.set wait to X micro seconds.越小表示ping之间等待的毫秒数越少
[root@localhost ~]# yum install hping
# 下列命令ping的特别快
[root@localhost ~]# hping3 --fast 172.16.0.1
# 下列命令ping的飞快
[root@localhost ~]# hping3 --faster 172.16.0.1
# 下列命令疯狂的ping,但是不会显示icmp reply
[root@localhost ~]# hping3 --flood 172.16.0.1
HPING 172.16.0.1 (eno16777728 172.16.0.1): NO FLAGS are set, 40 headers + 0 data bytes
hping in flood mode, no replies will be shown
traceroute
print the route packets trace to network host;跟踪数据包到达网络主机所经过的路由工具;
traceroute 是用来发出数据包的主机到目标主机之间所经过的网关的工具。traceroute 的原理是试图以最小的TTL发出探测包来跟踪数据包到达目标主机所经过的网关,然后监听一个来自网关ICMP的应答。发送数据包的大小默认为 38个字节。
traceroute [-46dFITUnreAV] [-f first_ttl] [-g gate,...]
[-i device] [-m max_ttl] [-p port] [-s src_addr]
[-q nqueries] [-N squeries] [-t tos]
[-l flow_label] [-w waittime] [-z sendwait] [-UL] [-D]
[-P proto] [--sport=port] [-M method] [-O mod_options]
[--mtu] [--back]
host [packet_len]
常用参数
-i:指定网络接口,对于多个网络接口有效
-m 把在外发探测试包中所用的最大生存期设置为max-ttl次转发,默认值为30次;
-n 显示IP地址,不查主机名。当DNS不起作用时常用到这个参数;
-p port 探测包使用的基本UDP端口设置为port ,默认值是33434
-r 绕过正常的路由表,直接发送到网络相连的主机;
-w n 把对外发探测包的等待响应时间设置为n秒,默认值为3秒;
[root@localhost ~]# traceroute -i eno16777728 218.60.112.164
traceroute to 218.60.112.164 (218.60.112.164), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
# 指定为40次的ttl
[root@localhost ~]# traceroute -i eno16777728 -m 40 218.60.112.164
traceroute to 218.60.112.164 (218.60.112.164), 40 hops max, 60 byte packets
#
[root@localhost ~]# traceroute 61.135.169.125
traceroute to 61.135.169.125 (61.135.169.125), 30 hops max, 60 byte packets
1 172.16.11.101 (172.16.11.101) 3414.875 ms !H 3414.688 ms !H 3414.671 ms !H
-
记录按序列号从1开始,每个纪录就是一跳 ,每跳表示一个网关,我们看到每行有三个时间,单位是 ms,其实就是-q的默认参数。探测数据包向每个网关发送三个数据包后,网关响应后返回的时间;
有时我们traceroute 一台主机时,会看到有一些行是以星号表示的。出现这样的情况,可能是防火墙封掉了ICMP的返回信息,所以我们得不到什么相关的数据包返回数据。
有时我们在某一网关处延时比较长,有可能是某台网关比较阻塞,也可能是物理设备本身的原因。当然如果某台DNS出现问题时,不能解析主机名、域名时,也会有延时长的现象;您可以加-n 参数来避免DNS解析,以IP格式输出数据;
ftp
file transfer protocol
lftp
lftp [-d] [-e cmd] [-p port] [-u user[,pass]] [site]
get单文件下载mget多文件下载
put单文件上传mput多文件上传
lftpget
get a file with lftp,不能下载目录
lftpget [-c] [-d] [-v] URL [URL...]
-c:continue a previous download,支持断点续传
wget
the non-interactive network downloader,不能下载目录
wget [optoin]... [URL]...
-b:在后台执行下载操作,一般用于脚本
-q:静默模式下载,一般用于脚本
-O file:指定目录及文件名file为/path/to/fileName
-c:断点续传
--limit-rate=amount:以指定的速率传输文件