欢迎来到好人卡资源网,专注网络技术资源收集,我们不仅是网络资源的搬运工,也生产原创资源。寻找资源请留言

搭建属于自己的内网穿透教程服务

linux sky995 2年前 (2020-06-29) 695次浏览 0个评论

内网穿透对于很多人来说,都是必不可少的,他可以让你在家访问公司电脑,或者在公司取家里电脑上的文件,简直是灰常方便有木有。国内的内网穿透服务大部分都是收费的,要么就是带宽很小卡顿感很严重。

前言

之前小编搭建的nps,也是github 获赞最多的开源内网穿有服务程序,采用Go语言开发,搭建非常简单,但是我测试有一个严重的问题:时间长了总是休眠断链。于是就放弃了。

本次我推荐的是一款采用java开发:lanproxy,同样是开源的内网穿透程序,经过一个月的测试,稳定性相当好,个人测试只要网络环境正常从来没有断过。本次我就教大家如何使用自己的vps搭建内网穿透服务。

下载编译包

GitHub下载编译包(服务端和客户端):博主使用的是Linux CentOS服务端Windows客户端,下载对应的程序:

搭建属于自己的内网穿透教程服务

部署服务端

下载完成后,将proxy-server-0.1.zip解压然后找到proxy-server-0.1\conf\下的config.properties,使用编辑器打开修改配置

<code class=" language-properties"><span class="token attr-name"><span class="pln">server</span><span class="pun">.</span><span class="pln">bind</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="lit">0.0</span><span class="pun">.</span><span class="lit">0.0</span></span>

<span class="token comment"><span class="com">#与代理客户端通信端口</span></span>
<span class="token comment"><span class="com">#这个端口是指客户端连接时对应的端口</span></span>
<span class="token attr-name"><span class="pln">server</span><span class="pun">.</span><span class="pln">port</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="lit">4900</span></span>

<span class="token comment"><span class="com">#ssl相关配置</span></span>
<span class="token attr-name"><span class="pln">server</span><span class="pun">.</span><span class="pln">ssl</span><span class="pun">.</span><span class="pln">enable</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="kwd">false</span></span>
<span class="token attr-name"><span class="pln">server</span><span class="pun">.</span><span class="pln">ssl</span><span class="pun">.</span><span class="pln">bind</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="lit">0.0</span><span class="pun">.</span><span class="lit">0.0</span></span>
<span class="token attr-name"><span class="pln">server</span><span class="pun">.</span><span class="pln">ssl</span><span class="pun">.</span><span class="pln">port</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="lit">4993</span></span>
<span class="token attr-name"><span class="pln">server</span><span class="pun">.</span><span class="pln">ssl</span><span class="pun">.</span><span class="pln">jksPath</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="pln">test</span><span class="pun">.</span><span class="pln">jks</span></span>
<span class="token attr-name"><span class="pln">server</span><span class="pun">.</span><span class="pln">ssl</span><span class="pun">.</span><span class="pln">keyStorePassword</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="lit">123456</span></span>
<span class="token attr-name"><span class="pln">server</span><span class="pun">.</span><span class="pln">ssl</span><span class="pun">.</span><span class="pln">keyManagerPassword</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="lit">123456</span></span>

<span class="token comment"><span class="com">#这个配置可以忽略</span></span>
<span class="token attr-name"><span class="pln">server</span><span class="pun">.</span><span class="pln">ssl</span><span class="pun">.</span><span class="pln">needsClientAuth</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="kwd">false</span></span>

