frp0.62.1 tcp6监听port 7000 (tcp) failed: No route to host解决

frp0.62.1 tcp6监听port 7000 (tcp) failed: No route to host解决
内容目录

环境

甲骨文vps ubuntu 24.04
frp 0.62.1 启动frps

问题

客户端

nc -zv x.x.x.x 7000

port 7000 (tcp) failed: No route to host

服务端

端口正常监听,防火墙开放了端口,但是外网客户端就是无法访问

root@s1:~/frp# netstat -lanp|grep 7000
tcp6       0      0 :::7000                 :::*                    LISTEN      514718/frps         
root@s1:~/frp# ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere                  
80/tcp                     ALLOW       Anywhere                  
80/udp                     ALLOW       Anywhere                  
443/tcp                    ALLOW       Anywhere                  
443/udp                    ALLOW       Anywhere                  
7500                       ALLOW       Anywhere                  
7000                       ALLOW       Anywhere                  
22/tcp (v6)                ALLOW       Anywhere (v6)             
80/tcp (v6)                ALLOW       Anywhere (v6)             
80/udp (v6)                ALLOW       Anywhere (v6)             
443/tcp (v6)               ALLOW       Anywhere (v6)             
443/udp (v6)               ALLOW       Anywhere (v6)             
7500 (v6)                  ALLOW       Anywhere (v6)             
7000 (v6)                  ALLOW       Anywhere (v6)             

排查

tcp6 ::: 会自动监听 IPv4,但并不总是如此,有些系统不会自动转发 IPv4 到 IPv6。

root@s1:~/frp# sysctl -p
fs.file-max = 51200
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.rmem_default = 65536
net.core.wmem_default = 65536
net.core.netdev_max_backlog = 4096
net.core.somaxconn = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
sysctl: cannot stat /proc/sys/net/ipv4/tcp_tw_recycle: No such file or directory
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

发现没有

net.ipv6.bindv6only = 0

解决问题

增加参数

echo "net.ipv6.bindv6only = 0" >> /etc/sysctl.conf
sysctl -p

重启解决

reboot
root@616f3075b6d2:/ql# nc -zv  7000
Connection to  7000 port [tcp/bbs] succeeded!

Comments

No comments yet. Why don’t you start the discussion?

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注