一款带Web管理面板的内网穿透工具:lanproxy使用教程

/ 0评 / 0

说明:博主今天找Frp管理面板的时候,无意间发现了lanproxy内网穿透工具,自带Web管理面板,让我们在服务端配置方便了很多,而且一个服务端可以支持多个客户端连接,看起来还不错,这里就分享下。

简介

lanproxy是一个将局域网个人电脑、服务器代理到公网的内网穿透工具,目前仅支持tcp流量转发,可支持任何tcp上层协议,可用作访问内网网站、本地支付接口调试、SSH访问、远程桌面等等,而且带Web在线管理面板,添加端口配置十分简单。

截图

请输入图片描述
请输入图片描述

相关链接

主页地址:https://lanproxy.io2c.com/
Github地址:https://github.com/ffay/lanproxy
发布包下载:https://seafile.io2c.com/d/3b1b44fee5f74992bb17/

服务端安装

服务端需要安装在一个有公网IP的服务器上,系统为Linux/Windows均可。

1、安装JAVA
java版本至少为1.7,查看命令为java -version

2、Linux系统安装
首先下载发布包,服务端发布包下载地址:点击进入

<span class="hljs-comment"><span class="com">#下载最新发布包</span></span>
<span class="hljs-attribute"><span class="pln">wget</span></span> <span class="pun">-</span><span class="pln">O lanproxy</span><span class="pun">-</span><span class="pln">server</span><span class="pun">-</span><span class="hljs-number"><span class="lit">20171116</span></span><span class="lit">.zip</span> <span class="hljs-string"><span class="str">'https://seafile.io2c.com/d/3b1b44fee5f74992bb17/files/?p=/lanproxy-server/lanproxy-server-20171116.zip&dl=1'</span></span>
<span class="hljs-comment"><span class="com">#解压发布包</span></span><span class="pln">
unzip lanproxy</span><span class="pun">-</span><span class="pln">server</span><span class="pun">-</span><span class="hljs-number"><span class="lit">20171116</span></span><span class="lit">.zip</span>

然后编辑配置文件conf/config.properties,参考如下:

<span class="hljs-meta"><span class="com">#</span></span><span class="bash"><span class="com">与在proxy-server配置后台创建客户端时填写的秘钥保持一致;</span></span><span class="pln">
client</span><span class="pun">.</span><span class="pln">key</span><span class="pun">=</span><span class="pln">
ssl</span><span class="pun">.</span><span class="pln">enable</span><span class="pun">=</span><span class="kwd">true</span><span class="pln">
ssl</span><span class="pun">.</span><span class="pln">jksPath</span><span class="pun">=</span><span class="pln">test</span><span class="pun">.</span><span class="pln">jks
ssl</span><span class="pun">.</span><span class="pln">keyStorePassword</span><span class="pun">=</span><span class="lit">123456</span>
<span class="hljs-meta">
<span class="com">#</span></span><span class="bash"><span class="com">这里填写实际的proxy-server地址;没有服务器默认即可,自己有服务器的更换为自己的proxy-server(IP)地址</span></span><span class="pln">
server</span><span class="pun">.</span><span class="pln">host</span><span class="pun">=</span><span class="pln">lp</span><span class="pun">.</span><span class="pln">thingsglobal</span><span class="pun">.</span><span class="pln">org
</span><span class="hljs-meta">
<span class="com">#</span></span><span class="bash"><span class="com">proxy-server ssl默认端口4993,默认普通端口4900</span></span>
<span class="hljs-meta"><span class="com">#</span></span><span class="bash"><span class="com">ssl.enable=</span><span class="hljs-literal"><span class="com">true</span></span><span class="com">时这里填写ssl端口,ssl.enable=</span><span class="hljs-literal"><span class="com">false</span></span><span class="com">时这里填写普通端口</span></span><span class="pln">
server</span><span class="pun">.</span><span class="pln">port</span><span class="pun">=</span><span class="lit">4993</span>

运行lanproxy

<span class="hljs-attribute"><span class="pln">cd</span></span> <span class="pun">/</span><span class="pln">root</span><span class="pun">/</span><span class="pln">proxy</span><span class="pun">-</span><span class="pln">server</span><span class="pun">*</span><span class="str">/bin
chmod +x startup.sh
./</span><span class="pln">startup</span><span class="pun">.</span><span class="pln">sh</span>

然后打开地址http://ip:8090,使用上面配置中配置的用户名密码登录,进入Web管理面板,且配置数据存放在~/.lanproxy/config.json文件中。

