使用 FRP 内网穿透| 适用于Linux Windows服务端


使用 FRP 内网穿透| 适用于Linux Windows服务端
1、很多情况下处于NAT网络环境中没有公网IP,这个时候可疑通过FRP服务器的转发进行内网穿透。frp内网穿透服务器搭建和frp使用方法。
本教程是使用TCP模式(连接内网Windows的远程桌面),frp客户端和frp服务端以Windows服务的方式在后台默默运行,还可以使用UDP、HTTP、HTTPS模式。
2、为什么不再使用ngork
ngork2.0不再开源

3、Linux服务端安装
wget --no-check-certificate https://raw.githubusercontent.com/clangcn/onekey-install-shell/master/frps/install-frps.sh -O ./install-frps.sh
chmod 700 ./install-frps.sh
./install-frps.sh install
或者手动安装
https://github.com/fatedier/frp/releases/download/v0.13.0/frp_0.13.0_linux_amd64.tar.gz

4、Windows服务端安装
https://github.com/fatedier/frp/releases
https://github.com/fatedier/frp/releases/download/v0.13.0/frp_0.13.0_windows_amd64.zip

5、frp服务端配置文件,基本包含frps_full.ini全部的配置了
frps.ini
---------------------------------------------------------------------------------------------------
[common]
bind_addr = 0.0.0.0
bind_port = 5443
# udp port used for kcp protocol, it can be same with 'bind_port'
# if not set, kcp is disabled in frps
kcp_bind_port = 5443
dashboard_port = 6443
dashboard_user = 用户
dashboard_pwd = 密码
# assets_dir = ./static
vhost_http_port = 8080
vhost_https_port = 4443
log_file = ./frps.log
# debug, info, warn, error
log_level = info
log_max_days = 30
# privilege mode is the only supported mode since v0.10.0
privilege_token = hLzzySjVo1kMJgaz
# only allow frpc to bind ports you list, if you set nothing, there won't be any limit
#privilege_allow_ports = 1-65535
# pool_count in each proxy will change to max_pool_count if they exceed the maximum value
max_pool_count = 50
# if tcp stream multiplexing is used, default is true
tcp_mux = true
authentication_timeout = 900
subdomain_host = frp.asuhu.com
-------------------
Windows 启动服务器
frps.exe -c frps.ini

linux 启动服务器
frps -c frps.ini

vi /etc/rc.d/rc.local #centos7 chmod +x /etc/rc.d/rc.local
su - root -c "/root/frp/frps -c frps.ini"
---------------------------------------------------------------------------------------------------
6、客户端配置文件tcp_model
frps.ini
----------
[common]
server_addr = 122.114.xx.xx
server_port = 5443
log_file = ./frpc.log
log_level = info
log_max_days = 30
privilege_token = hLzzySjVo1kMJgaz
pool_count = 50
tcp_mux = true
user = 用户
login_fail_exit = true
protocol = tcp
[tcp_mode]
privilege_mode = true
type = tcp
local_ip = 127.0.0.1
local_port = 3389
remote_port = 23689
--------------
客户端配置文件http_model
[common]
server_addr = 122.114.xx.xx
server_port = 5443
log_file = ./frpc.log
log_level = info
log_max_days = 30
privilege_token = hLzzySjVo1kMJgaz
pool_count = 50
tcp_mux = true
user = 用户
login_fail_exit = true
protocol = http
[web]
type = http
local_ip = 127.0.0.1
local_port = 80
use_encryption = false
use_compression = false
subdomain = frp.asuhu.com
custom_domains = frp2.asuhu.com
-------------------
启动客户端
frpc.exe -c frpc.ini
---------------------------------------------------------------------------------------------------
7、Windows快速添加通过防火墙规则
netsh advfirewall firewall add rule name="Open Port 5443" dir=in action=allow protocol=TCP localport=5443
netsh advfirewall firewall add rule name="Open Port 5443" dir=in action=allow protocol=TCP localport=6443
netsh advfirewall firewall add rule name="Open Port 4443" dir=in action=allow protocol=TCP localport=4443
netsh advfirewall firewall add rule name="Open Port 23689" dir=in action=allow protocol=TCP localport=23689
netsh advfirewall firewall add rule name="Open Port 8080" dir=in action=allow protocol=TCP localport=8080
---------------------------------------------------------------------------------------------------
8、Windows 设置后台运行
创建一个frpc.cmd
frpc.cmd
cd \
cd frp
frpc.exe -c frpc.ini

创建一个frpc.vbs,用于在后台执行frpc
frpc.vbs
Set ws = CreateObject("Wscript.Shell")
ws.run "cmd /c frpc",vbhide

frpc客户端 frps服务端 创建步骤一样
这样能开机后台运行
---------------------------------------------------------------------------------------------------
9、Windows 设置开机启动
运行框输入下面代码,添加启动项
%programdata%\Microsoft\Windows\Start Menu\Programs\Startup
---------------------------------------------------------------------------------------------------
10、验证登录远程桌面122.114.xx.xx:23689
---------------------------------------------------------------------------------------------------
11、frp面板http://122.114.xx.xx:6443/static/

--------------------------------------------------------------------------------------------------------

12. 找到一个python3的同样工具: https://github.com/mxdg/passbytcp

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在两个Linux系统上使用frp进行内网穿透,需要准备一台公网服务器、内网客户端和服务端,然后按照以下步骤进行安装和配置。 1. 在公网服务器上下载并解压frp压缩包。可以从官方网站或其他可信来源下载适用Linux系统的frp压缩包。解压缩后,你将得到frps和frpc两个可执行文件。这两个文件分别用于服务端和客户端。 2. 在公网服务器上配置frps服务端。编辑frps.ini配置文件,设置监听的端口和其他相关参数,例如token和log_file等。确保配置文件中的部分与你的需求相匹配。 3. 在内网客户端上下载并解压frp压缩包。同样地,你可以从官方网站或其他可信来源下载适用Linux系统的frp压缩包。解压缩后,你将得到frpc可执行文件。 4. 在内网客户端上配置frpc客户端。编辑frpc.ini配置文件,设置通信方式、服务器地址和端口等参数。确保配置文件中的部分与你的需求相匹配。 5. 在公网服务器上启动frps服务端使用命令行运行以下命令来启动frps: ``` ./frps -c frps.ini ``` 6. 在内网客户端上启动frpc客户端。使用命令行运行以下命令来启动frpc: ``` ./frpc -c frpc.ini ``` 通过以上步骤,你就可以在两个Linux系统上使用frp进行内网穿透了。确保公网服务器与内网客户端都正常运行,并且配置文件中的参数正确设置。这样,你就可以通过frp实现公网服务器和内网客户端之间的网络穿透连接。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [内网穿透工具frp_0.41.0_Linux+Windows的amd64](https://download.csdn.net/download/object_admin/85170961)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [frp实现内网穿透Linux->Linux(详细)](https://blog.csdn.net/weixin_49764009/article/details/122018688)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值