# SSH Proxy works on laptop but not server?

**URL:** <https://forum.ansible.com/t/ssh-proxy-works-on-laptop-but-not-server/6636>\
**Category:** Get Help\
**Tags:** playbook, ubuntu\
**Created:** [June 18, 2024, 3:21pm UTC](https://forum.ansible.com/t/ssh-proxy-works-on-laptop-but-not-server/6636 "2024-06-18T15:21:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Socialoutcast](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/socialoutcast/32/3886_2.png) [@Socialoutcast](https://forum.ansible.com/u/Socialoutcast)\
**Post date:** [June 18, 2024, 3:21pm UTC](https://forum.ansible.com/t/ssh-proxy-works-on-laptop-but-not-server/6636/1 "2024-06-18T15:21:42Z")

</div>

So I have a really odd issue that I have been trying to track down for days now. I have tried all the googling, all the chatGPTing and am at a loss for what’s going on.

A bit of overview for the issue. We have an environment that has a Ubuntu server 22.04 (Ansible Controller), another device on Ubuntu server 22.04, and a third device on Debian 9 arm. The Ansible controller and the Ubuntu server sit on the same network. The Debian 9 system sits on a separate internal network behind the Ubuntu server, so it cannot be directly reached from the controller. What I am doing is using the vars for a proxy through the Ubuntu host to the Debian 9 host. I have confirmed on my laptop that my code works BUT the controller when I put the repo on it the playbook and roles fail with the following error:

```auto
TASK [feather_gateway : Add default gateway] ********************************************************************************************************************************************************************************************************
fatal: [feather3_lineup1]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Connection timed out during banner exchange\r\nConnection to UNKNOWN port 65535 timed out", "unreachable": true}

```

Here is how the inventory var is set up:

```auto
all:
  children:
    feather_group1:
      hosts:
        feather3_lineup1:
          ansible_host: 10.0.1.20
          ansible_user: *****
          ansible_ssh_pass: *****
          ansible_become_pass: *****
          ansible_python_interpreter: /usr/bin/python2.7
      vars:
        ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -i /home/ *****/.ssh/id_rsa_lab***** @10.1.1.2"'

```

The controllers IP is 10.1.0.19/22 and can use the proxy command by itself and reach the Debian device on 10.0.1.20. But Ansible fails with the mentioned error.

Any help will be greatly appreciated. This is a dev env, so we do not have things in vaults right now until we get the code working on the controller. It’s on the to-do list 😃

---

<div class="post-metadata">

**Author:** ![Socialoutcast](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/socialoutcast/32/3886_2.png) [@Socialoutcast](https://forum.ansible.com/u/Socialoutcast)\
**Post date:** [June 18, 2024, 6:26pm UTC](https://forum.ansible.com/t/ssh-proxy-works-on-laptop-but-not-server/6636/2 "2024-06-18T18:26:37Z")

</div>

So to give a little more insight on this. Here is the proxy command working from the controller, working just fine.

> **[ssh tun working - Pastebin.com](https://pastebin.com/1vWwPDNi)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [June 18, 2024, 6:36pm UTC](https://forum.ansible.com/t/ssh-proxy-works-on-laptop-but-not-server/6636/3 "2024-06-18T18:36:10Z")

</div>

I don’t configure proxies in Ansible, it seems to work fine with [ProxyJump](https://man.openbsd.org/ssh_config#ProxyJump) configured in `~/.ssh/config`, for example perhaps something like this would work?

```auto
Host feather3_lineup1
  Hostname 10.0.1.20
  ProxyJump 10.1.1.2
  IdentityFile ~/.ssh/id_rsa_lab

```

---

<div class="post-metadata">

**Author:** ![Socialoutcast](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/socialoutcast/32/3886_2.png) [@Socialoutcast](https://forum.ansible.com/u/Socialoutcast)\
**Post date:** [June 18, 2024, 8:25pm UTC](https://forum.ansible.com/t/ssh-proxy-works-on-laptop-but-not-server/6636/4 "2024-06-18T20:25:26Z")

</div>

Thank you for the info. I was able to get things working with ProxyJump and some control master updates to my ssh conf. Since this is going to be for 200+ jump hosts with 10+ systems behind them I opted to keep a lot of it in the ansible inventory and not the ssh config.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [July 18, 2024, 8:26pm UTC](https://forum.ansible.com/t/ssh-proxy-works-on-laptop-but-not-server/6636/5 "2024-07-18T20:26:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
