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.32k stars 13.23k forks source link

[Feature Request] Specify source interface for the client #3376

Open alimdi opened 1 year ago

alimdi commented 1 year ago

Describe the feature request

Hi,

Is it possible to specify the source interface to use on the client side ?

Regards,

Describe alternatives you've considered

No response

Affected area

blizard863 commented 1 year ago

Can you describe more detail ? How to specify and why ?

alimdi commented 1 year ago

Hi,

Can you describe more detail ? How to specify and why ?

Sure, I meant is it possible to make the client use a specific network interface when connecting to the server in case of having multiple network interfaces. Hope that makes the request more clear

blizard863 commented 1 year ago

I got it. @alimdi

I think the connect_server_local_ip arg will match your demand ?

https://github.com/fatedier/frp/blob/dev/conf/frpc_full.ini#L104

alimdi commented 1 year ago

That's definetly what I was looking for. Thank you @blizard863

mecorpking commented 1 year ago

@alimdi is this worked for you? i am looking for the same with http_proxy plugin and using the below config [http_proxy] type = tcp connect_server_local_ip = 192.168.10.100 remote_port = 24002 plugin = http_proxy plugin_http_user = plugin_http_passwd =

but it still providing my default network

alimdi commented 1 year ago

@mecorpking It is working but I've defined connect_server_local_ip in [common] scope not in [http_proxy] Give it a shot...

mecorpking commented 1 year ago

@alimdi i tried with that also but received " login to server failed: i/o deadline reached". if possible can you share sample frps.ini and frpc.ini , below is my sample file

server_addr = 1.2.3.4 /sample server_port = 2000 token = 12345678 log_file = ./connection.log protocol = tcp connect_server_local_ip = 192.168.10.100 tcp_mux = true

[http_proxy] type = tcp remote_port = 24003 plugin = http_proxy plugin_http_user = plugin_http_passwd =

alimdi commented 1 year ago

I'm not using http_proxy Have you tried to check if the interface were used with tcpdump ?

mecorpking commented 1 year ago

i think there is some issue with my frps config if you could share, it will help alot

alimdi commented 1 year ago

frpc :

[common]
server_addr = 100.100.100.100
server_port = 7000
log_file = /var/log/frpc.log
log_level = info
log_max_days = 3
disable_log_color = false
authenticate_heartbeats = true
authenticate_new_work_conns = true
token = 123456
authentication_method = token
admin_addr = 127.0.0.1
admin_port = 7400
admin_user = admin
admin_pwd = secure-password
pool_count = 5
login_fail_exit = true
protocol = tcp
connect_server_local_ip = 192.168.1.1
tls_enable = false
udp_packet_size = 1500
disable_custom_tls_first_byte = false
pprof_enable = false
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 2222

frps :

[common]
bind_addr = 100.100.100.100
bind_port = 7000
bind_udp_port = 7001
kcp_bind_port = 7000
dashboard_addr = 100.100.100.100
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = secure-password
dashboard_tls_mode = false
enable_prometheus = true
log_file = /var/log/frps.log
log_level = info
log_max_days = 3
disable_log_color = false
detailed_errors_to_client = true
authentication_method = token
authenticate_heartbeats = true
authenticate_new_work_conns = true
token = 123456
oidc_issuer =
oidc_audience =
oidc_skip_expiry_check = false
oidc_skip_issuer_check = false
allow_ports = 2222
max_pool_count = 5
max_ports_per_client = 0
tls_only = false
udp_packet_size = 1500
pprof_enable = false