监控io性能、free命令、ps命令、查看网络状态、linux下

2018-10-24  本文已影响0人  XiaoMing丶

目录

一、监控io性能
二、free命令
三、ps命令
四、查看网络状态
五、linux下抓包

一、监控io性能

[root@minglinux-01 ~]# iostat -x
Linux 3.10.0-862.11.6.el7.x86_64 (minglinux-01)     2018年10月24日     _x86_64_    (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.09    0.00    0.22    0.01    0.00   99.68

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
scd0              0.00     0.00    0.00    0.00     0.10     0.00   114.22     0.00    2.11    2.11    0.00   1.56   0.00
sdb               0.00     0.00    0.02    0.00     0.33     0.00    28.99     0.00    0.21    0.21    0.00   0.14   0.00
sda               0.00     0.03    0.71    0.41    21.85    12.33    61.05     0.00    0.89    0.73    1.17   0.41   0.05
dm-0              0.00     0.00    0.00    0.00     0.10     0.00    48.19     0.00    0.33    0.33    0.00   0.19   0.00

详细说明:第二行是系统信息和监测时间,第三行和第四行显示CPU使用情况。这里主要关注后面I/O输出的信息,如下所示:

上例的一些字段的解释:

| Device | 监测设备名称 |
| rrqm/s | 每秒需要读取需求的数量 |
| wrqm/s | 每秒需要写入需求的数量 |
| r/s | 每秒实际读取需求的数量 |
| w/s | 每秒实际写入需求的数量 |
| rsec/s | 每秒读取区段的数量 |
| wsec/s | 每秒写入区段的数量 |
| rkB/s | 每秒实际读取的大小,单位为KB |
| wkB/s | 每秒实际写入的大小,单位为KB |
| avgrq-sz | 需求的平均大小区段 |
| avgqu-sz | 需求的平均队列长度 |
| await | 等待I/O平均的时间(milliseconds) |
| svctm | I/O需求完成的平均时间 |
| %util | 被I/O需求消耗的CPU百分比 |

着重看%util列,如果数值很大,说明读写很忙。如果读写不大,说明硬盘有问题。

运行yum install -y iotop命令安装。

[root@minglinux-01 ~]# iotop
Total DISK READ :       0.00 B/s | Total DISK WRITE :       0.00 B/s
Actual DISK READ:       0.00 B/s | Actual DISK WRITE:       0.00 B/s
   TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND
    30 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.02 % [kworker/0:1]
     1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % systemd --switched-r~tem --deserialize 22
     2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]
     3 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]
     5 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/0:0H]
     6 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/u256:0]
     7 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/0]
     8 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [rcu_bh]
     9 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [rcu_sched]
    10 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [lru-add-drain]
    11 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [watchdog/0]
    12 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [watchdog/1]
    13 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/1]
    14 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/1]
    16 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/1:0H]
    18 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kdevtmpfs]
    19 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [netns]
    20 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [khungtaskd]
    21 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [writeback]
    22 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kintegrityd]
    23 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [bioset]

二、free命令

free命令可以查看当前系统的总内存大小以及使用内存的情况。

[root@minglinux-01 ~]# free
              total        used        free      shared  buff/cache   availabl
Mem:        1865276      148548     1317440        9756      399288     152084
Swap:       2097148           0     2097148

free命令还可以加-m和-g选项(分别以MB或GB为单位)打印内存的使用状况。示例命令如下:

