使用Frp的服务端和客户端进行内网穿透
vi /srv/frp/frps.ini #服务端-配置
[common]
token = hCbXi6eV8zLxIdF5
bind_port = 10000
vhost_http_port = 10080
# dashboard_user = dash
# dashboard_pwd = board
# dashboard_port = 10443
vi /opt/frp/frpc.ini #客户端-配置
[common]
token = hCbXi6eV8zLxIdF5
server_addr = over.sea.ip.addr
server_port = 10000
[ssh]
type = tcp
local_ip = 10.0.0.1
local_port = 22
remote_port = 10022
[web]
type = http
local_port = 80
custom_domains = www.j2frp.com
# [ftp]
# type = tcp
# local_ip = 10.0.0.1
# local_port = 21
# remote_port = 10021
# [ftp_data]
# type = tcp
# local_ip = 10.0.0.1
# local_port = 10020
# remote_port = 10020
vi /etc/init.d/frpc #客户端-守护服务
#!/bin/sh /etc/rc.common
START=90
STOP=90
SERVICE=frpc
USE_PROCD=1
PROC="/opt/frp/frpc -c /opt/frp/frpc.ini"
start_service()
{
procd_open_instance
procd_set_param command $PROC
procd_set_param respawn
procd_close_instance
}
service_triggers()
{
procd_add_reload_trigger "rpcd"
}
vi /usr/lib/systemd/system/frps.service #服务端-守护服务
[Unit]
Description=Frp Server Service
After=network.target
[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/srv/frp/frps -c /srv/frp/frps.ini
[Install]
WantedBy=multi-user.target
附注,如果需要启用FTP功能,请注意FTP配置PASV被动模式:
pasv_enable=YES pasv_min_port=10020 pasv_max_port=10020