调试 ssh 隧道到远程 mysql 连接的问题

调试 ssh 隧道到远程 mysql 连接的问题

Ubuntu 20.04.1 LTS我在我的 VPS和本地上运行Ubuntu 18.04.3 LTS,我想创建一个 ssh 隧道来连接到我的数据库以SELECT在我的应用程序中运行报告laravel 6

我的生产数据库具有以下版本:

> mysqld --version
/usr/sbin/mysqld  Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

我使用以下凭据从本地服务器连接到远程服务器:

DB_HOST_PROD=127.0.0.1
DB_PORT_PROD=13306
DB_DATABASE_PROD=test_db
DB_USERNAME_PROD=root
DB_PASSWORD_PROD=prod_pwd

prod 上的 mysql-server 显然正在运行:

root@ubuntu-2gb-nbg1-1:~# netstat -tlpn | grep mysql
tcp        0      0 127.0.0.1:33060         0.0.0.0:*               LISTEN      457519/mysqld       
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      457519/mysqld       

我对变量有以下配置,运行时SHOW VARIABLES LIKE '%time%';我得到:

binlog_max_flush_queue_time 0
connect_timeout 90
default_password_lifetime   0
delayed_insert_timeout  300
explicit_defaults_for_timestamp ON
flush_time  0
have_statement_timeout  YES
innodb_flush_log_at_timeout 1
innodb_lock_wait_timeout    50
innodb_old_blocks_time  1000
innodb_rollback_on_timeout  OFF
interactive_timeout 300
lc_time_names   en_US
lock_wait_timeout   31536000
log_timestamps  UTC
long_query_time 10.000000
max_execution_time  0
mysqlx_connect_timeout  30
mysqlx_idle_worker_thread_timeout   60
mysqlx_interactive_timeout  28800
mysqlx_port_open_timeout    0
mysqlx_read_timeout 30
mysqlx_wait_timeout 28800
mysqlx_write_timeout    60
net_read_timeout    90
net_write_timeout   90
original_commit_timestamp   36028797018963968
regexp_time_limit   32
rpl_stop_slave_timeout  31536000
slave_net_timeout   60
slow_launch_time    2
system_time_zone    CET
time_zone   SYSTEM
timestamp   1614522618.931326
wait_timeout    300

我的防火墙规则如下:

root@ubuntu-2gb-nbg1-1:~# sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
80/tcp (Nginx HTTP)        ALLOW IN    Anywhere                  
22/tcp                     ALLOW IN    Anywhere                  
22/tcp (OpenSSH)           ALLOW IN    Anywhere                  
127.0.0.1 3306/tcp         ALLOW IN    127.0.0.1                 
80/tcp (Nginx HTTP (v6))   ALLOW IN    Anywhere (v6)             
22/tcp (v6)                ALLOW IN    Anywhere (v6)             
22/tcp (OpenSSH (v6))      ALLOW IN    Anywhere (v6) 

运行我的时ssh-command我得到:

admin@admin-VirtualBox:~$ /usr/bin/ssh -o StrictHostKeyChecking=no -v -v -v -N -i /home/admin/.ssh/id_rsa -L 13306:127.0.0.1:3306 -p 22 [email protected]
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "xx.xx.xxx.xxx" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to xx.xx.xxx.xxx [xx.xx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/admin/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/admin/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to xx.xx.xxx.xxx:22 as 'root'
debug3: hostkeys_foreach: reading file "/home/admin/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/admin/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from xx.xx.xxx.xxx
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:aaaaaaaaaaaaa/aaaaaaaaaaaaaaaaaaa
debug3: hostkeys_foreach: reading file "/home/admin/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/admin/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from xx.xx.xxx.xxx
debug1: Host 'xx.xx.xxx.xxx' is known and matches the ECDSA host key.
debug1: Found key in /home/admin/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: /home/admin/.ssh/id_rsa (0x55f736df0320), explicit, agent
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected]>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:aaaaaaaaaaaaaaaaaaaaaaaa /home/admin/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
debug2: input_userauth_pk_ok: fp SHA256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
debug3: sign_and_send_pubkey: RSA SHA256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to xx.xx.xxx.xxx ([xx.xx.xxx.xxx]:22).
debug1: Local connections to LOCALHOST:13306 forwarded to remote address 127.0.0.1:3306
debug3: channel_setup_fwd_listener_tcpip: type 2 wildcard 0 addr NULL
debug3: sock_set_v6only: set socket 5 IPV6_V6ONLY
debug1: Local forwarding listening on ::1 port 13306.
debug2: fd 5 setting O_NONBLOCK
debug3: fd 5 is O_NONBLOCK
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 13306.
debug2: fd 6 setting O_NONBLOCK
debug3: fd 6 is O_NONBLOCK
debug1: channel 1: new [port listener]
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 4
debug1: Remote: /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 4
debug1: Remote: /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Connection to port 13306 forwarding to 127.0.0.1 port 3306 requested.
debug2: fd 7 setting TCP_NODELAY
debug2: fd 7 setting O_NONBLOCK
debug3: fd 7 is O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
debug3: send packet: type 90
debug3: receive packet: type 91
debug2: channel 2: open confirm rwindow 2097152 rmax 32768
debug3: receive packet: type 96
debug2: channel 2: rcvd eof
debug2: channel 2: output open -> drain
debug2: channel 2: obuf empty
debug2: channel 2: close_write
debug2: channel 2: output drain -> closed
debug2: channel 2: read<=0 rfd 7 len 0
debug2: channel 2: read failed
debug2: channel 2: close_read
debug2: channel 2: input open -> drain
debug2: channel 2: ibuf empty
debug2: channel 2: send eof
debug3: send packet: type 96
debug2: channel 2: input drain -> closed
debug2: channel 2: send close
debug3: send packet: type 97
debug3: channel 2: will not send data after close
debug1: Connection to port 13306 forwarding to 127.0.0.1 port 3306 requested.
debug2: fd 8 setting TCP_NODELAY
debug2: fd 8 setting O_NONBLOCK
debug3: fd 8 is O_NONBLOCK
debug1: channel 3: new [direct-tcpip]
debug3: send packet: type 90
debug3: channel 2: will not send data after close
debug3: channel 2: will not send data after close
debug3: receive packet: type 97
debug2: channel 2: rcvd close
debug3: receive packet: type 91
debug2: channel 3: open confirm rwindow 2097152 rmax 32768
debug3: channel 2: will not send data after close
debug2: channel 2: is dead
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34636 to 127.0.0.1 port 13306, nchannels 4
debug3: channel 2: status: The following connections are open:
  #2 direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34636 to 127.0.0.1 port 13306 (t4 r0 i3/0 o3/0 fd 7/7 cc -1)
  #3 direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34640 to 127.0.0.1 port 13306 (t4 r1 i0/0 o0/0 fd 8/8 cc -1)

debug3: receive packet: type 96
debug2: channel 3: rcvd eof
debug2: channel 3: output open -> drain
debug2: channel 3: obuf empty
debug2: channel 3: close_write
debug2: channel 3: output drain -> closed
debug2: channel 3: read<=0 rfd 8 len 0
debug2: channel 3: read failed
debug2: channel 3: close_read
debug2: channel 3: input open -> drain
debug2: channel 3: ibuf empty
debug2: channel 3: send eof
debug3: send packet: type 96
debug2: channel 3: input drain -> closed
debug2: channel 3: send close
debug3: send packet: type 97
debug3: channel 3: will not send data after close
debug1: Connection to port 13306 forwarding to 127.0.0.1 port 3306 requested.
debug2: fd 7 setting TCP_NODELAY
debug2: fd 7 setting O_NONBLOCK
debug3: fd 7 is O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
debug3: send packet: type 90
debug3: channel 3: will not send data after close
debug3: channel 3: will not send data after close
debug3: receive packet: type 97
debug2: channel 3: rcvd close
debug3: channel 3: will not send data after close
debug2: channel 3: is dead
debug2: channel 3: garbage collecting
debug1: channel 3: free: direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34640 to 127.0.0.1 port 13306, nchannels 4
debug3: channel 3: status: The following connections are open:
  #2 direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34654 to 127.0.0.1 port 13306 (t3 nr0 i0/0 o0/0 fd 7/7 cc -1)
  #3 direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34640 to 127.0.0.1 port 13306 (t4 r1 i3/0 o3/0 fd 8/8 cc -1)