[root@minglinux-01 ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           1821         145        1286           9         389        1485
Swap:          2047           0        2047
[root@minglinux-01 ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              1           0           1           0           0           1
Swap:             1           0           1

free命令还可以加-h选项以人类易读形式打印,如下所示:

[root@minglinux-01 ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           1.8G        144M        1.3G        9.5M        389M        1.5G
Swap:          2.0G          0B        2.0G

上例的字段的含义:

total:内存总大小。
used:已经使用的内存大小。
free:空闲的物理内存大小。
shared:共享内存大小,不用关注它。
buff/cache:分配给buffer和cache的内存总共有多大。Linux系统为了让应用跑得更快,会预先分配一部分内存(buffer/cache)给某些应用使用。数据经过CPU计算,即将要写入磁盘,这时用的内存为buffer;CPU要计算时,需要把数据从磁盘中读出来,临时先放到内存中,这部分内存就是cache。
available:系统可使用内存有多大,它包含了free。

这个free命令显示的结果中,其实有一个隐藏的公式:total=used+free+buff/cache。

三、ps命令

ps命令用于报告当前系统的进程状态,类似于Windows下的任务管理器。

[root@minglinux-01 ~]# ps
   PID TTY          TIME CMD
  1980 pts/1    00:00:00 bash
  2116 pts/1    00:00:00 ps
[root@minglinux-01 ~]# ps aux
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.0  0.3  46064  6528 ?        Ss   18:07   0:03 /usr/lib/sy
root          2  0.0  0.0      0     0 ?        S    18:07   0:00 [kthreadd]
root          3  0.0  0.0      0     0 ?        S    18:07   0:00 [ksoftirqd/
root          5  0.0  0.0      0     0 ?        S<   18:07   0:00 [kworker/0:
root          6  0.0  0.0      0     0 ?        S    18:07   0:00 [kworker/u2
......
......
root       2118  0.0  0.1 155324  1868 pts/1    R+   21:48   0:00 ps aux
[root@minglinux-01 ~]# ps -elf
F S UID         PID   PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY          TIME CMD
4 S root          1      0  0  80   0 - 11516 ep_pol 18:07 ?        00:00:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
1 S root          2      0  0  80   0 -     0 kthrea 18:07 ?        00:00:00 [kthreadd]
1 S root          3      2  0  80   0 -     0 smpboo 18:07 ?        00:00:00 [ksoftirqd/0]
1 S root          5      2  0  60 -20 -     0 worker 18:07 ?        00:00:00 [kworker/0:0H]
1 S root          6      2  0  80   0 -     0 worker 18:07 ?        00:00:00 [kworker/u256:0]
1 S root          7      2  0 -40   - -     0 smpboo 18:07 ?        00:00:00 [migration/0]
1 S root          8      2  0  80   0 -     0 rcu_gp 18:07 ?        00:00:00 [rcu_bh]
1 S root          9      2  0  80   0 -     0 rcu_gp 18:07 ?        00:00:04 [rcu_sched]
......
......
0 R root       2130   1980  0  80   0 - 38831 -      21:54 pts/1    00:00:00 ps -elf

ps aux和ps -elf显示的信息基本上是一样的,下面介绍几个系统进程的参数。

PID:表示进程的ID,这个ID很有用。在Linux中,内核管理进程就得靠pid来识别和管理某一个进程。比如我想终止某一个进程,则用命令“kill 进程的pid”。有时这样并不能终止进程,需要加-9选项,即“kill -9 进程的pid”,但这样有点暴力,严重的时候会丢数据,所以尽量还是别用。
STAT:进程的状态。进程状态分为以下几种(不要求记住,但要了解)。
 D:不能中断的进程(通常为IO)。
 R(run):正在运行中的进程,其中包括了等待CPU时间片的进程。
 S(sleep):已经中断的进程。通常情况下,系统的大部分进程都是这个状态。
 T:已经停止或者暂停的进程。如果我们正在运行一个命令,比如说sleep 10,我们按一下Ctrl+Z暂停进程时,用ps命令查看就会显示T这个状态。
 W:(内核2.6xx以后不可用),没有足够的内存页分配。
 X:已经死掉的进程(这个好像从来不会出现)。
 Z:僵尸进程,即杀不掉、打不死的垃圾进程,占用系统一点资源,不过没有关系。如果占用太多(一般不会出现),就需要重视了。
 <:高优先级进程。
 N:低优先级进程。
 L:在内存中被锁了内存分页。
 s:主进程,nginx或者php-fpm服务这种。
 l:多线程进程。
 +:在前台运行的进程,比如在当前终端执行ps aux就是前台进程。

[root@minglinux-01 ~]# ps aux | grep mysql
root       2127  0.0  0.0 112720   984 pts/1    S+   21:52   0:00 grep --color=auto mysql
[root@minglinux-01 ~]# ps aux | grep nginx
root       2129  0.0  0.0 112720   984 pts/1    S+   21:52   0:00 grep --color=auto nginx

四、查看网络状态

[root@minglinux-01 ~]# netstat | head
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0     52 minglinux-01:ssh        192.168.89.1:63559      ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  3      [ ]         DGRAM                    8020     /run/systemd/notify
unix  2      [ ]         DGRAM                    8022     /run/systemd/cgroups-agent
unix  5      [ ]         DGRAM                    8037     /run/systemd/journal/socket
unix  10     [ ]         DGRAM                    8039     /dev/log
unix  2      [ ]         DGRAM                    13781    /run/systemd/shutdownd
[root@minglinux-01 ~]# netstat -lnp | head
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1193/master         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      933/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1193/master         
tcp6       0      0 :::22                   :::*                    LISTEN      933/sshd            
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name     Path
unix  2      [ ACC ]     STREAM     LISTENING     18860    1193/master          private/bounce
unix  2      [ ACC ]     STREAM     LISTENING     18863    1193/master          private/defer
[root@minglinux-01 ~]# netstat -an |head -n 20
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0     52 192.168.89.130:22       192.168.89.1:63559      ESTABLISHED
tcp6       0      0 ::1:25                  :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ACC ]     STREAM     LISTENING     18860    private/bounce
unix  2      [ ACC ]     STREAM     LISTENING     18863    private/defer
unix  2      [ ACC ]     STREAM     LISTENING     18866    private/trace
unix  2      [ ACC ]     STREAM     LISTENING     12834    /run/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     18869    private/verify
unix  2      [ ACC ]     STREAM     LISTENING     18875    private/proxymap
unix  2      [ ACC ]     STREAM     LISTENING     18878    private/proxywrite
unix  2      [ ACC ]     STREAM     LISTENING     18881    private/smtp
unix  2      [ ACC ]     STREAM     LISTENING     18884    private/relay
unix  2      [ ACC ]     STREAM     LISTENING     18890    private/error
unix  2      [ ACC ]     STREAM     LISTENING     18893    private/retry
[root@minglinux-01 ~]# netstat -lntp |head -n 20
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1193/master         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      933/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1193/master         
tcp6       0      0 :::22                   :::*                    LISTEN      933/sshd 
[root@minglinux-01 ~]# ss -an |grep -i listen
u_str  LISTEN     0      100    private/bounce 18860                 * 0                  
u_str  LISTEN     0      100    private/defer 18863                 * 0                  
u_str  LISTEN     0      100    private/trace 18866                 * 0                  
u_str  LISTEN     0      128    /run/systemd/private 12834                 * 0                  
u_str  LISTEN     0      100    private/verify 18869                 * 0                  
u_str  LISTEN     0      100    private/proxymap 18875                 * 0                  
u_str  LISTEN     0      100    private/proxywrite 18878                 * 0                  
u_str  LISTEN     0      100    private/smtp 18881                 * 0                  
u_str  LISTEN     0      100    private/relay 18884                 * 0                  
u_str  LISTEN     0      100    private/error 18890                 * 0                  
u_str  LISTEN     0      100    private/retry 18893                 * 0                  
u_str  LISTEN     0      100    private/discard 18896                 * 0                  
u_str  LISTEN     0      100    private/local 18899                 * 0                  
u_seq  LISTEN     0      128    /run/udev/control 13611                 * 0                  
u_str  LISTEN     0      100    private/virtual 18902                 * 0                  
u_str  LISTEN     0      100    private/lmtp 18905                 * 0                  
u_str  LISTEN     0      100    private/anvil 18908                 * 0                  
u_str  LISTEN     0      100    private/scache 18911                 * 0                  
u_str  LISTEN     0      128    /run/lvm/lvmetad.socket 12851                 * 0                  
u_str  LISTEN     0      128    /run/systemd/journal/stdout 8034                  * 0                  
u_str  LISTEN     0      100    public/pickup 18843                 * 0                  
u_str  LISTEN     0      100    public/cleanup 18847                 * 0                  
u_str  LISTEN     0      100    public/qmgr 18850                 * 0                  
u_str  LISTEN     0      100    public/flush 18872                 * 0                  
u_str  LISTEN     0      100    public/showq 18887                 * 0                  
u_str  LISTEN     0      128    /run/lvm/lvmpolld.socket 12913                 * 0                  
u_str  LISTEN     0      32     /var/run/vmware/guestServicePipe 17548                 * 0                  
u_str  LISTEN     0      128    /run/dbus/system_bus_socket 16580                 * 0                  
u_str  LISTEN     0      100    private/tlsmgr 18854                 * 0                  
u_str  LISTEN     0      100    private/rewrite 18857                 * 0                  
tcp    LISTEN     0      100    127.0.0.1:25                    *:*                  
tcp    LISTEN     0      128       *:22                    *:*                  
tcp    LISTEN     0      100     ::1:25                   :::*                  
tcp    LISTEN     0      128      :::22                   :::*                  
[root@minglinux-01 ~]# netstat -an | awk '/^tcp/ {++sta[$NF]} END {for(key in sta) print key,"\t",sta[key]}'
LISTEN   4
ESTABLISHED      1

五、linux下抓包

有时也许想看一下某个网卡上都有哪些数据包,尤其是当你初步判定服务器上有流量攻击时,使用抓包工具来抓取数据包就可以知道有哪些IP在攻击了。

指定ens33网卡:

[root@minglinux-01 ~]# tcpdump -nn -i ens33 
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens33, link-type EN10MB (Ethernet), capture size 262144 bytes
23:09:07.830370 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 2227969015:2227969227, ack 3242422916, win 318, length 212
23:09:07.830637 IP 192.168.89.1.63559 > 192.168.89.130.22: Flags [.], ack 212, win 2051, length 0
23:09:07.830664 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 212:408, ack 1, win 318, length 196
23:09:07.830809 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 408:684, ack 1, win 318, length 276
23:09:07.831004 IP 192.168.89.1.63559 > 192.168.89.130.22: Flags [.], ack 684, win 2049, length 0
23:09:07.831015 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 684:848, ack 1, win 318, length 164
23:09:07.831159 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 848:1124, ack 1, win 318, length 276
23:09:07.831305 IP 192.168.89.1.63559 > 192.168.89.130.22: Flags [.], ack 1124, win 2048, length 0
23:09:07.831444 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 1124:1400, ack 1, win 318, length 276
23:09:07.831632 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 1400:1564, ack 1, win 318, length 164
23:09:07.831777 IP 192.168.89.1.63559 > 192.168.89.130.22: Flags [.], ack 1564, win 2053, length 0
23:09:07.832207 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 1564:1840, ack 1, win 318, length 276
23:09:07.832335 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 1840:2004, ack 1, win 318, length 164
23:09:07.832691 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 2004:2168, ack 1, win 318, length 164
23:09:07.832731 IP 192.168.89.1.63559 > 192.168.89.130.22: Flags [.], ack 2004, win 2051, length 0
......
......

上例中,我们只需要关注第3列和第4列,它们显示的信息为哪一个IP+端口号在连接哪一个IP+端口号。-i选项后面跟设备名称,-nn选项的作用是让第3列和第4列显示成“IP+端口号”的形式,如果不加-nn选项则显示 “主机名+服务名称”。

一些常用示例命令:

tcpdump -nn -i ens33 port 22 // 这样指定只抓22端口的包
tcpdump –nn –i ens33 tcp and not port 22 // 指定抓tcp的包,但是不要22端口的
tcpdump –nn –i ens33 port 22 and port 53 // 只抓22和53端口的包

使用-c选项指定抓包数量,抓够了自动退出,不用我们人为取消。示例命令如下:

[root@minglinux-01 ~]# tcpdump -nn -i ens33 -c 10
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens33, link-type EN10MB (Ethernet), capture size 262144 bytes
23:13:47.949425 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 2228044007:2228044219, ack 3242423812, win 318, length 212
23:13:47.949665 IP 192.168.89.1.63559 > 192.168.89.130.22: Flags [.], ack 212, win 2049, length 0
23:13:47.949778 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 212:504, ack 1, win 318, length 292
23:13:47.949947 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 504:668, ack 1, win 318, length 164
23:13:47.950085 IP 192.168.89.1.63559 > 192.168.89.130.22: Flags [.], ack 668, win 2047, length 0
23:13:47.950298 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 668:944, ack 1, win 318, length 276
23:13:47.950501 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 944:1108, ack 1, win 318, length 164
23:13:47.950623 IP 192.168.89.1.63559 > 192.168.89.130.22: Flags [.], ack 1108, win 2053, length 0
23:13:47.950870 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 1108:1272, ack 1, win 318, length 164
23:13:47.951093 IP 192.168.89.130.22 > 192.168.89.1.63559: Flags [P.], seq 1272:1548, ack 1, win 318, length 276
10 packets captured
11 packets received by filter
0 packets dropped by kernel

使用-w选项可以将数据包存为文件,示例命令如下:

[root@minglinux-01 ~]# tcpdump -nn -i ens33 -c 20 -w /tmp/1.cap
tcpdump: listening on ens33, link-type EN10MB (Ethernet), capture size 262144 bytes
20 packets captured
21 packets received by filter
0 packets dropped by kernel
[root@minglinux-01 ~]# file /tmp/1.cap 
/tmp/1.cap: tcpdump capture file (little-endian) - version 2.4 (Ethernet, capture length 262144)

这个数据包文件是不能cat查看的,可以使用tcpdump -r /tmp/1.cap 查看这个抓取的数据包。如下所示:

[root@minglinux-01 ~]# tcpdump -r /tmp/1.cap
reading from file /tmp/1.cap, link-type EN10MB (Ethernet)
23:17:32.628528 IP minglinux-01.ssh > 192.168.89.1.63559: Flags [P.], seq 2228049975:2228050123, ack 3242427824, win 318, length 148
23:17:32.629804 IP 192.168.89.1.63559 > minglinux-01.ssh: Flags [.], ack 148, win 2051, length 0
23:17:54.665109 ARP, Request who-has 192.168.89.132 tell 192.168.89.1, length 46
23:17:55.432914 ARP, Request who-has 192.168.89.132 tell 192.168.89.1, length 46
23:17:56.433760 ARP, Request who-has 192.168.89.132 tell 192.168.89.1, length 46
23:17:57.659975 ARP, Request who-has 192.168.89.132 tell 192.168.89.1, length 46
23:17:58.433344 ARP, Request who-has 192.168.89.132 tell 192.168.89.1, length 46
23:17:59.433331 ARP, Request who-has 192.168.89.132 tell 192.168.89.1, length 46
23:18:03.661121 ARP, Request who-has 192.168.89.132 tell 192.168.89.1, length 46
23:18:04.433721 ARP, Request who-has 192.168.89.132 tell 192.168.89.1, length 46
23:18:05.433651 ARP, Request who-has 192.168.89.132 tell 192.168.89.1, length 46
23:18:06.933340 ARP, Request who-has gateway tell 192.168.89.1, length 46
23:18:09.567999 ARP, Request who-has gateway tell 192.168.89.1, length 46
23:18:10.433913 ARP, Request who-has gateway tell 192.168.89.1, length 46
23:18:11.051215 IP 192.168.89.1.56931 > 239.255.255.250.ssdp: UDP, length 173
23:18:11.433826 ARP, Request who-has gateway tell 192.168.89.1, length 46
23:18:12.053075 IP 192.168.89.1.56931 > 239.255.255.250.ssdp: UDP, length 173
23:18:12.568608 ARP, Request who-has gateway tell 192.168.89.1, length 46
23:18:12.861648 IP 192.168.89.1.65334 > minglinux-01.ssh: Flags [S], seq 2285184601, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
23:18:12.862088 IP minglinux-01.ssh > 192.168.89.1.65334: Flags [S.], seq 3226606057, ack 2285184602, win 29200, options [mss 1460,nop,nop,sackOK,nop,wscale 7], length 0

记一下如下这个命令:
tshark -n -t a -R http.request -T fields -e "frame.time" -e "ip.src" -e "http.host" -e "http.request.method" -e "http.request.uri"

扩展

tcp三次握手四次挥手 http://www.doc88.com/p-9913773324388.html

tshark几个用法:http://www.aminglinux.com/bbs/thread-995-1-1.html

上一篇下一篇

猜你喜欢

热点阅读