参考链接https://www.jianshu.com/p/a6e9627dbe29
- 阿里云ip-a作为公网ip
- https://github.com/fatedier/frp/releases下载linux文件至阿里云服务器
- 修改frps.ini内容
- [common]
- bind_port=7000
- 启动服务端,进入解压的frp目录,运行
./frps -c frps.ini
- 让服务端后台自动运行:
vi /lib/systemd/system/frps.service
- [Unit]
- Description=frps service
- After=network.target syslog.target
- Wants=network.target
- [Service]
- Type=simple
- ExecStart=/path/frps -c /path/frps.ini
- [Install]
- WantedBy=multi-user.target
- 启动frps:
systemctl start frps
- 自启动frps:
systemctl enable frps
- 重启:
systemctl restart frps
- 停止:
systemctl stop frps
- 查看日志:
systemctl status frps
- 下载windows客户端frp文件(要被远程连接的电脑)
- 编辑frpc.ini文件:
- [common]
- server_addr = 阿里云ip-a
- server_port = 7000 #跟服务器bind_port一致
- [RDP]
- type = tcp
- local_ip = 0.0.0.0
- local_port = 3389#本地远程端口
- remote_port = 1234#远程连接时的端口
- 命令行启动frpc.exe
- windows下自动运行frpc,编辑一个vbs文件:
- set ws=WScript.CreateObject("WScript.Shell")
- ws.Run "c:\path\frpc.exe -c c:\path\frpc.ini",0
- 将vbs文件复制到C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp中以开机自启动
- 如果是http访问,配置如下:
- [web]
- type=http
- local_ip=0.0.0.0
- local_port=3000
- custom_domains=绑定到公网的域名
- 输入域名:8080访问
-
- stcp访问:A访问B,在B上frpc.ini添加如下配置,在A上frpc.ini添加如下配置,在A上访问的时候访问:127.0.0.1:6000
- [B]
- type = stcp
- sk=123
- local_ip = 127.0.0.1
- local_port = 22
- [A]
- type=stcp
- role=visitor
- server_name=B
- sk=123
- bind_addr=127.0.0.1
- bind_port=6000
- <br><br><br>