运行一年的Perforce开发服务器拒绝连接问题求助
排查Perforce服务器连接拒绝问题
以下是针对你遇到的客户端无法连接Perforce服务器(报错Connection refused)的具体排查步骤:
确认Perforce服务是否运行
先检查服务器上的p4d进程状态:# Linux系统 ps aux | grep p4d # Windows命令提示符 tasklist | findstr p4d.exe如果没有找到p4d进程,手动启动服务:
# Linux通过systemctl启动(若已配置服务) systemctl start perforce # 直接启动p4d(需指定数据根目录和端口) p4d -d -r /path/to/perforce/root -p 1666检查端口监听情况
验证1666端口是否被p4d占用:# Linux用netstat netstat -tulpn | grep 1666 # Linux用ss(更高效) ss -tulpn | grep 1666 # Windows netstat -ano | findstr :1666如果端口未被监听,要么服务未正常启动,要么启动时的端口参数错误,核对p4d启动命令的
-p参数,或查看Perforce配置文件中的P4PORT设置。排查防火墙拦截
服务器本地防火墙可能阻断了1666端口的流量,临时关闭防火墙测试:# Linux(firewalld) systemctl stop firewalld # Linux(ufw) ufw disable # Windows netsh advfirewall set allprofiles state off若关闭后可连接,需添加永久放行规则:
# Linux firewalld firewall-cmd --add-port=1666/tcp --permanent firewall-cmd --reload # Linux ufw ufw allow 1666/tcp # Windows netsh advfirewall firewall add rule name="Perforce" dir=in action=allow protocol=TCP localport=1666测试网络可达性
从客户端机器测试服务器端口连通性:telnet 服务器IP 1666 # 或用netcat nc -zv 服务器IP 1666若仍无法连通,说明存在网络链路问题(如路由规则、交换机限制),需排查网络基础设施。
核对P4PORT配置一致性
确认服务器端的P4PORT配置与客户端使用的地址一致:p4 configure show P4PORT若服务器端配置为绑定特定IP(如仅内网IP),客户端用外网IP连接会失败,可将
P4PORT调整为0.0.0.0:1666以允许所有IP访问。
内容的提问来源于stack exchange,提问作者wpvic
相关产品推荐
相关产品推荐

