วิธีแก้ปัญหาสล็อตเล่นไม่ได้ 7 วิธีแก้ไขเร็ว 2026

You’re mid-way through a critical server update—suddenly, your SSH session freezes. No error message, just an eerie silence. Then, bam: “Connection reset by peer.” Sound familiar? SSH timeouts aren’t just annoying; they can derail deployments, disrupt remote work, and leave you staring at a dead terminal wondering what went wrong. The good news? Fixing SSH timeout errors doesn’t require a computer science degree—just the right tweaks to your config. And no, you don’t need to switch to a VPN premium or upgrade your cloud storage (though those help). Here’s how to keep your sessions alive—and save your sanity.

Why SSH Timeouts Happen (And It’s Not Always Your Fault)

SSH timeouts boil down to two culprits: network issues or server-side settings. But here’s the kicker—most tutorials blame your local connection first. In reality?

  • Idle sessions get killed. Many servers enforce idle timeout policies (e.g., AWS EC2 defaults to 5 minutes). If you’re not typing or sending data, poof—disconnected.
  • NAT gateways and firewalls. Corporate networks, ISPs, or even home routers often aggressively drop “inactive” TCP connections. Fun fact: Some hosting terbaik providers do this too.
  • The TCP keepalive dance. SSH relies on TCP keepalives to detect dead connections. If these packets get blocked or ignored, the connection hangs until it times out.
  • MTU mismatches. Rare but brutal—if your packets are too large for a hop along the route, they fragment or vanish. This happens more than you’d think with VPNs like WireGuard.

See? It’s not always “your Wi-Fi sucks.” Now let’s fix it.

1. Tweak Your Client Config: The 30-Second Fix

The fastest way to combat timeouts? Adjust your local SSH config file (~/.ssh/config). This method works on Linux, macOS, and WSL—no server access required.

Open the file in nano (or your editor of choice):

nano ~/.ssh/config

Then add these lines:

Host *



ServerAliveInterval 60

ServerAliveCountMax 3

TCPKeepAlive yes

ConnectTimeout 30

ServerAliveInterval: Sends a null packet every 60 seconds to keep the connection alive.

ServerAliveCountMax: After 3 missed responses (180 seconds), SSH assumes the connection is dead.

TCPKeepAlive: Uses OS-level keepalives as a backup (on by default, but worth specifying).

ConnectTimeout: Gives up on failed connections after 30 seconds instead of waiting indefinitely.

Pro tip: If you’re using an aplikasi produktivitas like Termius or Tabby, check their settings for similar options—they often override these values.

2. Adjust Server Settings (If You Have Access)

If you control the server (or can sweet-talk an admin), modify /etc/ssh/sshd_config:

sudo nano /etc/ssh/sshd_config

Add or uncomment these lines:

ClientAliveInterval 60



ClientAliveCountMax 3

TCPKeepAlive yes

LoginGraceTime 60

*Client** settings mirror the client-side tweaks but push keepalives from the server.

*LoginGraceTime*: Extends the window for authentication before timing out (useful if your laptop terbaik is sluggish).

“Don’t copy-paste blindly! Always back up sshd_config first (sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak) and restart SSH gracefully (sudo systemctl reload sshd).”

The Nuclear Option: Persistent Tunnels with Autossh

Avoid timeouts entirely by making your SSH connection immortal. Autossh monitors and restarts failed sessions automatically—perfect for remote development or accessing home servers behind NAT.

Installation (Linux/macOS)

$ sudo apt install autossh # Debian/Ubuntu

$ brew install autossh # macOS

$ yay -S autossh # Arch Linux

The Magic Command

$ autossh -M 0 -N -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -L 8888:localhost:80 [email protected] -i ~/.ssh/id_rsa

  • -M 0: Disables built-in monitoring (we’re using ServerAliveInterval instead).
  • -N: No remote command execution—just forward ports.
  • -L 8888:localhost:80: Forwards local port 8888 to port 80 on the server.
  • -i ~/.ssh/id_rsa: Uses key-based auth (recommended over passwords).

“This saved my bacon during a week-long data migration,” says Adi, a DevOps engineer we consulted. “No more waking up to dead tunnels.” Oh—and if you’re tunneling through a domain murah, Autossh works there too.

Firewall Shenanigans: Check These Hidden Traps

A silent killer: firewalls dropping connections due to misconfigured timeouts. Here’s how to diagnose:

A. Test with Netcat First

  1. On Server A: $ nc -l -v -k -w 60 localhost 9999 # Listen on port 9999 for 60 seconds (-k keeps listening)
  2. On Server B: $ nc <Server_A_IP> 9999 # Connect and send data manually ("hello") then wait.
  3. Details matter:
  • If the connection drops within seconds:
> Your network firewall/network device is enforcing strict timeouts. Check routers, cloud security groups (AWS Security Groups/Azure NSGs), and any IDS tools like Fail2Ban.