Proxmox SSH & Connection Safety
OpenWrt SSH Stability Requirements
- After OpenWrt network restart, the LAN IP changes (e.g.,
192.168.1.1→10.10.10.1). The bootstrap SSH connection will hang forever unlessConnectTimeoutis set.
Baseline OpenWrt SSH Configuration
- Required SSH args for baseline (password auth) OpenWrt connections:
ansible_ssh_common_args: >- -o ProxyJump=root@{{ ansible_host }} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PubkeyAuthentication=no -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=4
Security Hardened OpenWrt SSH Configuration
- After security hardening (M1), SSH switches to key auth. Replace
PubkeyAuthentication=nowith-i <key_path>and removesshpass:ansible_ssh_common_args: >- -o ProxyJump=root@{{ ansible_host }} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=4 -i {{ lookup('env', 'OPENWRT_SSH_PRIVATE_KEY') }}
SSH Configuration Reasoning
The group reconstruction task file (
tasks/reconstruct_openwrt_group.yml) auto-detects which auth method is active by checkingdeploy_stampstate and theOPENWRT_SSH_PRIVATE_KEYenv var.ConnectTimeout=10: Prevents infinite hang when LAN IP changes.ServerAliveInterval=15: Prevents connection drop during local Ansible tasks (set_fact sequences) that don't generate SSH traffic.
Connection Safety Rules
NEVER retry SSH to the old bootstrap address after LAN reconfiguration.
Always use ProxyJump through the Proxmox host for OpenWrt connections to maintain connectivity through network topology changes.