Skip to content

Instantly share code, notes, and snippets.

@zargony
Last active May 5, 2024 14:52
Show Gist options
  • Save zargony/4730150 to your computer and use it in GitHub Desktop.
Save zargony/4730150 to your computer and use it in GitHub Desktop.
Automatic SSH jump host for IPv6-only hosts
#!/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