<span class="hljs-meta"><span class="com">#</span></span><span class="bash"><span class="com">如果打不开Web界面,就需要开启防火墙,一般CentOS系统出现情况最多</span></span>
<span class="hljs-meta"><span class="com">#</span></span><span class="bash"><span class="com">Centos 6系统</span></span><span class="pln">
iptables </span><span class="pun">-</span><span class="pln">I INPUT </span><span class="pun">-</span><span class="pln">p tcp </span><span class="pun">--</span><span class="pln">dport </span><span class="lit">8090</span> <span class="pun">-</span><span class="pln">j ACCEPT
service iptables save
service iptables restart
</span><span class="hljs-meta">
<span class="com">#</span></span><span class="bash"><span class="com">CentOS 7系统</span></span><span class="pln">
firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">zone</span><span class="pun">=</span><span class="kwd">public</span> <span class="pun">--</span><span class="pln">add</span><span class="pun">-</span><span class="pln">port</span><span class="pun">=</span><span class="lit">8090</span><span class="pun">/</span><span class="pln">tcp </span><span class="pun">--</span><span class="pln">permanent 
firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">reload</span>

3、Windows系统安装
方法参考上面,只是启动的时候双击bin文件夹里的startup.bat即可运行。

客户端使用

客户端一般安装在一个内网的VPS服务器或Windows电脑上使用。这里说下JAVA和非JAVA两个客户端的使用方法,客户端下载地址:点击进入

1、配置服务端
首先我们通过http://ip:8090进入服务端Web管理界面,先添加客户端,名称随便填。
请输入图片描述
然后点击刚刚添加的客户端名称,再添加配置,设置公网端口,后端IP:端口
请输入图片描述
截图的配置意思是将内网的888端口映射到服务器的8080端口,也就是访问服务器ip:8080等于访问内网ip:888

这时候基本配置好了一个客户端节点,且该节点可以供多个客户端使用。

2、JAVA客户端使用
本版本需要安装java,且版本依然至少为1.7,查看命令为java -version

然后进入客户端下载地址,下载lanproxy-java-client.zip,再将文件解压到服务器或者Windows电脑上,编辑conf/config.properties配置文件,修改如下:

<span class="hljs-meta"><span class="com">#</span></span><span class="bash"><span class="com">与在proxy-server配置后台创建客户端时填写的秘钥保持一致;</span></span><span class="pln">
client</span><span class="pun">.</span><span class="pln">key</span><span class="pun">=</span><span class="pln">
ssl</span><span class="pun">.</span><span class="pln">enable</span><span class="pun">=</span><span class="kwd">true</span><span class="pln">
ssl</span><span class="pun">.</span><span class="pln">jksPath</span><span class="pun">=</span><span class="pln">test</span><span class="pun">.</span><span class="pln">jks
ssl</span><span class="pun">.</span><span class="pln">keyStorePassword</span><span class="pun">=</span><span class="lit">123456</span>
<span class="hljs-meta">
<span class="com">#</span></span><span class="bash"><span class="com">这里填写实际的proxy-server地址;没有服务器默认即可,自己有服务器的更换为自己的proxy-server(IP)地址</span></span><span class="pln">
server</span><span class="pun">.</span><span class="pln">host</span><span class="pun">=</span><span class="pln">lp</span><span class="pun">.</span><span class="pln">thingsglobal</span><span class="pun">.</span><span class="pln">org
</span><span class="hljs-meta">
<span class="com">#</span></span><span class="bash"><span class="com">proxy-server ssl默认端口4993,默认普通端口4900</span></span>
<span class="hljs-meta"><span class="com">#</span></span><span class="bash"><span class="com">ssl.enable=</span><span class="hljs-literal"><span class="com">true</span></span><span class="com">时这里填写ssl端口,ssl.enable=</span><span class="hljs-literal"><span class="com">false</span></span><span class="com">时这里填写普通端口</span></span><span class="pln">
server</span><span class="pun">.</span><span class="pln">port</span><span class="pun">=</span><span class="lit">4993</span>

最后运行lanproxy

<span class="com">#运行方法可参考服务端运行步骤</span>
<span class="hljs-selector-tag"><span class="pln">linux</span></span><span class="pun">(</span><span class="hljs-selector-tag"><span class="pln">mac</span></span><span class="pun">)系统:直接进入</span><span class="hljs-selector-tag"><span class="pln">bin</span></span><span class="pun">目录,然后运行</span><span class="hljs-selector-tag"><span class="pln">startup</span></span><span class="hljs-selector-class"><span class="pun">.</span><span class="pln">sh</span></span><span class="pun">脚本</span>
<span class="hljs-selector-tag"><span class="pln">windows</span></span><span class="pun">系统:直接双击</span><span class="hljs-selector-tag"><span class="pln">bin</span></span><span class="pun">目录下的</span><span class="hljs-selector-tag"><span class="pln">startup</span></span><span class="hljs-selector-class"><span class="pun">.</span><span class="pln">bat</span></span>

3、非JAVA客户端使用
该方法可以不用安装java即可在客户端运行lanproxy,首先下载对应版本的JAVA客户端,然后解压出来,再运行以下命令:

