如何将此 ssh 命令转换为 ssh_config 文件?

how do you translate this ssh command into a ssh_config file?

我正在尝试将此 ssh 命令翻译成我的 ssh_config。 ssh_config 中 -L 的等价物是什么?我以为是 localForward,但从结果来看,我发现它看起来不是那样的。

SSH 命令

sudo ssh -i ~/.ssh/mySSHkey -L 81:<IP1>:81 -L 9200:<IP1>:9200  user@myhost.domain.com

ssh_config条目

Host logstash
        Hostname                <IP1>
        Port                    81
#        ForwardX11             yes
        LocalForward            81 <IP1>:81
        LocalForward            9200 <IP1>:9200
        User                    username
        IdentityFile            ~/.ssh/mySSHkey
        ServerAliveInterval     30
        ServerAliveCountMax     120
#       LogLevel                DEBUG3
Host tunnel
HostName database.example.com
IdentityFile ~/.ssh/john.example.key
LocalForward 9906 127.0.0.1:3306
User john

相当于:

ssh -f -N -L 9906:127.0.0.1:3306 john@database.example.com

有了新的配置,您可以 运行:

ssh -f -N tunnel

来源:http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/