# Ansible cannot reach host but ansible ping and ssh is ok

**URL:** <https://forum.ansible.com/t/ansible-cannot-reach-host-but-ansible-ping-and-ssh-is-ok/10785>\
**Category:** Get Help\
**Tags:** ssh\
**Created:** [November 8, 2024, 6:58pm UTC](https://forum.ansible.com/t/ansible-cannot-reach-host-but-ansible-ping-and-ssh-is-ok/10785 "2024-11-08T18:58:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![adriansev](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/adriansev/32/4866_2.png) [@adriansev](https://forum.ansible.com/u/adriansev)\
**Post date:** [November 8, 2024, 6:58pm UTC](https://forum.ansible.com/t/ansible-cannot-reach-host-but-ansible-ping-and-ssh-is-ok/10785/1 "2024-11-08T18:58:16Z")

</div>

I have a very strange situation where a host that responds to ansible ping and i can ssh into gives `Data could not be sent to remote host`  
Any idea how can i debug this and most importantly how can this happen?  
i have this in invetory:

```auto
vmhost1 ansible_host=10.10.11.241 ansible_port=22
vmhost2 ansible_host=10.10.11.243 ansible_port=22

```

and `remote_user=root` in ansible.cfg (also i have another 30 hosts for which the same playbooks work without problem)

is just for `vmhost1` running a playbook i get error, but ssh into it with the same credentials (root and port 22) and running ansible -m pong works…

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![anon81884396](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon81884396](https://forum.ansible.com/u/anon81884396)\
**Post date:** [November 8, 2024, 7:30pm UTC](https://forum.ansible.com/t/ansible-cannot-reach-host-but-ansible-ping-and-ssh-is-ok/10785/2 "2024-11-08T19:30:55Z")

</div>

Check /etc/security/access.conf to see if root is only allowed from certain IP addresses on your problematic host.

By the way, allowing remote root login is very bad. It has been considered a security best practice to disallow remote root login since the late 1990’s. Your company should rethink this strategy and you should also use a dedicated Ansible user that has sudo access. If you’re doing this in a home lab or whatever, fine, but if this is for anything of any importance at all, PLEASE consider more secure alternatives.

---

<div class="post-metadata">

**Author:** ![adriansev](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/adriansev/32/4866_2.png) [@adriansev](https://forum.ansible.com/u/adriansev)\
**Post date:** [November 8, 2024, 8:06pm UTC](https://forum.ansible.com/t/ansible-cannot-reach-host-but-ansible-ping-and-ssh-is-ok/10785/3 "2024-11-08T20:06:24Z")

</div>

> [@anon81884396](#):
>
> /etc/security/access.conf

/etc/security/access.conf is untouched on both.  
also i beg to differ regarding root access :

1. disregarding explicit option, but ssh have as default `prohibit-password` and access is with key only
2. from attacker point of view there is absolutely no difference between access to a root account and and account that have unrestricted sudo privilege

add to that that it is a norm to allow this (firewall level) only from within local network and have an ssh bastion for external access and it become absolutely pointless to have some user with sudo access (which if it is configured to use password to do sudo then the password must be explicitly set up in ansible vault … and usage of passwords is anyway a security problem)

Anyway, thanks for looking into this!

---

<div class="post-metadata">

**Author:** ![adriansev](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/adriansev/32/4866_2.png) [@adriansev](https://forum.ansible.com/u/adriansev)\
**Post date:** [November 8, 2024, 8:59pm UTC](https://forum.ansible.com/t/ansible-cannot-reach-host-but-ansible-ping-and-ssh-is-ok/10785/4 "2024-11-08T20:59:41Z")

</div>

The problem is even more strange : i can run a playbook with ansible.builtin.raw without problem … the python packages are the same with another identical host (same kickstart template)

Trying the faililng task with -vvvv i got the output that shows:

```auto
Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 383891\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Control master terminated unexpectedly\r\n",

```

but using the exact ssh command that is run gives no problem …

---

<div class="post-metadata">

**Author:** ![adriansev](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/adriansev/32/4866_2.png) [@adriansev](https://forum.ansible.com/u/adriansev)\
**Post date:** [November 9, 2024, 10:04am UTC](https://forum.ansible.com/t/ansible-cannot-reach-host-but-ansible-ping-and-ssh-is-ok/10785/5 "2024-11-09T10:04:28Z")

</div>

Seems that the problem was a MTU problem somehow:  
while all datacenter and the ansible controller have an MTU of 9000, the host that did not work also had an MTU of 9000 … as soon as i commented the option (to get back to default of 1500) the ssh control no longer broke … i see no logic on this but this is the reality …

---

<div class="post-metadata">

**Author:** ![Manngunner](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Manngunner](https://forum.ansible.com/u/Manngunner)\
**Post date:** [January 9, 2025, 9:44am UTC](https://forum.ansible.com/t/ansible-cannot-reach-host-but-ansible-ping-and-ssh-is-ok/10785/6 "2025-01-09T09:44:13Z")

</div>

I’m having this same issue, our internal network is MTU 9000 all over.

Are there any settings to allow the use of an MTU of 9000 within Ansible?

---

<div class="post-metadata">

**Author:** ![bcoca](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bcoca/32/9269_2.png) [@bcoca](https://forum.ansible.com/u/bcoca)\
**Post date:** [January 9, 2025, 9:00pm UTC](https://forum.ansible.com/t/ansible-cannot-reach-host-but-ansible-ping-and-ssh-is-ok/10785/7 "2025-01-09T21:00:11Z")

</div>

> [@adriansev](#):
>
> get back to default of 1500) the ssh control no longer broke … i see no logic on this but this is the reality …

This seems like an ssh issue, probably due to issues with breaking/reassembling files, while a normal ssh sessions does not have much data, ansible needs to transfer files back and forth, which is why it might be hitting this issue.