debug3: receive packet: type 91
debug2: channel 2: open confirm rwindow 2097152 rmax 32768
debug3: receive packet: type 96
debug2: channel 2: rcvd eof
debug2: channel 2: output open -> drain
debug2: channel 2: obuf empty
debug2: channel 2: close_write
debug2: channel 2: output drain -> closed
debug1: Connection to port 13306 forwarding to 127.0.0.1 port 3306 requested.
debug2: fd 8 setting TCP_NODELAY
debug2: fd 8 setting O_NONBLOCK
debug3: fd 8 is O_NONBLOCK
debug1: channel 3: new [direct-tcpip]
debug3: send packet: type 90
debug2: channel 2: read<=0 rfd 7 len 0
debug2: channel 2: read failed
debug2: channel 2: close_read
debug2: channel 2: input open -> drain
debug2: channel 2: ibuf empty
debug2: channel 2: send eof
debug3: send packet: type 96
debug2: channel 2: input drain -> closed
debug2: channel 2: send close
debug3: send packet: type 97
debug3: channel 2: will not send data after close
debug3: receive packet: type 97
debug2: channel 2: rcvd close
debug3: receive packet: type 91
debug2: channel 3: open confirm rwindow 2097152 rmax 32768
debug3: channel 2: will not send data after close
debug2: channel 2: is dead
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34654 to 127.0.0.1 port 13306, nchannels 4
debug3: channel 2: status: The following connections are open:
  #2 direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34654 to 127.0.0.1 port 13306 (t4 r0 i3/0 o3/0 fd 7/7 cc -1)
  #3 direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34658 to 127.0.0.1 port 13306 (t4 r1 i0/0 o0/0 fd 8/8 cc -1)

admindebug3: receive packet: type 96
debug2: channel 3: rcvd eof
debug2: channel 3: output open -> drain
debug2: channel 3: obuf empty
debug2: channel 3: close_write
debug2: channel 3: output drain -> closed
debug2: channel 3: read<=0 rfd 8 len 0
debug2: channel 3: read failed
debug2: channel 3: close_read
debug2: channel 3: input open -> drain
debug2: channel 3: ibuf empty
debug2: channel 3: send eof
debug3: send packet: type 96
debug2: channel 3: input drain -> closed
debug2: channel 3: send close
debug3: send packet: type 97
debug3: channel 3: will not send data after close
debug3: receive packet: type 97
debug2: channel 3: rcvd close
debug3: channel 3: will not send data after close
debug2: channel 3: is dead
debug2: channel 3: garbage collecting
debug1: channel 3: free: direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34658 to 127.0.0.1 port 13306, nchannels 3
debug3: channel 3: status: The following connections are open:
  #3 direct-tcpip: listening port 13306 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 34658 to 127.0.0.1 port 13306 (t4 r1 i3/0 o3/0 fd 8/8 cc -1)


我在我的应用程序中遇到的错误是MySQL server has gone away

看起来 ssh 隧道已正确创建,但似乎也无法通过隧道查询和提供数据。但是,我不确定是防火墙还是 mysql 使用授权问题,还是......?

说实话,我不知道如何进一步缩小问题空间或如何进一步调试以找到真正的问题。

非常感谢您的回复!

更新

我的max_allowed_package价值观是:

在此处输入图片描述

使用 ssh 连接:

06:51:51.655444 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    localhost.mysql > localhost.43736: Flags [S.], cksum 0xfe30 (incorrect -> 0x592c), seq 2018907411, ack 4184943146, win 65483, options [mss 65495,sackOK,TS val 2011647773 ecr 2011647773,nop,wscale 7], length 0
    0x0000:  4500 003c 0000 4000 4006 3cba 7f00 0001  E..<..@.@.<.....
    0x0010:  7f00 0001 0cea aad8 7856 1513 f971 2a2a  ........xV...q**
    0x0020:  a012 ffcb fe30 0000 0204 ffd7 0402 080a  .....0..........
    0x0030:  77e7 4f1d 77e7 4f1d 0103 0307            w.O.w.O.....
