Stop your SSH sessions from hanging on bad DNS lookups
SSH & Remote Administration
Stop your SSH sessions from hanging on bad DNS lookups
🧩 The Challenge
Have you ever tried to ssh into a box and just stared at the blinking cursor for thirty seconds while it tries to resolve a reverse lookup for an IP that doesn’t exist? It drives me absolutely up the wall when I’m in a rush.
💡 The Fix
You can tell your local SSH client to stop trying to be clever with DNS lookups and just connect directly. It saves you from waiting on timeouts that feel like they take an eternity.
ssh -o UseDNS=no user@hostname
⚙️ Why It Works
By flipping that option to no, the client skips the reverse DNS lookup process that usually triggers these delays on misconfigured internal networks. You’re essentially telling the daemon to stop querying the resolver for client info it doesn’t actually need to verify.
🚀 Pro-Tip: Drop ‘UseDNS no’ into your ~/.ssh/config file for that specific host alias and you’ll never have to type the flag again.
Linux Tips & Tricks | © ngelinux.com | 10/25/2026
