DB / Linux / Connection Timed Out
WARNING
Linux Network Connection Timeout
A network connection timeout occurs when a system attempts to establish a connection to another host but doesn't receive a response within the configured timeout period. This differs from 'Connection Refused' where the host actively rejects the connection.
Common Causes
- Network connectivity issues between source and destination
- Firewall blocking the connection attempt
- Destination service not running or not listening on the expected port
- DNS resolution failures
- Incorrect routing or network configuration
How to Fix
1 Check Basic Connectivity
Verify network connectivity to the destination using ping and traceroute.
BASH
$ ping -c 4 example.com
traceroute example.com 2 Test Specific Port Connectivity
Use telnet or nc to test if a specific port is reachable.
BASH
$ telnet example.com 80
# OR
nc -zv example.com 443 3 Check Local Firewall Rules
Inspect iptables or firewalld rules that might be blocking outbound connections.
BASH
$ sudo iptables -L -n -v
# OR
sudo firewall-cmd --list-all 4 Verify DNS Resolution
Check if the hostname resolves correctly to an IP address.
BASH
$ nslookup example.com
dig example.com
host example.com 5 Increase Connection Timeout
For applications that support it, increase the connection timeout value.
BASH
$ # Example for curl
curl --connect-timeout 30 https://example.com