<span class="hljs-meta"><span class="com">#以下需要使用的参数是服务端IP,服务端端口,客户端密匙</span></span>
<span class="hljs-number"><span class="lit">1</span></span><span class="pun">、普通端口连接</span>
<span class="hljs-meta"><span class="com">#mac 64位</span></span><span class="pln">
nohup </span><span class="pun">./</span><span class="pln">client_darwin_amd64 </span><span class="pun">-</span><span class="pln">s SERVER_IP </span><span class="pun">-</span><span class="pln">p SERVER_PORT </span><span class="pun">-</span><span class="pln">k </span><span class="hljs-built_in"><span class="pln">CLIENT_KEY</span></span> <span class="pun">&</span>
<span class="hljs-meta"><span class="com">#linux 64位</span></span><span class="pln">
nohup </span><span class="pun">./</span><span class="pln">client_linux_amd64 </span><span class="pun">-</span><span class="pln">s SERVER_IP </span><span class="pun">-</span><span class="pln">p SERVER_PORT </span><span class="pun">-</span><span class="pln">k </span><span class="hljs-built_in"><span class="pln">CLIENT_KEY</span></span> <span class="pun">&</span>
<span class="hljs-meta"><span class="com">#windows 64 位</span></span>
<span class="pun">./</span><span class="pln">client_windows_amd64</span><span class="pun">.</span><span class="pln">exe </span><span class="pun">-</span><span class="pln">s SERVER_IP </span><span class="pun">-</span><span class="pln">p SERVER_PORT </span><span class="pun">-</span><span class="pln">k </span><span class="hljs-built_in"><span class="pln">CLIENT_KEY</span></span>

<span class="hljs-number"><span class="lit">2</span></span><span class="pun">、</span><span class="pln">SSL</span><span class="pun">端口连接</span>
<span class="hljs-meta"><span class="com">#mac 64位</span></span><span class="pln">
nohup </span><span class="pun">./</span><span class="pln">client_darwin_amd64 </span><span class="pun">-</span><span class="pln">s SERVER_IP </span><span class="pun">-</span><span class="pln">p SERVER_SSL_PORT </span><span class="pun">-</span><span class="pln">k </span><span class="hljs-built_in"><span class="pln">CLIENT_KEY</span></span> <span class="pun">-</span><span class="pln">ssl </span><span class="hljs-literal"><span class="kwd">true</span></span> <span class="pun">&</span>
<span class="hljs-meta"><span class="com">#linux 64位</span></span><span class="pln">
nohup </span><span class="pun">./</span><span class="pln">client_linux_amd64 </span><span class="pun">-</span><span class="pln">s SERVER_IP </span><span class="pun">-</span><span class="pln">p SERVER_SSL_PORT </span><span class="pun">-</span><span class="pln">k </span><span class="hljs-built_in"><span class="pln">CLIENT_KEY</span></span> <span class="pun">-</span><span class="pln">ssl </span><span class="hljs-literal"><span class="kwd">true</span></span> <span class="pun">&</span>
<span class="hljs-meta"><span class="com">#windows 64 位</span></span><span class="pln">
client_windows_amd64</span><span class="pun">.</span><span class="pln">exe </span><span class="pun">-</span><span class="pln">s SERVER_IP </span><span class="pun">-</span><span class="pln">p SERVER_SSL_PORT </span><span class="pun">-</span><span class="pln">k </span><span class="hljs-built_in"><span class="pln">CLIENT_KEY</span></span> <span class="pun">-</span><span class="pln">ssl </span><span class="hljs-literal"><span class="kwd">true</span></span>

这里单独说下Windows电脑使用方法,首先按住Win+R,输入cmd进入命令窗口。

<span class="hljs-comment"><span class="com">#如果你将客户端exe文件解压到了D盘的RATS文件夹,则使用命令进入RATS文件夹</span></span>
<span class="hljs-attribute"><span class="pln">cd</span></span> <span class="pun">/</span><span class="pln">d d</span><span class="pun">:</span><span class="pln">\RATS
</span><span class="hljs-comment"><span class="com">#如果你是SSL端口连接,先替换自己的IP,端口,CLIENT_KEY后运行,普通端口命令参考上面</span></span><span class="pln">
client_windows_amd64</span><span class="pun">.</span><span class="pln">exe </span><span class="pun">-</span><span class="pln">s SERVER_IP </span><span class="pun">-</span><span class="pln">p SERVER_SSL_PORT </span><span class="pun">-</span><span class="pln">k CLIENT_KEY </span><span class="pun">-</span><span class="pln">ssl </span><span class="hljs-literal"><span class="kwd">true</span></span>

最后客户端运行后,服务端Web界面的配置状态显示在线即连接成功。
请输入图片描述
如果显示不在线检查下防火墙端口和配置是否正确什么的。

发表评论