Force SSH to use a specific interface when you have too many tunnels

SSH & Remote Administration

Force SSH to use a specific interface when you have too many tunnels

🧩 The Challenge

You’ve got a laptop with a flaky Wi-Fi, a VPN, and a wired connection all fighting for dominance, and your SSH session keeps picking the wrong gateway. It’s infuriating when your connection dies just because the routing table decided to take a nap on the wrong interface.

💡 The Fix

Bind your SSH client to a specific local IP address so it stops guessing which path to the internet it should take. It keeps the connection locked to a stable source even when your network stack is having a nervous breakdown.

ssh -o BindAddress=192.168.1.50 user@remote-server

⚙️ Why It Works

By explicitly defining the bind address, you’re bypassing the OS routing logic that usually causes these multi-homed headaches. The kernel stops trying to be smart about your traffic and just pushes packets out the NIC you actually want.

🚀 Pro-Tip: Add this to your ~/.ssh/config file under the specific host block so you don’t have to type it every time you switch networks.

Linux Tips & Tricks | © ngelinux.com | 11/20/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted