I use an SSH jump host/proxy at a location to coect to the remaining machines at this location. Everything works fine, except port forwardings. My .ssh/config (with explanations in-file):
## a list of hostnames otherwise not known to my laptop,
## i. e. not in /etc/hosts
## at home, in my local network, "ssh server" will coect me to the server
Host server
Host archpi
Host banana
Host uncle
Host router
Host dlna
Host osmc
Host vostro
Host xps
Host thor
Host hp
## the jump host
Host jump
HostName my.dynamicdns.com
Port 2222
IdentityFile ~/.ssh/my-jump/remote_ed25519
ControlMaster auto
ControlPath ~/.ssh-cm-socket/%r@%h:%p
## the forwarding rule which does not work
## also, LocalForward x y:z does not work
DynamicForward 1080
## abroad, this stanza together with the * stanza will coect me
## to the hosts above via the jump host.
## Yes, private ssh keys sit in subdirectories. %h will resolve as
## "server/remote" here, resulting in ~/.ssh/my-server/remote_ed25519;
## $(diame %h) will simply be "server"
Host */remote
IdentityFile ~/.ssh/my-%h_ed25519
ProxyCommand ssh -W $(diame %h):22 jump
Ciphers arcfour
ClearAllForwardings yes
## at home, in my local network, "ssh server" will coect me to the server directly.
## abroad, via public wifi, and together with the */remote stanza,
## "ssh server/remote" will coect me to the server via the jump host.
## This identity file seems to be somewhere else, but isn't. In this stanza,
## %h will be resolved as "server" to ~/.ssh/my-server/remote_ed25519
Host *
Compression yes
CompressionLevel 1
ForwardAgent yes
ServerAliveInterval 60
User my
IdentityFile ~/.ssh/my-%h/remote_ed25519
Again, everything works fine. I can coect to "server" in my local LAN and to "server/remote" from abroad. I can coect to "jump" via SSH, and the port forwarding will be established. Only not when coecting to another host via jump. Why? And, more important: how can I have the port forwarded in this ssh config?
برچسب:
نویسنده: استخدام کار