# No host, but ping is done

**URL:** <https://forum.ansible.com/t/no-host-but-ping-is-done/1070>\
**Category:** Get Help\
**Tags:** pylibssh, paramiko, ping, ansible-core, network\
**Created:** [September 24, 2023, 2:03pm UTC](https://forum.ansible.com/t/no-host-but-ping-is-done/1070 "2023-09-24T14:03:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![moiseev-ks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/moiseev-ks/32/805_2.png) [@moiseev-ks](https://forum.ansible.com/u/moiseev-ks)\
**Post date:** [September 24, 2023, 2:03pm UTC](https://forum.ansible.com/t/no-host-but-ping-is-done/1070/1 "2023-09-24T14:03:43Z")

</div>

Hi  
I am new in ansible, and studing it on lab scheme.  
I am confused one thing:  
In inventory is host:

> cis2 ansible\_host=172.28.8.222

And then i try -m ping to it, recievd pong.

> [WARNING]: ansible-pylibssh not installed, falling back to paramiko  
> cis2 | SUCCESS =\> {  
> “changed”: false,  
> “ping”: “pong”  
> }

But, this host is absent.

> — 172.28.8.222 ping statistics —  
> 4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3059ms

> ssh: connect to host 172.28.8.222 port 22: No route to host

What it is mean?

---

<div class="post-metadata">

**Author:** ![IPvSean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ipvsean/32/1153_2.png) [@IPvSean](https://forum.ansible.com/u/IPvSean)\
**Post date:** [September 24, 2023, 5:28pm UTC](https://forum.ansible.com/t/no-host-but-ping-is-done/1070/2 "2023-09-24T17:28:13Z")

</div>

> — 172.28.8.222 ping statistics —  
> 4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3059ms

the host could have ICMP blocked, the “ping” module is not the same as ICMP ping. In the docs: [ansible.builtin.ping module – Try to connect to host, verify a usable python and return pong on success — Ansible Documentation](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/ping_module.html)

> This is NOT ICMP ping, this is just a trivial test module that requires Python on the remote-node.

However…

> ssh: connect to host 172.28.8.222 port 22: No route to host

This is interesting… you should be able to ssh… even if ICMP is disabled… can you do a `ansible-inventory --list`, I am curious what it says

this

---

<div class="post-metadata">

**Author:** ![moiseev-ks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/moiseev-ks/32/805_2.png) [@moiseev-ks](https://forum.ansible.com/u/moiseev-ks)\
**Post date:** [September 25, 2023, 9:16am UTC](https://forum.ansible.com/t/no-host-but-ping-is-done/1070/3 "2023-09-25T09:16:13Z")

</div>

I installed ansible for new Master server. Situation is the same.  
Inventory:

```auto
- cis1 - host is active, configs right
- cis2 - host is active, configs wrong
- cis3 - host is absent

```

```auto

mks_ansible@debian-t1:~/ansible_configs$ ansible-inventory --list
{
    "_meta": {
        "hostvars": {
            "cis1": {
                "ansible_connection": "network_cli",
                "ansible_host": "172.28.8.221",
                "ansible_network_os": "ios",
                "ansible_user": "ansible",
                "ansible_password": "sss123"
            },
            "cis2": {
                "ansible_connection": "network_cli",
                "ansible_host": "172.28.8.222",
                "ansible_network_os": "ios",
                "ansible_user": "ansible",
                "ansible_password": "wrongpass"
            },
            "cis3": {
                "ansible_connection": "network_cli",
                "ansible_host": "172.28.8.223",
                "ansible_network_os": "ios",
                "ansible_user": "ansible",
                "ansible_password": "sss123"
            }
        }
    },
    "all": {
        "children": [
            "ungrouped",
            "routers_ios"
        ]
    },
    "routers_ios": {
        "hosts": [
            "cis1",
            "cis2",
            "cis3"
        ]
    }
}

```

Result:

> mks\_ansible@debian-t1:~/ansible\_configs$ ansible routers\_ios -m ping  
> [WARNING]: ansible-pylibssh not installed, falling back to paramiko  
> [WARNING]: ansible-pylibssh not installed, falling back to paramiko  
> [WARNING]: ansible-pylibssh not installed, falling back to paramiko  
> cis1 | SUCCESS =\> {  
> “changed”: false,  
> “ping”: “pong”  
> }  
> cis2 | SUCCESS =\> {  
> “changed”: false,  
> “ping”: “pong”  
> }  
> cis3 | SUCCESS =\> {  
> “changed”: false,  
> “ping”: “pong”  
> }

---

<div class="post-metadata">

**Author:** ![moiseev-ks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/moiseev-ks/32/805_2.png) [@moiseev-ks](https://forum.ansible.com/u/moiseev-ks)\
**Post date:** [September 25, 2023, 10:12am UTC](https://forum.ansible.com/t/no-host-but-ping-is-done/1070/4 "2023-09-25T10:12:59Z")

</div>

This behavior only for routers (i tried with cisco and juniper). With linux and windows servers -m ping works correctly.

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [September 25, 2023, 12:41pm UTC](https://forum.ansible.com/t/no-host-but-ping-is-done/1070/5 "2023-09-25T12:41:11Z")

</div>

`ansible.netcommon.net_ping` should be used insted of `ping` module.

> For Network targets, use the ansible.netcommon.net\_ping module instead.  
> [ansible.builtin.ping module – Try to connect to host, verify a usable python and return pong on success — Ansible Documentation](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/ping_module.html#ansible-collections-ansible-builtin-ping-module)

---

<div class="post-metadata">

**Author:** ![IPvSean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ipvsean/32/1153_2.png) [@IPvSean](https://forum.ansible.com/u/IPvSean)\
**Post date:** [September 25, 2023, 1:04pm UTC](https://forum.ansible.com/t/no-host-but-ping-is-done/1070/6 "2023-09-25T13:04:36Z")

</div>

> `ansible.netcommon.net_ping` should be used insted of `ping` module.

this ^, the ping module is verifying nothing for network devices, and not a valid test.

---

<div class="post-metadata">

**Author:** ![gwmngilfen](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/gwmngilfen/32/6_2.png) [@gwmngilfen](https://forum.ansible.com/u/gwmngilfen)\
**Post date:** [October 6, 2023, 8:51am UTC](https://forum.ansible.com/t/no-host-but-ping-is-done/1070/7 "2023-10-06T08:51:16Z")

</div>

Hi @moiseev-ks! It looks like the post might be solved - could you check to see if the response by @kurokobo worked for you?

If so, it would be _super_ helpful if you could click the ✔ on their post to accept the solution - it recognises the input of others, helps our volunteers find new issues to answer, and keeps the forum nice and tidy.

Thanks!  
(this is template reply, do feel free to reply if I’ve misunderstood the situation!)

---

<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:** [April 10, 2024, 1:00pm UTC](https://forum.ansible.com/t/no-host-but-ping-is-done/1070/8 "2024-04-10T13:00:55Z")

</div>

Closed on April 10, 2024, 1:00pm UTC

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