You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

服务器端cURL调用公网IP失败求助:本地正常但连接超时

Troubleshooting cURL Connection Timeout to 95.97.124.124:23 on Server

Got it, let's figure out why your connection to 95.97.124.124:23 is timing out on your server but working perfectly locally. Here’s a step-by-step breakdown of the most likely issues and fixes:

1. Check your server’s firewall/security group rules

Port 23 is the default Telnet port, and many hosting providers block outgoing traffic to well-known "high-risk" ports like this by default.

  • If you’re on a Linux server, run these commands to check your local firewall:
    • For UFW: ufw status
    • For firewalld: firewall-cmd --list-all
      Make sure there’s an outbound rule allowing traffic to port 23 (or specifically to 95.97.124.124:23).
  • If you’re using a cloud provider (AWS, GCP, Azure), don’t forget to check the security group attached to your server instance—outbound rules need to explicitly permit connections to that IP and port.

2. Test the connection directly from your server

Isolate whether this is a network issue or a code issue by running a raw cURL command on your server via SSH:

curl -v telnet://95.97.124.124:23
  • If this also times out, the problem is definitely network-related (not your code).
  • If this works, then the issue lies in how you’ve adapted the Postman code for your server environment.

3. Check if your server’s ISP blocks port 23

Some ISPs restrict outgoing traffic to port 23 because Telnet is unencrypted and often associated with security risks.

  • Reach out to your hosting provider to confirm if port 23 is blocked for outbound connections.
  • If possible, test connecting to a different port on the same target IP to rule out ISP restrictions.

4. Audit your Postman-derived code for misconfigurations

When copying code from Postman, it’s easy to miss local-specific settings that don’t translate to a server environment. Look for these common pitfalls:

  • Did you accidentally leave a local proxy configured in your code? Postman sometimes auto-injects proxy settings that only work on your machine.
  • Is the CURLOPT_CONNECTTIMEOUT value set too low? Try increasing it to 15 or 30 seconds to rule out slow network latency.
  • Double-check that you’re using the correct protocol—since port 23 is Telnet, make sure your cURL code isn’t trying to use HTTP/S by mistake.
  • If you’re still stuck, share a snippet of your cURL code—small oversights like missing CURLOPT_PORT or incorrect target formatting can cause timeouts.

5. Verify the target server allows connections from your server’s IP

It’s possible the target IP’s port 23 is whitelisted only for certain IP ranges (like your local network). Use nmap on your server to check if the port is accessible:

nmap -p 23 95.97.124.124
  • If the result shows "filtered", that means traffic is being blocked by the target server’s firewall or a network router between you and them.

内容的提问来源于stack exchange,提问作者Stan van Heertum

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:41:58