Last active
May 5, 2024 14:52
-
-
Save zargony/4730150 to your computer and use it in GitHub Desktop.
Automatic SSH jump host for IPv6-only hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Automatic SSH jump host for IPv6-only hosts. | |
# Usage in ~/.ssh/config: ProxyCommand ~/.ssh/ipv6proxy <jumphost> %h %p | |
# If a host is reachable via IPv6, a direct connection is made. | |
# Otherwise a jump host is used (which shall support IPv6). | |
if ping6 -c1 $2 >/dev/null 2>&1; then | |
exec nc -6 $2 $3 | |
else | |
exec ssh -q $1 "nc -6 $2 $3" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment