OpenWRT固件中集成了NPS内网穿透功能,于是在一台VPS上安装了最新版本0.26.0的NPS,准备在本地WIN10本地和OpenWRT进行调试,都不能调试成功,分别出现如下错误:

OpenWRT下错误:
2020/01/31 13:57:00.809 [I] [npc.go:89]  the version of client is 0.25.1, the core version of client is 0.25.0
2020/01/31 13:57:01.488 [E] [control.go:231]  read tcp 192.168.1.6:56046->107.174.251.xxx:8024: read: connection reset by peer
2020/01/31 13:57:01.488 [E] [client.go:57]  The connection server failed and will be reconnected in five seconds, error read tcp 192.168.1.6:56046->107.174.251.xxx:8024: read: connection reset by peer
2020/01/31 13:57:07.148 [E] [control.go:231]  read tcp 192.168.1.6:56056->107.174.251.xxx:8024: read: connection reset by peer
2020/01/31 13:57:07.149 [E] [client.go:57]  The connection server failed and will be reconnected in five seconds, error read tcp 192.168.1.6:56056->107.174.251.xxx:8024: read: connection reset by peer
2020/01/31 13:57:12.796 [E] [control.go:231]  read tcp 192.168.1.6:56058->107.174.251.xxx:8024: read: connection reset by peer
2020/01/31 13:57:12.796 [E] [client.go:57]  The connection server failed and will be reconnected in five seconds, error read tcp 192.168.1.6:56058->107.174.251.xxx:8024: read: connection reset by peer

WIN10下错误:
2020/01/31 14:00:38.681 [I] [npc.go:173]  the version of client is 0.26.0, the core version of client is 0.26.0
2020/01/31 14:00:38.718 [I] [control.go:97]  Loading configuration file conf/npc.conf successfully
2020/01/31 14:00:39.728 [E] [control.go:111]  dial tcp 127.0.0.1:8024: connectex: No connection could be made because the target machine actively refused it.
2020/01/31 14:00:39.729 [I] [control.go:102]  Reconnecting...
2020/01/31 14:00:45.743 [E] [control.go:111]  dial tcp 127.0.0.1:8024: connectex: No connection could be made because the target machine actively refused it.
2020/01/31 14:00:45.745 [I] [control.go:102]  Reconnecting...

于是决定先解决WIN10下的问题,于是上github作者的issue那里去搜索一下,居然发现不能在PowerShell下运行,要在命令符下运行,于是在命令符下测试一通,成功了。

WIN10搞定了,接下来就是搞OpenWRT,还是在issue中查找,也找到了解决方法,那就是从0.26.0版本开始,NPS需要服务器端和客户端都要是0.26.0版本,否则就会出现连接失败的情况。

赶紧确认一下OpenWRT是什么版本,一看是0.25.1,OpenWRT中就不折腾了,直接将VPS中的NPS降级到0.25,做好相关配置后,再开启服务并确认一下,一切成功,在VPS中看到了客户端已经online。此致NPS内网穿透成功了。