部署frp
买一台vps
选择腾讯云的轻量的,新用户,一百多一年
部署frps server
vps部署宝塔面板,通过宝塔安装docker(选择腾讯云的宝塔vps就好了,非常方便)
SSH到主机,新建ini文件,放到 /mydocker/frps/frps.ini:/etc/frp/frps.in
## frps.ini
[common]
bind_port = 7100
# 启用面板
dashboard_port = 7101
# 面板登录名和密码
dashboard_user = xxxxx
dashboard_pwd = xxxxxx
# 使用http代理并使用7102端 口进行穿透
vhost_http_port = 7102
# 使用https代理 并使用7103 口进行穿透
vhost_https_port = 7103
# 自己的域名 (根据实际情况 修改)
subdomain_host = xxxxx.sdfsdfsdf.com
# 服务token(根据实际情况修 改),相当于连接密码,建议设置
token = xxxxxxx
docker run --restart=always --network host -d -v /mydocker/frps/frps.ini:/etc/frp/frps.ini --name frps snowdreamtech/frps
部署客户端
github下载frp_0.47.0_windows_amd64
[common]
server_addr = 114.116.xxx.xxx # 为 FRP 服务端的公网 IP
server_port = 7100 # 为 FRP 服务端监听端口 上面配置端口对应
token = xxxxxxx
[vpn_test_tcp]
type = tcp
#local_ip = 127.0.0.1
local_port = 1194
remote_port = 21194
[vpn_test_udp]
type = udp
#local_ip = 127.0.0.1
local_port = 1194
remote_port = 21194
[common]
# server_addr 为 FRP 服务端的公网 IP
server_addr = 1.1.1.1
# server_port 为 FRP 服务端监听的端口
server_port = 7000
运行frpc.exe文件开始连接frps,成功后即可访问
部署systemd自动重启
vim /etc/systemd/system/frpc.service
frpc.service 的内容为
[Unit]
# 服务名称,可自定义
Description = frp client
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
ExecStart = /root/frp/frpc
[Install]
WantedBy = multi-user.target
# 启动frp
systemctl start frps
# 停止frp
systemctl stop frps
# 重启frp
systemctl restart frps
# 查看frp状态
systemctl status frps
# 设置自动启动
systemctl enable frps
部署openvpn
curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
chmod +x openvpn-install.sh
./openvpn-install.sh
其他用到的命令
# 找到frpc进程并杀死
ps -aux|grep frp| grep -v grep
# 查看frpc的状态
systemctl status frpc