fatedier / frp

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Apache License 2.0
85.1k stars 13.21k forks source link

How to run two frpc separately? 如何跑两个frpc #1565

Closed KumaTea closed 4 years ago

KumaTea commented 4 years ago

Version 0.30.0

OS Ubuntu 18.04 LTS x86-64

How to run two frpc (frp client) separately? 如何同时运行两个 frpc 客户端,分别连接不同的 frps 服务端?

问题描述:

有一台境外主机 (F),一台境内主机 (D),均运行 frps 。

在D上,如果希望:

由于目前 frpc 的配置文件内只支持配置一个服务器地址,这种情况有较好的解决方案或开发计划吗?

a0215cpl commented 4 years ago

用docker来实现,开两个镜像,分别来连接不同的frps。

xqzr commented 4 years ago

./frpc -c ./frpc1.ini ./frpc -c ./frpc2.ini ./frpc -c ./frpc3.ini ...

KumaTea commented 4 years ago

如果 frpc 原生支持多开的话,就不使用Docker了。晚点试下。。。

qins commented 3 years ago

@KumaTea 请问下原生多开服务端找到了吗?

KumaTea commented 3 years ago

@KumaTea 请问下原声多开服务端找到了吗?

@qins 我当时是这么解决的:

./frpc -c ./d.ini > d.log &
./frpc -c ./f.ini > f.log &

为了确保安全,设置了不同端口;后来也使用 screen 以避免产生 log 文件。

但是后来因为服务不多,就不再使用 frp 了,不清楚现在是否仍然可用。

qins commented 3 years ago

@KumaTea Thanks 😊 国内云没有备案不让用80端口, 国外VPS的话网络不稳. 目前一直在寻找两全其美的办法

revegnay commented 3 years ago

`➜ frp ll total 8.0K -rw-r--r-- 1 root root 687 Mar 2 10:36 frpc_ali.ini -rw-r--r-- 1 root root 1.2K Mar 2 10:37 frpc_aws.ini ➜ frp pwd
/etc/frp ➜ frp cat /etc/systemd/system/frpc@.service [Unit] Description=Frp Client Service After=network.target

[Service] Type=idle User=nobody Restart=on-failure RestartSec=5s ExecStart=/usr/bin/frpc -c /etc/frp/%i.ini ExecReload=/usr/bin/frpc reload -c /etc/frp/%i.ini

[Install] WantedBy=multi-user.target ➜ frp systemctl enable --now frpc@frpc_ali ➜ frp systemctl enable --now frpc@frpc_aws ➜ ~ ps -aux | grep frpc nobody 79012 0.1 0.0 713712 8908 ? Ssl 10:48 0:00 /usr/bin/frpc -c /etc/frp/frpc_ali.ini nobody 79100 0.1 0.0 712048 8184 ? Ssl 10:48 0:00 /usr/bin/frpc -c /etc/frp/frpc_aws.ini

` 分别指定配置文件就可以了 遇到同样问题,寻遍google未解。 看到包里的frpc@.service,我陷入了深思,然后就发现了这个用法

code-wangshuyi commented 3 years ago

`➜ frp ll total 8.0K -rw-r--r-- 1 root root 687 Mar 2 10:36 frpc_ali.ini -rw-r--r-- 1 root root 1.2K Mar 2 10:37 frpc_aws.ini ➜ frp pwd /etc/frp ➜ frp cat /etc/systemd/system/frpc@.service [Unit] Description=Frp Client Service After=network.target

[Service] Type=idle User=nobody Restart=on-failure RestartSec=5s ExecStart=/usr/bin/frpc -c /etc/frp/%i.ini ExecReload=/usr/bin/frpc reload -c /etc/frp/%i.ini

[Install] WantedBy=multi-user.target ➜ frp systemctl enable --now frpc@frpc_ali ➜ frp systemctl enable --now frpc@frpc_aws ➜ ~ ps -aux | grep frpc nobody 79012 0.1 0.0 713712 8908 ? Ssl 10:48 0:00 /usr/bin/frpc -c /etc/frp/frpc_ali.ini nobody 79100 0.1 0.0 712048 8184 ? Ssl 10:48 0:00 /usr/bin/frpc -c /etc/frp/frpc_aws.ini

` 分别指定配置文件就可以了 遇到同样问题,寻遍google未解。 看到包里的frpc@.service,我陷入了深思,然后就发现了这个用法

强强强