SSH connection to LXC container dropping when using Ansible

Notavi

New Member
May 20, 2025
6
0
1
This is a weird one, as I'm honestly not sure if it's a firewall thing, some kind of out-of-the box security thing or an Ansible thing but here goes:

I've got a fresh LXC container that I'm planning to use Ansible to configure. I have setup some firewall rules so that SSH into it just fine.

However, when I run ansible ping it's not only able to connect, but it causes any other SSH connections into the container to drop as well. I can see the processes still running, so it looks to me like the network connection got severed somehow.

When I connect with just SSH I can also see the connection in my Firewall logs, but when ansible attempts to connect nothing appears in the containers firewall logs.

SSH from my workstation is impacted, but SSH connections from other containers are not.
 
Ok - so after further testing I've noticed that SSH sometimes drops for other reasons as well (just now it dropped while I was reading a man page). The container is just a basic debian container (using the bookworm template) that hasn't really been configured or changed yet.

Doesn't seem to drop if there's no activity on the console.

Will have to test if it drops from the whole LAN or just the PC running Ansible (or something else) next).
 
In case anyone has a similar issue - here's what I uncovered after fiddling around - my problem was caused by asymmetric routing.

Outgoing packets would hit the router and be forwarded to the proxmox node, but because the node was on the same LAN as me it'd just send the packet back, bypassing the router.

Which would of course lead to the router getting confused about the state of the connection.