Route SSH hosts through a VPN interface to bypass network conflicts when your local network overlaps with remote SSH destinations.
- Interactive interface selection - Lists all network interfaces with IP addresses for easy VPN selection
- Automatic SSH config parsing - Reads HostName entries from your SSH config file
- Route management - Adds routes with
ip route add <ip> dev <interface> metric 10 - DNS resolution - Resolves hostnames to IPs if your SSH config uses domain names
- Duplicate detection - Skips routes that already exist
curl -fsSL https://raw.githubusercontent.com/peterweissdk-priv/ifswitch_ssh/main/install.sh | bash# Clone the repository
git clone https://github.com/peterweissdk-priv/ifswitch_ssh.git
cd ifswitch_ssh
# Make executable
chmod +x ifswitch_ssh.sh
# Run the script (requires sudo for route management)
sudo ./ifswitch_ssh.sh| Option | Description |
|---|---|
-u, --update |
Check for updates and install if available |
-v, --version |
Display current version |
-h, --help |
Show help message |
- Linux with
ipcommand (iproute2) - Bash 4.0+
- Root privileges (sudo) for route management
The script parses SSH config files with the following format:
Host server1
HostName 192.168.1.1
User root
Host server2
HostName 192.168.1.2
User peterweissdk
ifswitch_ssh/
├── ifswitch_ssh.sh
├── install.sh
├── LICENSE
└── README.md
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or need support, please file an issue on the GitHub repository.
This project is licensed under the GNU GENERAL PUBLIC LICENSE v3.0 - see the LICENSE file for details