[GH-ISSUE #2280] 请问下frp是否可以配置为正向代理来给内网无法上网的设备访问公网? #1811

Closed
opened 2026-05-05 13:10:11 -06:00 by gitea-mirror · 14 comments
Owner

Originally created by @cukewu on GitHub (Mar 7, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2280

image

Originally created by @cukewu on GitHub (Mar 7, 2021). Original GitHub issue: https://github.com/fatedier/frp/issues/2280 ![image](https://user-images.githubusercontent.com/18632013/110242863-e04c9480-7f92-11eb-8781-7d390f11f5ce.png)
gitea-mirror 2026-05-05 13:10:11 -06:00
Author
Owner

@fatedier commented on GitHub (Mar 8, 2021):

https://gofrp.org/docs/reference/client-configures/

可以使用文档里的 http_proxy 参数。

<!-- gh-comment-id:792427793 --> @fatedier commented on GitHub (Mar 8, 2021): https://gofrp.org/docs/reference/client-configures/ 可以使用文档里的 `http_proxy` 参数。
Author
Owner

@ax2009live commented on GitHub (Mar 17, 2021):

http_proxy 实现不了正向代理的功能吧?
http_proxy是给无法连接外网的frpc用的吧?

如果可以实现正向代理翻墙,则不建议开启,原因:一旦开启,离被GFW封杀就不远了;

@cukewu 正向代理的软件很多啊,privoxy就很好,还能广告屏蔽等等很多规则;如果要有用户和密码,则用squid;

<!-- gh-comment-id:800851644 --> @ax2009live commented on GitHub (Mar 17, 2021): http_proxy 实现不了正向代理的功能吧? http_proxy是给无法连接外网的frpc用的吧? 如果可以实现正向代理翻墙,则不建议开启,原因:一旦开启,离被GFW封杀就不远了; @cukewu 正向代理的软件很多啊,privoxy就很好,还能广告屏蔽等等很多规则;如果要有用户和密码,则用squid;
Author
Owner

@ax2009live commented on GitHub (Mar 21, 2021):

今天特意好好仔细测试了一下,可以实现代理功能
http_proxy 工作正常 ;socks5 不带用户认证,工作正常
socks5 带用户认证不能工作,
( 上次测试没成功 )

[http_proxy-1]
type = tcp
remote_port = 6000
plugin = http_proxy
plugin_http_user = user
plugin_http_passwd = password
use_encryption = true
use_compression = true
tls_enable = true

[socks5-v1]
type = tcp
remote_port = 6001
plugin = socks5
use_encryption = true
use_compression = true
tls_enable = true

<!-- gh-comment-id:803579610 --> @ax2009live commented on GitHub (Mar 21, 2021): 今天特意好好仔细测试了一下,可以实现代理功能 http_proxy 工作正常 ;socks5 不带用户认证,工作正常 socks5 带用户认证不能工作, ( 上次测试没成功 ) [http_proxy-1] type = tcp remote_port = 6000 plugin = http_proxy plugin_http_user = user plugin_http_passwd = password use_encryption = true use_compression = true tls_enable = true [socks5-v1] type = tcp remote_port = 6001 plugin = socks5 use_encryption = true use_compression = true tls_enable = true
Author
Owner

@tsinit2001 commented on GitHub (Mar 23, 2021):

今天特意好好仔细测试了一下,可以实现代理功能
http_proxy 工作正常 ;socks5 不带用户认证,工作正常
socks5 带用户认证不能工作,
( 上次测试没成功 )

[http_proxy-1]
type = tcp
remote_port = 6000
plugin = http_proxy
plugin_http_user = user
plugin_http_passwd = password
use_encryption = true
use_compression = true
tls_enable = true

[socks5-v1]
type = tcp
remote_port = 6001
plugin = socks5
use_encryption = true
use_compression = true
tls_enable = true

我是小白,想多向您請教個問題,可不可以反向代理呢?
我在VPS(有公網IP)上運行了服務器端,在家裏的一個玩客雲上(無公網IP),運行了客戶端。
當我不在家裏的時候,依然希望有一個代理,可以讓我以家裏的IP地址,訪問網絡。
這種需求,可以實現麼,如果可以的話,請教一下改如何編寫兩端的ini配置文件?

<!-- gh-comment-id:805233128 --> @tsinit2001 commented on GitHub (Mar 23, 2021): > > > 今天特意好好仔细测试了一下,可以实现代理功能 > http_proxy 工作正常 ;socks5 不带用户认证,工作正常 > socks5 带用户认证不能工作, > ( 上次测试没成功 ) > > [http_proxy-1] > type = tcp > remote_port = 6000 > plugin = http_proxy > plugin_http_user = user > plugin_http_passwd = password > use_encryption = true > use_compression = true > tls_enable = true > > [socks5-v1] > type = tcp > remote_port = 6001 > plugin = socks5 > use_encryption = true > use_compression = true > tls_enable = true 我是小白,想多向您請教個問題,可不可以反向代理呢? 我在VPS(有公網IP)上運行了服務器端,在家裏的一個玩客雲上(無公網IP),運行了客戶端。 當我不在家裏的時候,依然希望有一個代理,可以讓我以家裏的IP地址,訪問網絡。 這種需求,可以實現麼,如果可以的話,請教一下改如何編寫兩端的ini配置文件?
Author
Owner

@ax2009live commented on GitHub (Mar 24, 2021):

不知道我有没有理解错:您是不是想不在家的时候,用家里的IP上网?
如果是,觉得这种用法有点反人类,“遗憾”的是:可以实现;不过上网体验应该是不好的 ( 除非vps的带宽很快 );
您要在家里先架设一个代理:比如用 privoxy 架设代理,端口 8118. 此代理的 ip 192.168.1.10,
frps 不做改动,开通 6000 端口即可;

frpc.ini
[http_proxy-1]
type = tcp
local_ip = 192.168.1.10
local_port = 8118
remote_port = 6000
use_encryption = true
use_compression = true
tls_enable = true

firefox 浏览器,http 代理:VPS-ip 端口:6000
用 vps 端口 6000 做代理,相当于用你内网的 192.168.1.10 端口 8118 作为代理,也就是实现了 “ 您用内网的 IP 上网 " 的需求;

<!-- gh-comment-id:805624058 --> @ax2009live commented on GitHub (Mar 24, 2021): 不知道我有没有理解错:您是不是想不在家的时候,用家里的IP上网? 如果是,觉得这种用法有点反人类,“遗憾”的是:可以实现;不过上网体验应该是不好的 ( 除非vps的带宽很快 ); 您要在家里先架设一个代理:比如用 privoxy 架设代理,端口 8118. 此代理的 ip 192.168.1.10, frps 不做改动,开通 6000 端口即可; frpc.ini [http_proxy-1] type = tcp local_ip = 192.168.1.10 local_port = 8118 remote_port = 6000 use_encryption = true use_compression = true tls_enable = true firefox 浏览器,http 代理:VPS-ip 端口:6000 用 vps 端口 6000 做代理,相当于用你内网的 192.168.1.10 端口 8118 作为代理,也就是实现了 “ 您用内网的 IP 上网 " 的需求;
Author
Owner

@tsinit2001 commented on GitHub (Mar 24, 2021):

不知道我有没有理解错:您是不是想不在家的时候,用家里的IP上网?
如果是,觉得这种用法有点反人类,“遗憾”的是:可以实现;不过上网体验应该是不好的 ( 除非vps的带宽很快 );
您要在家里先架设一个代理:比如用 privoxy 架设代理,端口 8118. 此代理的 ip 192.168.1.10,
frps 不做改动,开通 6000 端口即可;

frpc.ini
[http_proxy-1]
type = tcp
local_ip = 192.168.1.10
local_port = 8118
remote_port = 6000
use_encryption = true
use_compression = true
tls_enable = true

firefox 浏览器,http 代理:VPS-ip 端口:6000
用 vps 端口 6000 做代理,相当于用你内网的 192.168.1.10 端口 8118 作为代理,也就是实现了 “ 您用内网的 IP 上网 " 的需求;

多謝。多謝。還是大佬的這個配置,做得妥當啊。

的確我的需求,挺怪異的。這個想法,最初是來自一個過去的同事的需求。他希望人不在辦公室的時候,依然能夠訪問單位內網,所以就在單位的PC上裝了個虛擬機來跑的。我不需要單位內網,但是當人不在本地的時候,也依然有一些手機上的操作,要以本地IP地址訪問網絡,所以想借鑑一些。

我目前也是用了個差不多的方法。不過,技術侷限,不會安裝privoxy,所以只在玩客雲上docker了一個v2ray。
我家裏的v2,只用了最基礎的tcp協議,沒有任何加密、畢竟不涉及到境外內容,犯不上折騰了。然後吧監聽端口設置爲6001。之後,在手機上,以VPS的IP,配合6002端口,跑同一個配置的小火箭,也能通了。

折騰過不少類似的東西,向日葵啊什麼的,都試了一遍。還是這個感覺配置起來最適合我這種小白。而且,VPS的帶寬有多大,就能享受到多少,真是幸福了。

frpc.ini
[common]
server_addr = VPS的IP地址
server_port = 7000

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

[v2]
type = tcp
local_ip = 127.0.0.1
local_port = 6001
remote_port = 6002

<!-- gh-comment-id:805816204 --> @tsinit2001 commented on GitHub (Mar 24, 2021): > > > 不知道我有没有理解错:您是不是想不在家的时候,用家里的IP上网? > 如果是,觉得这种用法有点反人类,“遗憾”的是:可以实现;不过上网体验应该是不好的 ( 除非vps的带宽很快 ); > 您要在家里先架设一个代理:比如用 privoxy 架设代理,端口 8118. 此代理的 ip 192.168.1.10, > frps 不做改动,开通 6000 端口即可; > > frpc.ini > [http_proxy-1] > type = tcp > local_ip = 192.168.1.10 > local_port = 8118 > remote_port = 6000 > use_encryption = true > use_compression = true > tls_enable = true > > firefox 浏览器,http 代理:VPS-ip 端口:6000 > 用 vps 端口 6000 做代理,相当于用你内网的 192.168.1.10 端口 8118 作为代理,也就是实现了 “ 您用内网的 IP 上网 " 的需求; 多謝。多謝。還是大佬的這個配置,做得妥當啊。 的確我的需求,挺怪異的。這個想法,最初是來自一個過去的同事的需求。他希望人不在辦公室的時候,依然能夠訪問單位內網,所以就在單位的PC上裝了個虛擬機來跑的。我不需要單位內網,但是當人不在本地的時候,也依然有一些手機上的操作,要以本地IP地址訪問網絡,所以想借鑑一些。 我目前也是用了個差不多的方法。不過,技術侷限,不會安裝privoxy,所以只在玩客雲上docker了一個v2ray。 我家裏的v2,只用了最基礎的tcp協議,沒有任何加密、畢竟不涉及到境外內容,犯不上折騰了。然後吧監聽端口設置爲6001。之後,在手機上,以VPS的IP,配合6002端口,跑同一個配置的小火箭,也能通了。 折騰過不少類似的東西,向日葵啊什麼的,都試了一遍。還是這個感覺配置起來最適合我這種小白。而且,VPS的帶寬有多大,就能享受到多少,真是幸福了。 frpc.ini [common] server_addr = VPS的IP地址 server_port = 7000 [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000 [v2] type = tcp local_ip = 127.0.0.1 local_port = 6001 remote_port = 6002
Author
Owner

@zhyi526 commented on GitHub (Mar 29, 2021):

今天特意好好仔细测试了一下,可以实现代理功能
http_proxy 工作正常 ;socks5 不带用户认证,工作正常
socks5 带用户认证不能工作,
( 上次测试没成功 )

[http_proxy-1]
type = tcp
remote_port = 6000
plugin = http_proxy
plugin_http_user = user
plugin_http_passwd = password
use_encryption = true
use_compression = true
tls_enable = true

[socks5-v1]
type = tcp
remote_port = 6001
plugin = socks5
use_encryption = true
use_compression = true
tls_enable = true

socks5要认证可以这样配置的
[http_proxy]
type = tcp
remote_port = 远程端口
plugin = socks5
plugin_user = 用户名
plugin_passwd = 密码

<!-- gh-comment-id:809143219 --> @zhyi526 commented on GitHub (Mar 29, 2021): > 今天特意好好仔细测试了一下,可以实现代理功能 > http_proxy 工作正常 ;socks5 不带用户认证,工作正常 > socks5 带用户认证不能工作, > ( 上次测试没成功 ) > > [http_proxy-1] > type = tcp > remote_port = 6000 > plugin = http_proxy > plugin_http_user = user > plugin_http_passwd = password > use_encryption = true > use_compression = true > tls_enable = true > > [socks5-v1] > type = tcp > remote_port = 6001 > plugin = socks5 > use_encryption = true > use_compression = true > tls_enable = true socks5要认证可以这样配置的 [http_proxy] type = tcp remote_port = 远程端口 plugin = socks5 plugin_user = 用户名 plugin_passwd = 密码
Author
Owner

@ax2009live commented on GitHub (Mar 29, 2021):

@zhyi526 socks5 带用户和密码我没有测试成功,我看了其他 issue 也是说 socks5 加用户和密码不行;
你测试ok了?
我是用 privoxy 把 socks5 转为 http_proxy 代理,可能是 privoxy 新版本对用户认证支持不好,其他方式没有测试,

<!-- gh-comment-id:809198063 --> @ax2009live commented on GitHub (Mar 29, 2021): @zhyi526 socks5 带用户和密码我没有测试成功,我看了其他 issue 也是说 socks5 加用户和密码不行; 你测试ok了? 我是用 privoxy 把 socks5 转为 http_proxy 代理,可能是 privoxy 新版本对用户认证支持不好,其他方式没有测试,
Author
Owner

@tsinit2001 commented on GitHub (May 14, 2021):

不知道我有没有理解错:您是不是想不在家的时候,用家里的IP上网?
如果是,觉得这种用法有点反人类,“遗憾”的是:可以实现;不过上网体验应该是不好的 ( 除非vps的带宽很快 );
您要在家里先架设一个代理:比如用 privoxy 架设代理,端口 8118. 此代理的 ip 192.168.1.10,
frps 不做改动,开通 6000 端口即可;

frpc.ini
[http_proxy-1]
type = tcp
local_ip = 192.168.1.10
local_port = 8118
remote_port = 6000
use_encryption = true
use_compression = true
tls_enable = true

firefox 浏览器,http 代理:VPS-ip 端口:6000
用 vps 端口 6000 做代理,相当于用你内网的 192.168.1.10 端口 8118 作为代理,也就是实现了 “ 您用内网的 IP 上网 " 的需求;

嗯嗯。確實是挺反人類的需求。
目前我也確實是這麼做的。在家裏路由器後面的玩客雲上docker了一個V2RAY,然後frp到VPS上。
速度麼,確實是令人髮指的滿。但好歹能夠使用和家裏的其他設備同一IP訪問網絡了。

就這個問題,我也有問過幾個小夥伴,結果發現如果換成單位的環境,就需求廣泛了。目前他們也都紛紛在單位的PC和服務器上,部署了frp來實現在家裏遠程辦公、打卡。。。嘿嘿。因爲我的勤奮好學,給他們帶來了便利。

<!-- gh-comment-id:841082379 --> @tsinit2001 commented on GitHub (May 14, 2021): > > > 不知道我有没有理解错:您是不是想不在家的时候,用家里的IP上网? > 如果是,觉得这种用法有点反人类,“遗憾”的是:可以实现;不过上网体验应该是不好的 ( 除非vps的带宽很快 ); > 您要在家里先架设一个代理:比如用 privoxy 架设代理,端口 8118. 此代理的 ip 192.168.1.10, > frps 不做改动,开通 6000 端口即可; > > frpc.ini > [http_proxy-1] > type = tcp > local_ip = 192.168.1.10 > local_port = 8118 > remote_port = 6000 > use_encryption = true > use_compression = true > tls_enable = true > > firefox 浏览器,http 代理:VPS-ip 端口:6000 > 用 vps 端口 6000 做代理,相当于用你内网的 192.168.1.10 端口 8118 作为代理,也就是实现了 “ 您用内网的 IP 上网 " 的需求; 嗯嗯。確實是挺反人類的需求。 目前我也確實是這麼做的。在家裏路由器後面的玩客雲上docker了一個V2RAY,然後frp到VPS上。 速度麼,確實是令人髮指的滿。但好歹能夠使用和家裏的其他設備同一IP訪問網絡了。 就這個問題,我也有問過幾個小夥伴,結果發現如果換成單位的環境,就需求廣泛了。目前他們也都紛紛在單位的PC和服務器上,部署了frp來實現在家裏遠程辦公、打卡。。。嘿嘿。因爲我的勤奮好學,給他們帶來了便利。
Author
Owner

@github-actions[bot] commented on GitHub (Jun 29, 2021):

Issues go stale after 45d of inactivity. Stale issues rot after an additional 10d of inactivity and eventually close.

<!-- gh-comment-id:870139235 --> @github-actions[bot] commented on GitHub (Jun 29, 2021): Issues go stale after 45d of inactivity. Stale issues rot after an additional 10d of inactivity and eventually close.
Author
Owner

@tsinit2001 commented on GitHub (Aug 20, 2022):

image

說起來,你在A上,部署個其他什麼代理軟件,比如說v2ray,然後從B向A連,不就可以訪問互聯網了麼。這樣會方便很多啊。而且,基於同內網,效率也更高。

<!-- gh-comment-id:1221226723 --> @tsinit2001 commented on GitHub (Aug 20, 2022): > ![image](https://user-images.githubusercontent.com/18632013/110242863-e04c9480-7f92-11eb-8781-7d390f11f5ce.png) 說起來,你在A上,部署個其他什麼代理軟件,比如說v2ray,然後從B向A連,不就可以訪問互聯網了麼。這樣會方便很多啊。而且,基於同內網,效率也更高。
Author
Owner

@gocpplua commented on GitHub (Oct 12, 2022):

@tsinit2001 @ax2009live 你们好,请问AB上面的配置分别是怎么样的?
我遇到了一个问题,感觉和你们这个类似 #3127

<!-- gh-comment-id:1275527960 --> @gocpplua commented on GitHub (Oct 12, 2022): @tsinit2001 @ax2009live 你们好,请问AB上面的配置分别是怎么样的? 我遇到了一个问题,感觉和你们这个类似 #3127
Author
Owner

@tsinit2001 commented on GitHub (Oct 12, 2022):

如果是圖上所畫的那種網路訪問需求,在A上直接安裝一個任意的代理,都可以讓B通過A的代理,訪問公網,不需要frp。
我使用frp,是爲了當我人不在家的時候,繼續使用家裏的IP地址,訪問互聯網。也可以理解成,人不在公司,卻用公司的內網的意思。和你的需求,並不一致。

<!-- gh-comment-id:1275715870 --> @tsinit2001 commented on GitHub (Oct 12, 2022): > 如果是圖上所畫的那種網路訪問需求,在A上直接安裝一個任意的代理,都可以讓B通過A的代理,訪問公網,不需要frp。 我使用frp,是爲了當我人不在家的時候,繼續使用家裏的IP地址,訪問互聯網。也可以理解成,人不在公司,卻用公司的內網的意思。和你的需求,並不一致。
Author
Owner

@gocpplua commented on GitHub (Oct 21, 2022):

如果是圖上所畫的那種網路訪問需求,在A上直接安裝一個任意的代理,都可以讓B通過A的代理,訪問公網,不需要frp。 我使用frp,是爲了當我人不在家的時候,繼續使用家裏的IP地址,訪問互聯網。也可以理解成,人不在公司,卻用公司的內網的意思。和你的需求,並不一致。

明白

<!-- gh-comment-id:1286841766 --> @gocpplua commented on GitHub (Oct 21, 2022): > > > > 如果是圖上所畫的那種網路訪問需求,在A上直接安裝一個任意的代理,都可以讓B通過A的代理,訪問公網,不需要frp。 我使用frp,是爲了當我人不在家的時候,繼續使用家裏的IP地址,訪問互聯網。也可以理解成,人不在公司,卻用公司的內網的意思。和你的需求,並不一致。 明白
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#1811
No description provided.