Chion82 / kcptun-raw

Kcptun with raw socket and fake TCP headers.
GNU General Public License v3.0
416 stars 101 forks source link

似乎端口被封了 #5

Closed ChapterEstatic closed 7 years ago

ChapterEstatic commented 7 years ago

昨天编译了最新版,按教程配置,参数没有加--noseq,用了几个小时体验良好,然后突然断开了连接 client日志 186226 [2017-02-07 15:47:34] recv ends. conv=1317 186227 [2017-02-07 15:47:34] Closing connection. conv=1317 186228 [2017-02-07 15:47:34] Notifying remote closing. conv=1317 186229 [2017-02-07 15:47:34] recv ends. conv=1318 186230 [2017-02-07 15:47:34] Closing connection. conv=1318 186231 [2017-02-07 15:47:34] Notifying remote closing. conv=1318 186232 [2017-02-07 15:47:34] recv ends. conv=1319 186233 [2017-02-07 15:47:34] Closing connection. conv=1319 186234 [2017-02-07 15:47:34] Notifying remote closing. conv=1319 186235 [2017-02-07 15:47:34] recv ends. conv=1320 186236 [2017-02-07 15:47:34] Closing connection. conv=1320 186237 [2017-02-07 15:47:34] Notifying remote closing. conv=1320 186238 [2017-02-07 15:47:34] recv ends. conv=1321 186239 [2017-02-07 15:47:34] Closing connection. conv=1321 186240 [2017-02-07 15:47:34] Notifying remote closing. conv=1321 186241 [2017-02-07 15:49:03] fast2 mode enabled. 186242 [2017-02-07 15:49:03] Re-init fake TCP connection. 186243 [2017-02-07 15:49:03] Trying port 38363 186244 [2017-02-07 15:49:03] [trans_packet]Client sending SYN. 186245 [2017-02-07 15:49:03] [trans_packet]Client replying ACK. 186246 [2017-02-07 15:49:04] Request kcp init 186247 [2017-02-07 15:49:04] kcp ready. 186248 [2017-02-07 16:02:22] fast2 mode enabled. 186249 [2017-02-07 16:02:22] Re-init fake TCP connection. 186250 [2017-02-07 16:02:22] Trying port 31459 186251 [2017-02-07 16:02:22] [trans_packet]Client sending SYN. 186252 [2017-02-07 16:02:22] [trans_packet]Client replying ACK. 186253 [2017-02-07 16:02:23] Request kcp init 186254 [2017-02-07 16:02:23] kcp ready. 186255 [2017-02-07 16:07:38] fast2 mode enabled. 186256 [2017-02-07 16:07:38] Re-init fake TCP connection. 186257 [2017-02-07 16:07:38] Trying port 37698 186258 [2017-02-07 16:07:38] [trans_packet]Client sending SYN. 186259 [2017-02-07 16:07:38] [trans_packet]Client replying ACK. 186260 [2017-02-07 16:07:39] Request kcp init 186261 [2017-02-07 16:07:39] kcp ready. 186262 [2017-02-08 15:10:04] fast2 mode enabled. 186263 [2017-02-08 15:10:04] Disable TCP sequense counter. 186264 [2017-02-08 15:10:05] fast2 mode enabled. 186265 [2017-02-08 15:10:05] Disable TCP sequense counter. 186266 [2017-02-08 15:10:07] fast2 mode enabled. 186267 [2017-02-08 15:10:07] Disable TCP sequense counter. 186268 [2017-02-08 15:10:10] fast2 mode enabled. 186269 [2017-02-08 15:10:10] Disable TCP sequense counter.

server对应时间日志(没管时差) [2017-02-07 02:47:34] Closing connection. conv=1316 [2017-02-07 02:47:34] Remote notifies closing. conv=1317 [2017-02-07 02:47:34] Closing connection. conv=1317 [2017-02-07 02:47:34] Remote notifies closing. conv=1318 [2017-02-07 02:47:34] Closing connection. conv=1318 [2017-02-07 02:47:34] Remote notifies closing. conv=1319 [2017-02-07 02:47:34] Closing connection. conv=1319 [2017-02-07 02:47:34] Remote notifies closing. conv=1320 [2017-02-07 02:47:34] Closing connection. conv=1320 [2017-02-07 02:47:34] Remote notifies closing. conv=1321 [2017-02-07 02:47:34] Closing connection. conv=1321 [2017-02-07 02:49:03] [trans_packet]Server replying SYN+ACK. [2017-02-07 02:49:04] Remote notifies re-init KCP connection. [2017-02-07 03:00:15] fast2 mode enabled. [2017-02-07 03:02:22] [trans_packet]Server replying SYN+ACK. [2017-02-07 03:02:23] Remote notifies re-init KCP connection. [2017-02-07 03:07:37] fast2 mode enabled. [2017-02-07 03:07:37] Disable TCP sequense counter. [2017-02-07 03:07:38] [trans_packet]Server replying SYN+ACK. [2017-02-07 03:07:39] Remote notifies re-init KCP connection. [2017-02-07 03:20:20] fast2 mode enabled. [2017-02-07 03:20:20] Disable TCP sequense counter. [2017-02-07 03:32:32] fast2 mode enabled.

另外看了下在用的时间里server日志有大量连续(client日志对应有连续的notifying remote new connection) [2017-02-06 22:40:17] Remote notifies new connection. conv=1438 [2017-02-06 22:40:18] Remote notifies new connection. conv=1439 [2017-02-06 22:40:18] Remote notifies new connection. conv=1440 [2017-02-06 22:40:18] Remote notifies new connection. conv=1441 [2017-02-06 22:40:18] Remote notifies new connection. conv=1442 [2017-02-06 22:40:18] Remote notifies new connection. conv=1443 [2017-02-06 22:40:18] Remote notifies new connection. conv=1444 [2017-02-06 22:40:18] Remote notifies new connection. conv=1445 [2017-02-06 22:40:19] Remote notifies new connection. conv=1446 [2017-02-06 22:40:19] Remote notifies new connection. conv=1447 [2017-02-06 22:40:19] Remote notifies new connection. conv=1448 [2017-02-06 22:40:34] Remote notifies new connection. conv=1449 [2017-02-06 22:40:48] Remote notifies new connection. conv=1452

47分似乎还正常传输,49分开始client和server就重复出现那几行了,尝试加上--noseq参数也连不上,kcptun-raw使用的端口换成kcptun用也连不上,似乎端口直接被封了?我看浏览器相当快就connection refused连dns解析都没有,现在换了个端口能用(之前和现在都不是443端口),加上--noseq在试会不会再发生

ChapterEstatic commented 7 years ago

研究的有点懵,不知道是不是本地的问题,这边是openwrt的路由器上ss-local+dns2sock+pdnsd连接server的ss端口解析域名,ss-redir指向client的kcptun-raw来连接server的kcptun-raw端口

Chion82 commented 7 years ago

有些恶心的ISP还确实会封端口,kcptun的issue里有人提到过,用443或者80吧。如果一开始不加--noseq能用的话后面就尽量不要加--noseq(这个参数会使TCP头变得看上去不太“真实”,可能会被QoS) Remote notifies new connectionnotifying remote new connection这两个LOG是正常的,只要你的浏览器发起新的TCP连接就会有提示。

ChapterEstatic commented 7 years ago

看看再封就换吧。。真是给isp跪了用kcptun不会封端口但会断流。。kcptun-raw用了几个钟都没事然而一断就是直接封端口。。

Chion82 commented 7 years ago

ss有时候也会出现拒绝请求的情况,还不确定是kcptun-raw断了还是ss断了,如果下次断了的话,可以什么也不做先等几分钟试试,或许可以自己恢复的。

Chion82 commented 7 years ago

如果是kcptun-raw断了,客户端会一直刷大量的Re-init fake TCP connection.Re-init kcp connection,请注意观察LOG。

ChapterEstatic commented 7 years ago

client我重启了三次进程(三、四次吧),我看日志就有三次Re-init fake TCP connection并没有大量,F5刷新浏览器也没有新日志,这样的话好像是本地dns解析就有问题了,不过这在使用kcptun时没出现过,我看看ss-local输出个日志看看

Chion82 commented 7 years ago

是的,客户端输出kcp ready的时候双方已经握手成功了。那kcptun-raw应该是没有断的,端口应该也是没有封,dns挂了的话就检查下pdnsd的日志?另外ss-redir应该是同时建立TCP和UDP连接的,不知道你怎么设置的,但是kcptun和kcptun-raw在两端都只提供TCP隧道。

ChapterEstatic commented 7 years ago

我现在用之前的端口依然是连不上的,如果跟本地配置有关为什么换个端口会能用这很奇怪,我先搞搞输出日志,再用之前的端口连看看什么情况,感谢作者!

Chion82 commented 7 years ago

换成443能稳定使用了吗?

ChapterEstatic commented 7 years ago

没有发现什么问题,换了另一个非443端口至今没断