ssh反向代理

[toc]

ssh反代问题

问题一

问题一.我有A和B两台服务器,一台在学校ip是10.71.10.25,另外一台在印度ip是124.156.xx.xx,现在我想构建ssh反向代理,让我的服务器A能被外网ssh连接,防止我不在校园也能控制服务器A。

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
31
32
# 服务器A设置
root@raspbian:/configuration/script# vim ssh_reverse_proxy.sh
#!/bin/bash
ssh -fN -R 8101:localhost:22 root@124.156.xx.xx

# 监控程序脚本
root@raspbian:/configuration/script# vim ssh_reverse_proxy_daemon.sh
#!/bin/bash
while true;do

Flag=`ps -ef | grep "8101" | grep -v "grep"`

if [ -z "$Flag" ]; then

echo "restart ssh server"
bash /configuration/script/ssh_reverse_proxy.sh
# ssh -fN -R 8101:localhost:22 root@124.156.xx.xx
fi

sleep 100

done


# 加入reboot开机自启计划
root@raspbian:/configuration/script# crontab -e
@reboot /configuration/script/ssh_reverse_proxy.sh
@reboot /configuration/script/ssh_reverse_proxy_daemon.sh


# 两台服务器相互交换公钥到对方的/.ssh/authorized_keys,并且把自己的公钥加入到自己的/.ssh/authorized_keys

服务器互联目前不需要密码
脚本程序一切正常,但是服务器A只有重启后的几分钟内能够用服务器B连接,时间长点的话,比如:30分钟后,会发现服务器B一直连接不上

附图(一下三种情况都是在A服务器发出脚本,并且正常运行的到的):

情况一:(连得上)

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
服务器A
root@raspbian:/configuration/script# ps -ef | grep 8101 | grep -v "grep"
root 21390 1 0 11:27 ? 00:00:00 ssh -fN -R 8101:localhost:22 root@124.156.xx.xx