06:51:51.655453 IP (tos 0x0, ttl 64, id 31733, offset 0, flags [DF], proto TCP (6), length 52)
    localhost.43736 > localhost.mysql: Flags [.], cksum 0xfe28 (incorrect -> 0x7fe8), ack 1, win 512, options [nop,nop,TS val 2011647773 ecr 2011647773], length 0
    0x0000:  4500 0034 7bf5 4000 4006 c0cc 7f00 0001  E..4{.@.@.......
    0x0010:  7f00 0001 aad8 0cea f971 2a2a 7856 1514  .........q**xV..
    0x0020:  8010 0200 fe28 0000 0101 080a 77e7 4f1d  .....(......w.O.
    0x0030:  77e7 4f1d                                w.O.
06:51:51.656318 IP (tos 0x0, ttl 64, id 12050, offset 0, flags [DF], proto TCP (6), length 147)
    localhost.mysql > localhost.43736: Flags [P.], cksum 0xfe87 (incorrect -> 0x2228), seq 1:96, ack 1, win 512, options [nop,nop,TS val 2011647774 ecr 2011647773], length 95
    0x0000:  4500 0093 2f12 4000 4006 0d51 7f00 0001  E.../.@[email protected]....
    0x0010:  7f00 0001 0cea aad8 7856 1514 f971 2a2a  ........xV...q**
    0x0020:  8018 0200 fe87 0000 0101 080a 77e7 4f1e  ............w.O.
    0x0030:  77e7 4f1d 5b00 0000 0a38 2e30 2e32 332d  w.O.[....8.0.23-
    0x0040:  3075 6275 6e74 7530 2e32 302e 3034 2e31  0ubuntu0.20.04.1
    0x0050:  00db 0000 0033 5877 6149 534d 3900 ffff  .....3XwaISM9...
    0x0060:  ff02 00ff cf15 0000 0000 0000 0000 0000  ................
    0x0070:  7f0a 5e34 754c 607e 461e 256b 0063 6163  ..^4uL`~F.%k.cac
    0x0080:  6869 6e67 5f73 6861 325f 7061 7373 776f  hing_sha2_passwo
    0x0090:  7264 00                                  rd.
06:51:51.656328 IP (tos 0x0, ttl 64, id 31734, offset 0, flags [DF], proto TCP (6), length 52)
    localhost.43736 > localhost.mysql: Flags [.], cksum 0xfe28 (incorrect -> 0x7f87), ack 96, win 512, options [nop,nop,TS val 2011647774 ecr 2011647774], length 0
    0x0000:  4500 0034 7bf6 4000 4006 c0cb 7f00 0001  E..4{.@.@.......
    0x0010:  7f00 0001 aad8 0cea f971 2a2a 7856 1573  .........q**xV.s
    0x0020:  8010 0200 fe28 0000 0101 080a 77e7 4f1e  .....(......w.O.
    0x0030:  77e7 4f1e                                w.O.
06:51:51.852161 IP (tos 0x0, ttl 64, id 31735, offset 0, flags [DF], proto TCP (6), length 221)
    localhost.43736 > localhost.mysql: Flags [P.], cksum 0xfed1 (incorrect -> 0xc68f), seq 1:170, ack 96, win 512, options [nop,nop,TS val 2011647970 ecr 2011647774], length 169
    0x0000:  4500 00dd 7bf7 4000 4006 c021 7f00 0001  E...{.@.@..!....
    0x0010:  7f00 0001 aad8 0cea f971 2a2a 7856 1573  .........q**xV.s
    0x0020:  8018 0200 fed1 0000 0101 080a 77e7 4fe2  ............w.O.
    0x0030:  77e7 4f1e a500 0001 8da2 1a00 0000 00c0  w.O.............
    0x0040:  ff00 0000 0000 0000 0000 0000 0000 0000  ................
    0x0050:  0000 0000 0000 0000 726f 6f74 0020 86df  ........root....
    0x0060:  8b4f b2fc 1fe6 bbae 2f0a c238 9ffe 3f26  .O....../..8..?&
    0x0070:  09b2 d41c 58ff 8b85 dc7b 2110 b909 6465  ....X....{!...te
    0x0080:  6d6f 5f6c 6172 6176 656c 5f6e 6c67 5f67  st.db.cachin
    0x00a0:  675f 7368 6132 5f70 6173 7377 6f72 6400  g_sha2_password.
    0x00b0:  2c0c 5f63 6c69 656e 745f 6e61 6d65 076d  ,._client_name.m
    0x00c0:  7973 716c 6e64 0c5f 7365 7276 6572 5f68  ysqlnd._server_h
    0x00d0:  6f73 7409 3132 372e 302e 302e 31         ost.127.0.0.1
06:51:51.852170 IP (tos 0x0, ttl 64, id 12051, offset 0, flags [DF], proto TCP (6), length 52)
    localhost.mysql > localhost.43736: Flags [.], cksum 0xfe28 (incorrect -> 0x7d57), ack 170, win 511, options [nop,nop,TS val 2011647970 ecr 2011647970], length 0
    0x0000:  4500 0034 2f13 4000 4006 0daf 7f00 0001  E..4/.@.@.......
    0x0010:  7f00 0001 0cea aad8 7856 1573 f971 2ad3  ........xV.s.q*.
    0x0020:  8010 01ff fe28 0000 0101 080a 77e7 4fe2  .....(......w.O.
    0x0030:  77e7 4fe2                                w.O.
06:51:51.852292 IP (tos 0x0, ttl 64, id 12052, offset 0, flags [DF], proto TCP (6), length 100)
    localhost.mysql > localhost.43736: Flags [P.], cksum 0xfe58 (incorrect -> 0x310d), seq 96:144, ack 170, win 512, options [nop,nop,TS val 2011647970 ecr 2011647970], length 48
    0x0000:  4500 0064 2f14 4000 4006 0d7e 7f00 0001  E..d/.@.@..~....
    0x0010:  7f00 0001 0cea aad8 7856 1573 f971 2ad3  ........xV.s.q*.
    0x0020:  8018 0200 fe58 0000 0101 080a 77e7 4fe2  .....X......w.O.
    0x0030:  77e7 4fe2 2c00 0002 fe6d 7973 716c 5f6e  w.O.,....mysql_n
    0x0040:  6174 6976 655f 7061 7373 776f 7264 0033  ative_password.3
    0x0050:  5877 6149 534d 397f 0a5e 3475 4c60 7e46  sds32d9..^32L`~F
    0x0060:  1e25 6b00                                .%k.
06:51:51.852298 IP (tos 0x0, ttl 64, id 31736, offset 0, flags [DF], proto TCP (6), length 52)
    localhost.43736 > localhost.mysql: Flags [.], cksum 0xfe28 (incorrect -> 0x7d26), ack 144, win 512, options [nop,nop,TS val 2011647970 ecr 2011647970], length 0
    0x0000:  4500 0034 7bf8 4000 4006 c0c9 7f00 0001  E..4{.@.@.......
    0x0010:  7f00 0001 aad8 0cea f971 2ad3 7856 15a3  .........q*.xV..
    0x0020:  8010 0200 fe28 0000 0101 080a 77e7 4fe2  .....(......w.O.
    0x0030:  77e7 4fe2   
...

没有 ssh 连接:

06:42:53.613568 IP (tos 0x0, ttl 64, id 6317, offset 0, flags [DF], proto TCP (6), length 1725)
    localhost.mysql > localhost.43656: Flags [P.], cksum 0x04b2 (incorrect -> 0xcfa4), seq 4156521934:4156523607, ack 1523925399, win 6148, options [nop,nop,TS val 2011109731 ecr 2011097903], length 1673
06:42:53.613825 IP (tos 0x0, ttl 64, id 35946, offset 0, flags [DF], proto TCP (6), length 61)
    localhost.43656 > localhost.mysql: Flags [P.], cksum 0xfe31 (incorrect -> 0xeb37), seq 1:10, ack 1673, win 24565, options [nop,nop,TS val 2011109731 ecr 2011109731], length 9
06:42:53.613842 IP (tos 0x0, ttl 64, id 6318, offset 0, flags [DF], proto TCP (6), length 52)
    localhost.mysql > localhost.43656: Flags [.], cksum 0xfe28 (incorrect -> 0x6e32), ack 10, win 6148, options [nop,nop,TS val 2011109731 ecr 2011109731], length 0
06:42:53.614497 IP (tos 0x0, ttl 64, id 35947, offset 0, flags [DF], proto TCP (6), length 111)
    localhost.43656 > localhost.mysql: Flags [P.], cksum 0xfe63 (incorrect -> 0xbd7a), seq 10:69, ack 1673, win 24565, options [nop,nop,TS val 2011109732 ecr 2011109731], length 59
06:42:53.614503 IP (tos 0x0, ttl 64, id 6319, offset 0, flags [DF], proto TCP (6), length 52)
    localhost.mysql > localhost.43656: Flags [.], cksum 0xfe28 (incorrect -> 0x6df5), ack 69, win 6148, options [nop,nop,TS val 2011109732 ecr 2011109732], length 0
06:42:53.626323 IP (tos 0x0, ttl 64, id 6320, offset 0, flags [DF], proto TCP (6), length 532)
    localhost.mysql > localhost.43656: Flags [P.], cksum 0x0009 (incorrect -> 0x434c), seq 1673:2153, ack 69, win 6148, options [nop,nop,TS val 2011109744 ecr 2011109732], length 480
...

说实话,由于我收到了数千个包,我不太清楚在这些输出中应该寻找什么。

感谢您的回复!

相关内容