The part about gateway hosts says:<p><pre><code>  &gt; Host B
  &gt;   ProxyCommand ssh -W B:22 A
</code></pre>
That could be improved:<p><pre><code>  &gt; Host B
  &gt;   ProxyCommand ssh -W %h:%p A
</code></pre>
Then you can use wildcards for B (&quot;Host 10.11.12.*&quot;), and use custom ports (&quot;ssh -p 2222 10.11.12.13&quot;).