frp 的内网穿透 使用

分类:网络 |

下载与文档地址: 

https://github.com/fatedier/frp


SSH 的穿透: 

Access your computer in a LAN network via SSH
Modify frps.toml on server A by setting the bindPort for frp clients to connect to:
# frps.toml
bindPort = 7000
Start frps on server A:
./frps -c ./frps.toml

Modify frpc.toml on server B and set the serverAddr field to the public IP address of your frps server:
# frpc.toml
serverAddr = "x.x.x.x"
serverPort = 7000

[[proxies]]
name = "ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = 6000



Web 的穿透:  ./frps.toml 文件: 


 bindPort = 8900          # 服务地址
 vhostHTTPPort = 8901     # 需要映射的端口  , 本机localPort对应的服务器端口

./frps -c ./frps.toml


添加服务: /lib/systemd/system/frps.service 
systemctl enable frps

systemctl start frps

systemctl status frps



[Unit]
Description=frps daemon

[Service]
Type=simple
#此处把/root/frp_linux_arm64替换成 frps的实际安装目录
#ExecStart=/srv/frp/frps -c /srv/frp/frps.toml >> /srv/frp/log.log
ExecStart=/srv/frp/frps -c /srv/frp/frps.toml

[Install]
WantedBy=multi-user.target


./frpc -c ./frpc.toml

serverAddr = "xx.116.209.xx"
#serverAddr = "127.0.0.1"
serverPort = 8900    # 服务地址
#serverPort = 7000

[[proxies]]
name = "web"
type = "http"
#localIP = "127.0.0.1"
localPort = 8787   # 将本机的8787端口映射到公网 
customDomains = ["xx.116.209.xx"]
#remotePort = 6000
transport.useCompression = true
locations = ["/"]

#[[proxies]]
#name = "web2"
#type = "http"
#localIP = "127.0.0.1"
#localPort = 2888
#customDomains = ["xx.116.209.xx"]
#locations = ["/pc", "/dev"]