[solved] Ping host working from VM, not from LXC: any ideas?

Hi, has it worked before/until now?

No, just started with HA. I was following this guide https://smarthomepursuits.com/how-to-monitor-devices-in-home-assistant/

I used SSH to get to the terminal and ping my laptop from HA. I dont get a response. When I ping 8.8.8.8 or my mobile phone I do get a response.
So maybe a firewall setting on my laptop is blocking the ping command?? Anyone an idea which setting that is?
Edit, found it. WIndows is standard blocking ping requests. Enabled it, see following website:
https://activedirectorypro.com/allow-ping-windows-firewall/#:~:text=By%20default%2C%20the%20Windows%20Firewall,ICMP%20ping%20requests%20are%20blocked.

I’ve never got a response from the respective devices (2/7 I’ve set up don’t respond) using Ping from HA. I always get a response from a ping in the terminal window.

Does anyone know what is different between how HA runs ping to how its run from a terminal window inside the HA browser client? And how can I enable some detailed logging of the actual command executed and response received? Thanks

I found my error which was a dumb copy and paste mistake on the ip address in the yaml, so wasn’t pinging the server I thought I was :man_facepalming: I found this out by comparing ping debug log with

shell_command:
  ping_my_server: ping -c5 [ip address] >> /config/ping_my_server.log

Could be a helpful way to diagnose issues for others struggling…

1 Like

Actual this code works for me:

binary_sensor:
  - platform: ping
    host: 192.168.178.95
    name: "Ping XXXX-PC"
    count: 10
    scan_interval: 1

Hi @Lucky92, thank you for trying to help.

I think it was a matter of permissions somehow but couldn’t pinpoint it since my knowledge of Linux is not that good.
I reinstalled but instead of doing it manual, I used a script from @tteck which solved that problem.

1 Like

I had an issue where I could ping my virtual Linux machine running on VirtualBox inside Windows, but not with Home Assistant.

What was weird is that it used to work but (I think) as a result of updates it stopped working.

Turns out, in the Network settings in VirtualBox, I needed to change Promiscuous mode to:
Allow All

Then, Home Assistant (also a Virtual Machine using VMware), could ping the Linux machine and everything worked again.