OpenWrt Network Topology Rules
Bridge Assignment Rules
- OpenWrt gets ALL bridges: WAN on
net0/eth0, remaining bridges as LAN ports. Most other VMs need only ONE LAN bridge. - The WAN bridge is auto-detected by
proxmox_bridgesvia the host's default route. NEVER hardcode a bridge as WAN. Override withopenwrt_wan_bridgeinhost_varsonly if auto-detection fails. - Order bridges so WAN is always
net0/eth0:_ordered_bridges: [_wan_bridge] + (proxmox_all_bridges | difference([_wan_bridge]) | sort)
Bridge Ordering Bug Prevention
- Previous bug: alphabetical bridge sorting made
vmbr0always WAN. When the modem was onvmbr0, the Proxmox GUI became unreachable from LAN nodes. - NEVER sort bridges alphabetically. Always use explicit ordering with WAN first.
Auto-Subnet Selection
- To avoid collisions between WAN subnet and OpenWrt LAN subnet:
- Detect upstream gateway prefix from Proxmox host's default route
- Pass it to OpenWrt via
add_hostasupstream_wan_prefix - Iterate
openwrt_lan_subnet_candidatesand pick first whose prefix differs from WAN
Proxmox Management IP
When OpenWrt is primary router, Proxmox host needs predictable IP on LAN bridge:
- Compute LAN IP from OpenWrt's LAN subnet + offset (default
.2) ip addr addon LAN bridge (immediate, current session)- Upgrade LAN bridge in
ansible-bridges.conffrominet manualtoinet dhcp - Add DHCP static reservation mapping Proxmox host's LAN bridge MAC to computed IP
- On reboot: DHCP client requests IP, OpenWrt assigns reserved one
- Compute LAN IP from OpenWrt's LAN subnet + offset (default
NEVER use separate config file with
iface <bridge> inet dhcp. It conflicts withinet manualstanza in bridges config.NEVER leave stale IPs on non-LAN bridges in same subnet as LAN bridge. Two routes for same /24 on different bridges causes kernel to use wrong interface, breaking LAN VM connectivity.
Bootstrap Connectivity Pattern
To reach OpenWrt at default
192.168.1.1during initial setup:- Add temporary IP (
192.168.1.2) to WAN bridge on Proxmox - SSH through ProxyJump via Proxmox host
- After Phase 1 network restart, OpenWrt's LAN moves to non-WAN bridges
- Remove bootstrap IP from WAN bridge, add to LAN bridge
- After Phase 2, clean up bootstrap IP entirely
- Add temporary IP (
Previous bug: excluded
vmbr0and tried connecting throughvmbr1(which had no IP in OpenWrt's default config).On re-runs (VM already configured), the bootstrap IP
192.168.1.1no longer exists — the VM's LAN is on 10.10.10.1. Theopenwrt_vmrole MUST probe the configured LAN IP first and skip bootstrap if reachable.OpenWrt LXC containers (bridge, mesh) boot with the default LAN IP 192.168.1.1 on br-lan. On WAN-bridged hosts, this IP is on the same L2 segment as the router VM's bootstrap target. The bridge LXC role MUST override the default LAN IP to the Proxmox-assigned container IP during provisioning.
Previous bug: Bridge LXC containers on bridge-1 and bridge-2 had 192.168.1.1 on the WAN bridge. When the openwrt_vm role added 192.168.1.2/24 to vmbr0 and SSHed to 192.168.1.1, it connected to the bridge container (1 eth interface) instead of the VM (3 interfaces). The configure role then failed with "No LAN devices found."