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
87.11k stars 13.43k forks source link

Not binding to IPv4 Interface #4459

Closed rcarlet closed 1 month ago

rcarlet commented 2 months ago

Bug Description

Hello,

I currently have the following frps.toml

bindPort = 7000
bindAddr = "0.0.0.0"

But after running the server (./frps -c ./frps.toml) it binds to the IPv6 interface:

$ netstat  -tnlp
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::7000                 :::*                    LISTEN      6155/./frps         
tcp6       0      0 :::111                  :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -      

When trying directly from the command line (./frps -p 7000), it binds only via IPv6. I found no way to force only IPv4, besides the binding Address, which is not followed.

frpc Version

0.60.0

frps Version

0.60.0

System Architecture

linux/amd64

Configurations

frps.toml bindPort = 7000 bindAddr = "0.0.0.0"

Logs

2024-09-26 18:47:05.043 [I] [frps/root.go:107] frps uses command line arguments for config 2024-09-26 18:47:05.949 [I] [server/service.go:237] frps tcp listen on 0.0.0.0:7000 2024-09-26 18:47:05.950 [I] [frps/root.go:114] frps started successfully

Steps to reproduce

  1. Create the frps.toml config file with the configuration mentioned
  2. Run the server using ./frps -c ./frps.toml
  3. Check the listening connections using netstat -tnlp

Affected area

superzjg commented 2 months ago

Displayed as::: 7000, can be connected using IPv4 and IPv6。 To force only IPv4, requires setting bindAddr to the actual IPv4 address or domain, not 0.0.0.0

xqzr commented 2 months ago

frp 监听 :: 时,没有附加 V6ONLY 套接字选项。所以 :: 监听,可以接受 IPv4 连接

github-actions[bot] commented 1 month ago

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