<span class="token comment"><span class="com">#WEB在线配置管理相关信息</span></span>
<span class="token comment"><span class="com">#服务端ip地址一般不用修改默认就好</span></span>
<span class="token attr-name"><span class="pln">config</span><span class="pun">.</span><span class="pln">server</span><span class="pun">.</span><span class="pln">bind</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="lit">0.0</span><span class="pun">.</span><span class="lit">0.0</span></span>
<span class="token comment"><span class="com">#后台控制面板端口(如果有防火墙,请放行)</span></span>
<span class="token attr-name"><span class="pln">config</span><span class="pun">.</span><span class="pln">server</span><span class="pun">.</span><span class="pln">port</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="lit">8090</span></span>
<span class="token comment"><span class="com">#后台控制面板账号密码</span></span>
<span class="token attr-name"><span class="pln">config</span><span class="pun">.</span><span class="pln">admin</span><span class="pun">.</span><span class="pln">username</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="pln">admin</span></span>
<span class="token attr-name"><span class="pln">config</span><span class="pun">.</span><span class="pln">admin</span><span class="pun">.</span><span class="pln">password</span></span><span class="token punctuation"><span class="pun">=</span></span><span class="token attr-value"><span class="pln">admin</span></span></code>

修改完后吧解压的程序上传到你的服务器上任意目录,如/data,把程序和子目录都给777权限

然后使用命令行进入你上传程序目录下的/bin执行startup.sh启动服务

<code class=" language-shell"><span class="pun">[</span><span class="pln">root@10</span><span class="pun">-</span><span class="lit">9</span><span class="pun">-</span><span class="lit">50</span><span class="pun">-</span><span class="lit">195</span><span class="pln"> bin</span><span class="pun">]</span><span class="com"># cd /data/proxy-server-0.1/bin</span>

<span class="pun">[</span><span class="pln">root@10</span><span class="pun">-</span><span class="lit">9</span><span class="pun">-</span><span class="lit">50</span><span class="pun">-</span><span class="lit">195</span><span class="pln"> bin</span><span class="pun">]</span><span class="com"># ./startup.sh</span>
<span class="typ">Starting</span><span class="pln"> the proxy server </span><span class="pun">...</span><span class="pln">started
PID</span><span class="pun">:</span> <span class="lit">13314</span>
<span class="pun">[</span><span class="pln">root@10</span><span class="pun">-</span><span class="lit">9</span><span class="pun">-</span><span class="lit">50</span><span class="pun">-</span><span class="lit">195</span><span class="pln"> bin</span><span class="pun">]</span><span class="com"># </span></code>

如上代码,服务端就算搭建成功了,打开地址 http://ip:8090进入控制台(这里的8090是你刚才设置的控制面板端口) 。

搭建属于自己的内网穿透教程服务

服务端配置

登录后台添加你的客户端:

搭建属于自己的内网穿透教程服务

然后在配置管理就会出现你添加的客户端,对你的客户端添加配置,服务端的配置就算完成了。

搭建属于自己的内网穿透教程服务

客户端链接

这里举个例子:比如我想用A电脑访问B电脑的文件

B电脑上解压刚才下载的客户端文件lanproxy-client-windows-amd64-20190523.tar,解压后会看到有一个client_windows_amd64.exe文件。接下来打开cdm进入你解压的client_windows_amd64.exe目录执行如下命令:

<code class=" language-shell"><span class="pln">client_windows_amd64</span><span class="pun">.</span><span class="pln">exe </span><span class="pun">-</span><span class="pln">s </span><span class="lit">123.123</span><span class="pun">.</span><span class="lit">66.666</span> <span class="pun">-</span><span class="pln">p </span><span class="lit">4900</span> <span class="pun">-</span><span class="pln">k e05f2ce5737644bc959f017a6bacf851</span></code>

说明:

  • 123.123.66.666是你服务端的IP
  • 4900是你配置文件的与代理客户端通信端口
  • e05f2ce5737644bc959f017a6bacf851是你在控制台创建客户端时的密码

搭建属于自己的内网穿透教程服务

如上图,代表映射成功。然后去我们的控制台看一下我们刚才添加的客户端,已经显示在线了。

搭建属于自己的内网穿透教程服务

这样,我们就可以直接使用B电脑访问你服务端ip:你设定的端口就可以访问A电脑了


好人卡资源网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:搭建属于自己的内网穿透教程服务
喜欢 (3)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址