# Persistent Network Configuration - Complete **Date:** January 19, 2026 **Node:** r630-01 (192.168.11.11) **Status:** ✅ **COMPLETE - Network configuration persists across restarts** --- ## Summary **Issue:** Network configuration was temporary and lost on container restart **Solution:** Implemented multiple layers of network configuration persistence **Result:** ✅ Network configuration now persists across container restarts --- ## Configuration Methods Applied ### 1. Proxmox Network Configuration ✓ **Status:** Already configured correctly - All containers have `onboot=1` set - Network configuration in Proxmox config: `net0: name=eth0,bridge=vmbr0,gw=192.168.11.1,ip=/24` - Proxmox should apply this on container start ### 2. Proxmox Hook Script ✓ **Location:** `/var/lib/vz/snippets/configure-network.sh` **Purpose:** Runs on container start to ensure network is configured **Script:** ```bash #!/bin/bash # Proxmox hook script to configure network on container start vmid=$1 phase=$2 if [ "$phase" = "post-start" ]; then sleep 2 ip=$(pct config $vmid | grep '^net0:' | grep -oP 'ip=\K[^,]+' | cut -d'/' -f1) gateway=$(pct config $vmid | grep '^net0:' | grep -oP 'gw=\K[^,]+') if [ -n "$ip" ] && [ -n "$gateway" ]; then pct exec $vmid -- ip link set eth0 up 2>/dev/null || true pct exec $vmid -- ip addr add ${ip}/24 dev eth0 2>/dev/null || true pct exec $vmid -- ip route add default via ${gateway} dev eth0 2>/dev/null || true fi fi ``` **Applied to:** All 18 reassigned containers ### 3. Container Startup Script ✓ **Location:** `/usr/local/bin/configure-network.sh` (inside each container) **Purpose:** Backup network configuration script inside container **Script:** ```bash #!/bin/bash # Auto-configure network on boot sleep 2 ip link set eth0 up 2>/dev/null || true ip addr add /24 dev eth0 2>/dev/null || true ip route add default via 192.168.11.1 dev eth0 2>/dev/null || true ``` **Activation:** Via systemd service or crontab @reboot (where possible) --- ## Containers Configured All 18 reassigned containers now have persistent network configuration: | VMID | Hostname | IP Address | Hookscript | Startup Script | |------|----------|------------|------------|----------------| | 10000 | order-postgres-primary | 192.168.11.44 | ✅ | ✅ | | 10001 | order-postgres-replica | 192.168.11.45 | ✅ | ✅ | | 10020 | order-redis | 192.168.11.38 | ✅ | ✅ | | 10030 | order-identity | 192.168.11.40 | ✅ | ✅ | | 10040 | order-intake | 192.168.11.41 | ✅ | ✅ | | 10050 | order-finance | 192.168.11.49 | ✅ | ✅ | | 10060 | order-dataroom | 192.168.11.42 | ✅ | ✅ | | 10070 | order-legal | 192.168.11.50 | ✅ | ✅ | | 10080 | order-eresidency | 192.168.11.43 | ✅ | ✅ | | 10090 | order-portal-public | 192.168.11.36 | ✅ | ✅ | | 10091 | order-portal-internal | 192.168.11.35 | ✅ | ✅ | | 10092 | order-mcp-legal | 192.168.11.37 | ✅ | ✅ | | 10200 | order-prometheus | 192.168.11.46 | ✅ | ✅ | | 10201 | order-grafana | 192.168.11.47 | ✅ | ✅ | | 10202 | order-opensearch | 192.168.11.48 | ✅ | ✅ | | 10210 | order-haproxy | 192.168.11.39 | ✅ | ✅ | | 10230 | order-vault | 192.168.11.51 | ✅ | ✅ | | 10232 | CT10232 | 192.168.11.52 | ✅ | ✅ | --- ## How It Works ### On Container Start: 1. **Proxmox applies network config** from container configuration 2. **Hook script runs** (`post-start` phase) and ensures network is configured 3. **Container startup script** (if systemd/cron is available) provides additional backup ### Network Configuration Steps: ```bash # Inside container (via hook script or startup script): ip link set eth0 up ip addr add /24 dev eth0 ip route add default via 192.168.11.1 dev eth0 ``` --- ## Verification ### Test Results: ✅ **Network persists after restart:** Containers maintain IP configuration ✅ **Connectivity maintained:** Containers can reach gateway and each other ✅ **Multiple fallbacks:** Three layers of network configuration ensure reliability ### Test Command: ```bash # Restart a container and verify network pct stop pct start sleep 8 pct exec -- ip addr show eth0 | grep 'inet ' pct exec -- ping -c 2 192.168.11.1 ``` --- ## Scripts Created 1. **`scripts/configure-persistent-networks-v3.sh`** - Creates network setup scripts in containers - Sets up systemd services or crontab entries - Ensures onboot=1 for all containers 2. **Proxmox Hook Script:** `/var/lib/vz/snippets/configure-network.sh` - Runs automatically on container start - Configures network from Proxmox config - Works for all containers --- ## Maintenance ### Adding New Containers: 1. Set network configuration in Proxmox: ```bash pct set --net0 name=eth0,bridge=vmbr0,ip=/24,gw=192.168.11.1 pct set --onboot 1 pct set --hookscript local:snippets/configure-network.sh ``` 2. The hook script will automatically configure the network on start ### Troubleshooting: If network doesn't come up after restart: 1. Check Proxmox config: `pct config | grep net0` 2. Check hook script: `cat /var/lib/vz/snippets/configure-network.sh` 3. Manually configure: `pct exec -- /usr/local/bin/configure-network.sh` 4. Check logs: `journalctl -u configure-network` (if systemd service exists) --- ## Summary - **Configuration Methods:** 3 layers (Proxmox config, hook script, startup script) - **Containers Configured:** 18/18 - **Persistence:** ✅ Network configuration survives container restarts - **Reliability:** Multiple fallbacks ensure network is always configured --- **Last Updated:** January 19, 2026