# Problems with ssh connections to hosts behind jumphost

**URL:** <https://forum.ansible.com/t/problems-with-ssh-connections-to-hosts-behind-jumphost/21807>\
**Category:** Ansible Project\
**Created:** [June 18, 2016, 3:11pm UTC](https://forum.ansible.com/t/problems-with-ssh-connections-to-hosts-behind-jumphost/21807 "2016-06-18T15:11:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [June 18, 2016, 3:11pm UTC](https://forum.ansible.com/t/problems-with-ssh-connections-to-hosts-behind-jumphost/21807/1 "2016-06-18T15:11:48Z")

</div>

Dear all,

I have some hosts that I can only reach via a jumphost. So, my  
.ssh/config contains:

Host foobar  
&nbsp;&nbsp;...  
&nbsp;&nbsp;ProxyCommand ssh -W %h:%p whatever  
&nbsp;&nbsp;...

I have a strange, intermittent issue, that I can connect to one of  
these hosts via ansible and run a playbook. Running it on more than  
one host fails out, sometimes "unreachable", sometimes module errors.  
Re-running the playbook on the failing host only works.

Any hints, how to solve this? Or how to look for the error? I thought  
about checking ssh multiplexing, pipelining and similiar stuff, but  
without an idea where to look I'm kind of in the dark here...

Any help would be highly appreciated!

Johannes

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [June 18, 2016, 3:18pm UTC](https://forum.ansible.com/t/problems-with-ssh-connections-to-hosts-behind-jumphost/21807/2 "2016-06-18T15:18:03Z")

</div>

You may want to look into raising the MaxStartups sshd config on the bastion.

Maybe also look into increasing `timeout` in Ansible.cfg

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [June 18, 2016, 3:28pm UTC](https://forum.ansible.com/t/problems-with-ssh-connections-to-hosts-behind-jumphost/21807/3 "2016-06-18T15:28:31Z")

</div>

Thanks Matt,

that was quick!

> You may want to look into raising the MaxStartups sshd config on the  
> bastion.

I'll try 100:30:300 and see, thanks for the suggestion.

> Maybe also look into increasing `timeout` in Ansible.cfg

I already did that, but to no avail...

Johannes

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [June 19, 2016, 1:35pm UTC](https://forum.ansible.com/t/problems-with-ssh-connections-to-hosts-behind-jumphost/21807/4 "2016-06-19T13:35:52Z")

</div>

Although timeout is set to 30s and MaxStartups is set to 100:30:300, I  
still have intermittent failures.

I tried to set 'serial: 2' in the group\_vars, but I am not sure if  
this has to be set on play level. Off to read the docs..

Johannes

---

<div class="post-metadata">

**Author:** ![Mirko\_Friedenhagen](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mirko\_Friedenhagen](https://forum.ansible.com/u/Mirko_Friedenhagen)\
**Post date:** [June 19, 2016, 6:37pm UTC](https://forum.ansible.com/t/problems-with-ssh-connections-to-hosts-behind-jumphost/21807/5 "2016-06-19T18:37:31Z")

</div>

One thing which once hit me: on MacOSX the file ulimit was only 256. I have about 140 hosts and when our company decided to use a jump host I suddenly ran into problems because the pipelined connections now hit this limit.

Regards  
Mirko

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [June 19, 2016, 7:06pm UTC](https://forum.ansible.com/t/problems-with-ssh-connections-to-hosts-behind-jumphost/21807/6 "2016-06-19T19:06:53Z")

</div>

Hi Mirko,

---

<div class="post-metadata">

**Author:** ![Bogdan\_Mihaescu](https://avatars.discourse-cdn.com/v4/letter/b/b9bd4f/32.png) [@Bogdan\_Mihaescu](https://forum.ansible.com/u/Bogdan_Mihaescu)\
**Post date:** [June 23, 2016, 9:57am UTC](https://forum.ansible.com/t/problems-with-ssh-connections-to-hosts-behind-jumphost/21807/7 "2016-06-23T09:57:40Z")

</div>

Hello,

I have the same problem. Did you find any solution for this ?

Thanks

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [June 23, 2016, 6:56pm UTC](https://forum.ansible.com/t/problems-with-ssh-connections-to-hosts-behind-jumphost/21807/8 "2016-06-23T18:56:47Z")

</div>

As the hosts are lxc containers running on the jump host (and only  
being available via the jump host), I guess it might be due to memory  
usage when the commands are being run on all hosts simultaneously.

I'm in the middle of trying out some things, but no, a real solution  
did not present itself.

Try (and maybe disable) ssh multiplexing, pipelining and starting the  
playbooks with forks and/or serial...

Johannes