服务器B
[root@VM-0-17-centos ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 52:54:00:46:11:0d brd ff:ff:ff:ff:ff:ff
inet 10.0.0.17/20 brd 10.0.15.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe46:110d/64 scope link
valid_lft forever preferred_lft forever
[root@VM-0-17-centos ~]# ssh localhost -p 8101
Linux raspbian 5.10.78-Release-OPENFANS+20211111-v8 #1 SMP PREEMPT Thu Nov 11 15:43:52 CST 2021 aarch64

This system Debian Pi Aarch64 for Raspberry Pi 3B/3B+/3A+/4B,
Created by OPENFANS.ORG & PIFAN.ORG .

Your can visit our official site:
http://www.openfans.org & http://www.pifan.org

Project address:
https://github.com/openfans-community-offical/Debian-Pi-Aarch64

It is strictly prohibited for any commercial use
without permission!

Especially some disgusting Taobao merchants,
congratulations to being warned!

Activate the web console with: systemctl enable --now cockpit.socket

You have new mail.
Last login: Tue May 31 11:10:02 2022 from 10.71.5.50

.~~. .~~. ___ __ ___ _
'. \ ' ' / .' / _ \___ ___ ___ / / ___ ___ ___ _ __ / _ \(_)
.~ .~~~..~. / , _/ _ `(_-</ _ \/ _ \/ -_) __/ __/ // / / ___/ /
: .~.'~'.~. : /_/|_|\_,_/___/ .__/_.__/\__/_/ /_/ \_, / /_/ /_/
~ ( ) ( ) ~ /_/ /___/
( : '~'.~.'~' : )
~ .~ ( ) ~. ~ Copyright (c) 2017-2022, OPENFANS.ORG & PIFAN.ORG
( : '~' : ) Linux Version 5.10.78-Release-OPENFANS+2021111
'~ .~~~. ~' Compiled #1 SMP PREEMPT Thu Nov 11 15:43:52 CST 2021
'~' Four ARM Processors, 7.9GB RAM
432.00 Bogomips Total
root@raspbian:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e4:5f:01:3d:b7:4f brd ff:ff:ff:ff:ff:ff
inet 10.71.10.159/24 brd 10.71.10.255 scope global dynamic noprefixroute eth0
valid_lft 133302sec preferred_lft 133302sec
inet6 fe80::c2b7:8023:6697:581f/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq state DOWN group default qlen 1000
link/ether e4:5f:01:3d:b7:50 brd ff:ff:ff:ff:ff:ff
4: macvlan@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 1a:55:9c:25:a7:5b brd ff:ff:ff:ff:ff:ff
inet 10.71.10.25/24 brd 10.71.10.255 scope global macvlan
valid_lft forever preferred_lft forever
inet6 fe80::1855:9cff:fe25:a75b/64 scope link
valid_lft forever preferred_lft forever
5: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:5b:34:04:4f brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:5bff:fe34:44f/64 scope link
valid_lft forever preferred_lft forever
6: br-6f69248df895: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:f3:c1:54:d1 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 brd 172.18.255.255 scope global br-6f69248df895
valid_lft forever preferred_lft forever
9: vetha11c56c@if8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default
link/ether 42:0f:dc:8a:33:57 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::400f:dcff:fe8a:3357/64 scope link
valid_lft forever preferred_lft forever
# 已经连上

情况二:(连不上,但是一直尝试连接,没有报错)

1
2
3
4
5
6
7
8
9
[root@VM-0-17-centos ~]# ssh localhost -p 8101






^C

image-20220531113156680

情况三:(直接连接不上,服务器B发出连接不了报错)

1
2
3
4
# 服务器B
[root@VM-0-17-centos ~]# ssh localhost -p 8101
ssh_exchange_identification: read: Connection reset by peer

image-20220531113218786

现在状态

截至时间2022-6-17中午12:52分,服务器A重启后,服务器B也没办法连接上

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
服务器A的crontab日志信息如下
root@raspbian:~# cat /var/log/cron.log
Jun 17 00:05:01 raspbian CRON[15444]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 00:15:01 raspbian CRON[16476]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 00:17:01 raspbian CRON[16674]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 00:20:01 raspbian CRON[16978]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 00:25:01 raspbian CRON[17516]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 00:35:01 raspbian CRON[18539]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 00:40:01 raspbian CRON[19040]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 00:45:01 raspbian CRON[19582]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 00:55:01 raspbian CRON[20582]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 01:00:01 raspbian CRON[21079]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 01:05:01 raspbian CRON[21620]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 01:15:01 raspbian CRON[22651]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 01:17:01 raspbian CRON[22848]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 01:20:01 raspbian CRON[23155]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 01:25:01 raspbian CRON[23693]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 01:35:01 raspbian CRON[24713]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 01:40:01 raspbian CRON[25215]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 01:45:01 raspbian CRON[25754]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 01:55:01 raspbian CRON[26772]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 02:00:01 raspbian CRON[27260]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 02:05:01 raspbian CRON[27812]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 02:15:01 raspbian CRON[28827]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 02:17:01 raspbian CRON[29025]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 02:20:01 raspbian CRON[29336]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 02:25:01 raspbian CRON[29877]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 02:35:01 raspbian CRON[30899]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 02:40:01 raspbian CRON[31405]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 02:45:01 raspbian CRON[31941]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 02:55:01 raspbian CRON[533]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 03:00:01 raspbian CRON[1085]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 03:05:01 raspbian CRON[1675]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 03:15:01 raspbian CRON[2693]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 03:17:01 raspbian CRON[2906]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 03:20:01 raspbian CRON[3229]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 03:25:01 raspbian CRON[3784]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 03:35:01 raspbian CRON[4811]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 03:40:01 raspbian CRON[5313]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 03:45:01 raspbian CRON[5858]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 03:55:01 raspbian CRON[6922]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 04:00:01 raspbian CRON[7425]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 04:05:01 raspbian CRON[7974]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 04:15:01 raspbian CRON[8973]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 04:17:01 raspbian CRON[9173]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 04:20:01 raspbian CRON[9480]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 04:25:01 raspbian CRON[10021]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 04:35:01 raspbian CRON[11045]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 04:40:02 raspbian CRON[11545]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 04:45:01 raspbian CRON[12093]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 04:55:01 raspbian CRON[13117]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 05:00:01 raspbian CRON[13619]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 05:05:01 raspbian CRON[14155]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 05:15:01 raspbian CRON[15165]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 05:17:01 raspbian CRON[15366]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 05:20:01 raspbian CRON[15672]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 05:25:01 raspbian CRON[16215]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 05:35:01 raspbian CRON[17250]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 05:40:01 raspbian CRON[17746]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 05:45:01 raspbian CRON[18285]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 05:55:01 raspbian CRON[19301]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 06:00:01 raspbian CRON[19800]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 06:05:01 raspbian CRON[22560]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 06:15:01 raspbian CRON[23560]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 06:17:01 raspbian CRON[23760]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 06:20:01 raspbian CRON[24067]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 06:25:01 raspbian CRON[24615]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
Jun 17 06:25:01 raspbian CRON[24616]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 06:25:02 raspbian cracklib: no dictionary update necessary.
Jun 17 06:35:01 raspbian CRON[25732]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 06:40:01 raspbian CRON[26237]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 06:45:01 raspbian CRON[26777]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 06:55:01 raspbian CRON[27789]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 07:00:01 raspbian CRON[28292]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 07:05:01 raspbian CRON[28833]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 06:17:02 raspbian cron[412]: (CRON) INFO (pidfile fd = 3)
Jun 17 06:17:02 raspbian cron[412]: (CRON) INFO (Running @reboot jobs)
Jun 17 06:17:03 raspbian CRON[569]: (root) CMD (mount --bind /configuration /www/wwwroot/orange/mount_disk/)
Jun 17 06:17:03 raspbian CRON[570]: (root) CMD (/configuration/script/ssh_reverse_proxy_daemon.sh)
Jun 17 06:17:03 raspbian CRON[572]: (root) CMD (/configuration/script/ssh_reverse_proxy.sh )
Jun 17 07:56:17 raspbian CRON[5396]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
Jun 17 07:56:17 raspbian cracklib: no dictionary update necessary.
Jun 17 08:00:01 raspbian CRON[7985]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 08:05:01 raspbian CRON[8241]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 08:15:01 raspbian CRON[8717]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 08:17:01 raspbian CRON[8839]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 08:20:01 raspbian CRON[8995]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 08:25:01 raspbian CRON[9252]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 08:35:01 raspbian CRON[9750]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 08:40:01 raspbian CRON[10002]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 08:45:01 raspbian CRON[10263]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 08:55:01 raspbian CRON[10760]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 09:00:01 raspbian CRON[11020]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 09:05:01 raspbian CRON[11280]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 09:15:01 raspbian CRON[11749]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 09:17:01 raspbian CRON[11863]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 09:20:01 raspbian CRON[12055]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 09:25:01 raspbian CRON[12401]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 09:35:01 raspbian CRON[12917]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 09:40:01 raspbian CRON[13202]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 09:45:01 raspbian CRON[13470]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 09:47:36 raspbian cron[409]: (CRON) INFO (pidfile fd = 3)
Jun 17 09:47:36 raspbian cron[409]: (CRON) INFO (Running @reboot jobs)
Jun 17 09:47:37 raspbian CRON[571]: (root) CMD (/configuration/script/ssh_reverse_proxy_daemon.sh)
Jun 17 09:47:37 raspbian CRON[574]: (root) CMD (mount --bind /configuration /www/wwwroot/orange/mount_disk/)
Jun 17 09:47:37 raspbian CRON[575]: (root) CMD (/configuration/script/ssh_reverse_proxy.sh )
Jun 17 09:55:01 raspbian CRON[7749]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 10:00:01 raspbian CRON[8058]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 10:05:01 raspbian CRON[8425]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 10:15:01 raspbian CRON[8920]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 10:17:01 raspbian CRON[9018]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 10:20:01 raspbian CRON[9186]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 10:25:01 raspbian CRON[9438]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 10:35:01 raspbian CRON[9927]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 10:40:01 raspbian CRON[10189]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 10:45:01 raspbian CRON[10449]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 10:55:01 raspbian CRON[10928]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 11:00:01 raspbian CRON[11180]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 11:05:01 raspbian CRON[11439]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 11:15:01 raspbian CRON[12987]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 11:17:01 raspbian CRON[13086]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 11:20:01 raspbian CRON[13246]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 11:25:01 raspbian CRON[13507]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 11:35:01 raspbian CRON[13994]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 11:40:01 raspbian CRON[14264]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 11:45:01 raspbian CRON[14596]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 11:55:01 raspbian CRON[15063]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 12:00:01 raspbian CRON[15319]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 12:05:01 raspbian CRON[15572]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 12:15:01 raspbian CRON[16062]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 12:17:01 raspbian CRON[16156]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 17 12:20:01 raspbian CRON[16328]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 12:25:01 raspbian CRON[16584]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 12:35:01 raspbian CRON[17183]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 17 12:40:01 raspbian CRON[17629]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jun 17 12:43:45 raspbian cron[379]: (CRON) INFO (pidfile fd = 3)
Jun 17 12:43:45 raspbian cron[379]: (CRON) INFO (Running @reboot jobs)
Jun 17 12:43:45 raspbian CRON[518]: (root) CMD (/configuration/script/ssh_reverse_proxy.sh )
Jun 17 12:43:45 raspbian CRON[519]: (root) CMD (/configuration/script/ssh_reverse_proxy_daemon.sh)
Jun 17 12:43:45 raspbian CRON[520]: (root) CMD (mount --bind /configuration /www/wwwroot/orange/mount_disk/) #这是我的一个挂载命令,不构成影响。
Jun 17 12:45:03 raspbian CRON[7329]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)

检查服务器B防火墙

image-20220617125728813

A服务器

image-20220617130523176

B服务器

image-20220617130544082

猜想

1.我的朋友说可能是网络问题,毕竟是国外的服务器,连接过去可能出现丢包。

我的解释是ssh反代基于tcp/ip连接,还是比较可靠的,如果是丢包的话它也会继续发送重连,而且服务器B没有被GFW封杀,我也可以ssh到B服务器上面,理论上我应该是可以反代成功的。

2.我曾经换过内核,令服务器B能够开启bbr极限压缩带宽的使用,我不清楚这个是否构成失败原因。