diff --git a/DELL_R730_ORION_PROXMOX_INTEGRATION.md b/DELL_R730_ORION_PROXMOX_INTEGRATION.md new file mode 100644 index 0000000..c597faa --- /dev/null +++ b/DELL_R730_ORION_PROXMOX_INTEGRATION.md @@ -0,0 +1,1011 @@ +# Dell R730 CQ5QBM2 ORION - Proxmox with macOS Integration Guide + +## 🎯 Overview + +This guide integrates the **OSX-PROXMOX** solution with the Dell PowerEdge R730 (Service Tag: CQ5QBM2) **ORION** deployment, creating a unified platform that provides: + +1. **High-Performance Routing** - Replace Telus NH20T modem with enterprise routing capabilities +2. **macOS Virtualization** - Run macOS VMs (High Sierra through Sequoia) on AMD/Intel hardware +3. **Multi-Service Platform** - Host additional VMs and containers for development, testing, and production workloads + +--- + +## 🏗️ Architecture Overview + +``` +┌─────────────────────────────────────────────────────────────────────────┐ +│ Dell PowerEdge R730 - CQ5QBM2 │ +│ │ +│ ┌───────────────────────────────────────────────────────────────────┐ │ +│ │ Proxmox VE 8.4.x │ │ +│ │ (Hypervisor - Bare Metal) │ │ +│ └───────────────────────────────────────────────────────────────────┘ │ +│ │ +│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────────┐ │ +│ │ Router VM/LXC │ │ macOS VM │ │ Development VMs │ │ +│ │ │ │ (Sequoia 15) │ │ (Linux/Windows) │ │ +│ │ - pfSense/VyOS │ │ │ │ │ │ +│ │ - BGP Routing │ │ OpenCore 1.0.4 │ │ - Docker Host │ │ +│ │ - Firewall │ │ GPU Passthrough │ │ - K8s Cluster │ │ +│ │ - VPN Gateway │ │ USB Passthrough │ │ - CI/CD Runners │ │ +│ └──────────────────┘ └──────────────────┘ └──────────────────────┘ │ +│ │ │ │ │ +│ ┌──────┴──────────────────────┴───────────────────────┴────────────┐ │ +│ │ Virtual Network Bridges (vmbr0-vmbr3) │ │ +│ └──────────────────────────────────────────────────────────────────┘ │ +│ │ │ │ │ +│ ┌──────┴──────────────────────┴───────────────────────┴────────────┐ │ +│ │ Physical NICs (4x10GbE + 2x1GbE + 2x10GbE) │ │ +│ │ eth0: WAN (D0:94:66:24:96:7E) - Telus Fiber │ │ +│ │ eth1: LAN (D0:94:66:24:96:80) - Internal Network │ │ +│ │ eth2-7: Additional NICs for VMs and Passthrough │ │ +│ └──────────────────────────────────────────────────────────────────┘ │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +--- + +## 💻 Hardware Specifications + +### Dell PowerEdge R730 - CQ5QBM2 + +| Component | Specification | Allocation Strategy | +|-----------|--------------|---------------------| +| **CPUs** | 2x Intel Xeon E5-2690 v4 (28 cores, 56 threads) | Host: 4 cores, Router: 8 cores, macOS: 12 cores, Dev: 32 cores | +| **RAM** | 384GB DDR4-2400 (12x 32GB Samsung) | Host: 16GB, Router: 32GB, macOS: 64GB, Dev: 272GB | +| **NICs** | 4x 10GbE + 2x 1GbE (Integrated) | WAN, LAN, Management, Storage | +| **NICs** | 2x 10GbE (Slot 3) | Passthrough to Router VM | +| **Storage** | PERC H730 Mini RAID Controller | ZFS/LVM for VM storage | +| **iDRAC** | iDRAC 8 Enterprise | Out-of-band management | + +### Resource Allocation Table + +``` +┌──────────────────┬───────────┬─────────────┬──────────────┬─────────────┐ +│ VM/Service │ CPU Cores │ RAM (GB) │ Storage (GB) │ Network │ +├──────────────────┼───────────┼─────────────┼──────────────┼─────────────┤ +│ Proxmox Host │ 4 │ 16 │ 100 (OS) │ All NICs │ +│ Router VM │ 8 │ 32 │ 50 │ 4x 10GbE │ +│ macOS Sequoia │ 12 │ 64 │ 256 │ 1x 10GbE │ +│ macOS Sonoma │ 8 │ 32 │ 128 │ virtio │ +│ Development VMs │ 24 │ 240 │ 1000+ │ virtio │ +│ RESERVED │ - │ - │ - │ - │ +└──────────────────┴───────────┴─────────────┴──────────────┴─────────────┘ +Total: 56 cores, 384GB RAM +``` + +--- + +## 📋 Prerequisites + +### Required Components + +- ✅ Dell PowerEdge R730 with iDRAC access +- ✅ Proxmox VE 8.4.x installation media (ISO) +- ✅ Active internet connection during installation +- ✅ Telus Fiber gateway credentials (for BGP configuration) +- ✅ USB drive (8GB+) for Proxmox installer + +### Network Requirements + +- ✅ Static IP for Proxmox management (e.g., 192.168.100.10/24) +- ✅ Gateway IP for internet access during setup +- ✅ DNS servers (e.g., 1.1.1.1, 8.8.8.8) +- ✅ Telus BGP peer IPs: 206.75.1.127, 206.75.1.47, 206.75.1.48 +- ✅ IPv6 prefix: 2602:F674::/48 + +--- + +## 🚀 Installation Process + +### Phase 1: Install Proxmox VE Base System + +#### Step 1.1: Prepare Installation Media + +```bash +# On your workstation, download Proxmox VE ISO +wget https://www.proxmox.com/en/downloads/proxmox-virtual-environment/iso/proxmox-ve-8-4-iso-installer + +# Create bootable USB (Linux/macOS) +sudo dd if=proxmox-ve_8.4.iso of=/dev/sdX bs=1M status=progress +sync + +# Or use Rufus on Windows +``` + +#### Step 1.2: Boot and Install Proxmox + +1. **Access iDRAC** - https://192.168.1.2 (default Dell IP) +2. **Launch Virtual Console** - Console/Media > Launch Virtual Console +3. **Mount ISO** - Virtual Media > Connect CD/DVD > Select Proxmox ISO +4. **Boot from Virtual CD** - Next Boot > Virtual CD/DVD/ISO + +**Installation Wizard:** + +``` +┌─────────────────────────────────────────────────┐ +│ Proxmox VE Installer │ +├─────────────────────────────────────────────────┤ +│ Welcome - Select "Install Proxmox VE (Graphical)│ +│ │ +│ EULA - Accept License Agreement │ +│ │ +│ Target Disk: │ +│ ▸ /dev/sda (PERC H730 RAID Volume) │ +│ Filesystem: ext4 (or ZFS RAID1 for production)│ +│ Disk Setup: Use entire disk │ +│ │ +│ Location and Timezone: │ +│ Country: Canada (or your location) │ +│ Timezone: America/Vancouver │ +│ Keyboard: US │ +│ │ +│ Administrator Password: │ +│ Password: **************** (secure password) │ +│ Confirm: **************** │ +│ Email: admin@orion.local │ +│ │ +│ Network Configuration: │ +│ Management Interface: eno1 (1GbE) │ +│ Hostname: orion-pve.local │ +│ IP Address: 192.168.100.10 │ +│ Netmask: 255.255.255.0 │ +│ Gateway: 192.168.100.1 │ +│ DNS: 1.1.1.1 │ +│ │ +│ Summary - Verify settings and click "Install" │ +└─────────────────────────────────────────────────┘ +``` + +5. **Wait for Installation** (~10-15 minutes) +6. **Reboot** when prompted +7. **Access Web UI** - https://192.168.100.10:8006 + +#### Step 1.3: Post-Installation Configuration + +**Login to Proxmox Shell** (via web UI: Datacenter > orion-pve > Shell) + +```bash +# Disable Enterprise Repository (requires subscription) +rm -f /etc/apt/sources.list.d/pve-enterprise.list +rm -f /etc/apt/sources.list.d/pve-enterprise.sources + +# Add No-Subscription Repository +cat < /etc/apt/sources.list.d/pve-no-subscription.list +deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription +EOF + +# Update system +apt-get update +apt-get dist-upgrade -y + +# Install essential tools +apt-get install -y \ + git curl wget vim tmux htop \ + net-tools bridge-utils vlan \ + ethtool smartmontools \ + iperf3 tcpdump nmap \ + jq bc +``` + +--- + +### Phase 2: Configure Network Bridges for Routing and VMs + +#### Step 2.1: Identify Network Interfaces + +```bash +# List all network interfaces +ip link show + +# Expected output: +# 1: lo: +# 2: eno1: (1GbE - Management) +# 3: eno2: (1GbE) +# 4: eno3: (10GbE - WAN) +# 5: eno4: (10GbE - LAN) +# 6: eno5: (10GbE) +# 7: eno6: (10GbE) +# 8: enp3s0f0: (10GbE Slot 3) +# 9: enp3s0f1: (10GbE Slot 3) + +# Verify MAC addresses match documentation +ip link show | grep -A1 "eno3\|eno4" +# eno3: D0:94:66:24:96:7E (WAN) +# eno4: D0:94:66:24:96:80 (LAN) +``` + +#### Step 2.2: Configure Network Bridges + +**Edit `/etc/network/interfaces`:** + +```bash +# Backup original configuration +cp /etc/network/interfaces /etc/network/interfaces.backup + +# Edit configuration +nano /etc/network/interfaces +``` + +**Configuration:** + +```bash +# /etc/network/interfaces + +auto lo +iface lo inet loopback + +# Management Interface (Proxmox Web UI) +auto eno1 +iface eno1 inet static + address 192.168.100.10/24 + gateway 192.168.100.1 + dns-nameservers 1.1.1.1 8.8.8.8 + +# WAN Bridge (for Router VM) - eno3 (D0:94:66:24:96:7E) +auto vmbr0 +iface vmbr0 inet manual + bridge-ports eno3 + bridge-stp off + bridge-fd 0 + bridge-vlan-aware yes + #WAN interface for Router VM + +# LAN Bridge (Internal Network) - eno4 (D0:94:66:24:96:80) +auto vmbr1 +iface vmbr1 inet static + address 192.168.100.1/24 + bridge-ports eno4 + bridge-stp off + bridge-fd 0 + bridge-vlan-aware yes + #LAN interface for all VMs + +# macOS VM Bridge (Dedicated 10GbE) - eno5 +auto vmbr2 +iface vmbr2 inet manual + bridge-ports eno5 + bridge-stp off + bridge-fd 0 + #Dedicated network for macOS VMs (can enable passthrough) + +# Storage/Backup Bridge - eno6 +auto vmbr3 +iface vmbr3 inet manual + bridge-ports eno6 + bridge-stp off + bridge-fd 0 + #Storage network (NFS, iSCSI, etc.) +``` + +**Apply Network Configuration:** + +```bash +# Test configuration syntax +ifup --no-act vmbr0 +ifup --no-act vmbr1 +ifup --no-act vmbr2 +ifup --no-act vmbr3 + +# Apply configuration (WARNING: May disconnect SSH) +systemctl restart networking + +# Or reboot to be safe +reboot +``` + +#### Step 2.3: Verify Network Configuration + +```bash +# Check bridges +ip addr show + +# Verify bridge members +brctl show + +# Expected output: +# bridge name bridge id STP enabled interfaces +# vmbr0 8000.d094662496fe no eno3 +# vmbr1 8000.d09466249680 no eno4 +# vmbr2 8000.xxxxxxxxxxxx no eno5 +# vmbr3 8000.xxxxxxxxxxxx no eno6 +``` + +--- + +### Phase 3: Install OSX-PROXMOX for macOS Support + +#### Step 3.1: Run Automated Installer + +```bash +# SSH to Proxmox host +ssh root@192.168.100.10 + +# Run the OSX-PROXMOX installer +/bin/bash -c "$(curl -fsSL https://install.osx-proxmox.com)" +``` + +**Expected Output:** + +``` +┌─────────────────────────────────────────────────────────────┐ +│ │ +│ Welcome to OSX-PROXMOX Installer v2025.07.23 │ +│ │ +│ This script will configure your Proxmox VE server to │ +│ support macOS virtual machines with OpenCore 1.0.4 │ +│ │ +│ Supported macOS Versions: │ +│ • High Sierra (10.13) through Sequoia (15) │ +│ │ +│ Features: │ +│ ✓ Automated OpenCore ISO generation │ +│ ✓ GPU passthrough support │ +│ ✓ USB passthrough support │ +│ ✓ VFIO configuration │ +│ ✓ SIP enabled with Apple-signed DMGs only │ +│ │ +└─────────────────────────────────────────────────────────────┘ + +[INFO] Cleaning up existing files... +[INFO] Preparing to install OSX-PROXMOX... +[INFO] Updating package lists... +[INFO] Installing git... +[INFO] Cloning OSX-PROXMOX repository... +[INFO] Running setup script... + +┌─────────────────────────────────────────────────────────────┐ +│ OSX-PROXMOX Setup - Main Menu │ +├─────────────────────────────────────────────────────────────┤ +│ │ +│ 1. Create macOS Virtual Machine │ +│ 2. Configure Network Bridges │ +│ 3. Setup GPU Passthrough (IOMMU) │ +│ 4. Generate SMBIOS Serial Numbers │ +│ 5. Download macOS Recovery Images │ +│ 6. Advanced Configuration │ +│ 7. Exit │ +│ │ +└─────────────────────────────────────────────────────────────┘ + +Select option: 1 +``` + +#### Step 3.2: Create First macOS VM + +**Follow the interactive wizard:** + +``` +┌─────────────────────────────────────────────────────────────┐ +│ Create macOS Virtual Machine - Step 1/7 │ +├─────────────────────────────────────────────────────────────┤ +│ │ +│ Select macOS Version: │ +│ │ +│ 1. High Sierra (10.13) - Legacy hardware support │ +│ 2. Mojave (10.14) - Last 32-bit app support │ +│ 3. Catalina (10.15) - 64-bit only │ +│ 4. Big Sur (11) - ARM transition │ +│ 5. Monterey (12) - Universal Control │ +│ 6. Ventura (13) - Stage Manager │ +│ 7. Sonoma (14) - Widgets on desktop │ +│ 8. Sequoia (15) - Latest (2025) ⭐ RECOMMENDED │ +│ │ +└─────────────────────────────────────────────────────────────┘ + +Selection: 8 + +┌─────────────────────────────────────────────────────────────┐ +│ Create macOS Virtual Machine - Step 2/7 │ +├─────────────────────────────────────────────────────────────┤ +│ │ +│ VM Configuration: │ +│ │ +│ VM ID: 100 (auto-assigned) │ +│ VM Name: HACK-Sequoia-01 │ +│ CPU Cores: 12 (recommended: 8-16 for Sequoia) │ +│ RAM: 64GB (recommended: 32GB+ for Sequoia) │ +│ Disk Size: 256GB (minimum: 128GB) │ +│ Storage: local-lvm │ +│ Network Bridge: vmbr2 (macOS dedicated) │ +│ │ +│ Advanced Options: │ +│ [ ] Enable GPU Passthrough (requires IOMMU) │ +│ [✓] Enable USB Passthrough (keyboard/mouse) │ +│ [✓] CPU Type: Haswell-noTSX (macOS compatible) │ +│ [✓] Machine Type: q35 │ +│ │ +└─────────────────────────────────────────────────────────────┘ + +Proceed? (y/n): y + +[INFO] Downloading macOS Sequoia Recovery Image... +[INFO] Creating OpenCore bootloader ISO... +[INFO] Generating SMBIOS serial numbers (iMacPro1,1)... +[INFO] Creating VM 100 (HACK-Sequoia-01)... +[INFO] Configuring CPU (12 cores, Haswell-noTSX)... +[INFO] Configuring RAM (64GB)... +[INFO] Creating disk (256GB on local-lvm)... +[INFO] Attaching OpenCore ISO... +[INFO] Attaching macOS Recovery ISO... +[INFO] Configuring network (vmbr2, virtio)... +[INFO] Applying macOS-specific QEMU arguments... +[INFO] VM created successfully! + +┌─────────────────────────────────────────────────────────────┐ +│ ✅ VM Creation Complete │ +├─────────────────────────────────────────────────────────────┤ +│ │ +│ VM ID: 100 │ +│ VM Name: HACK-Sequoia-01 │ +│ Status: Stopped │ +│ │ +│ Next Steps: │ +│ 1. Start the VM from Proxmox web UI │ +│ 2. Open VNC console (VM > Console) │ +│ 3. Boot from "macOS Installer" │ +│ 4. Use Disk Utility to format the main disk (APFS) │ +│ 5. Install macOS to the formatted disk │ +│ 6. After installation, configure macOS settings │ +│ 7. Disable Gatekeeper: sudo spctl --master-disable │ +│ │ +│ Web Console: https://192.168.100.10:8006 │ +│ │ +└─────────────────────────────────────────────────────────────┘ +``` + +--- + +### Phase 4: Create Router VM for Network Services + +Now we'll create a dedicated router VM (pfSense or VyOS) to handle the routing, BGP, and firewall functions originally planned for the ORION deployment. + +#### Step 4.1: Download pfSense ISO + +```bash +# Download pfSense CE (latest stable) +cd /var/lib/vz/template/iso/ +wget https://sgpfiles.netgate.com/mirror/downloads/pfSense-CE-2.7.2-RELEASE-amd64.iso.gz +gunzip pfSense-CE-2.7.2-RELEASE-amd64.iso.gz + +# Or VyOS (open-source router) +wget https://github.com/vyos/vyos-rolling/releases/download/1.5-rolling-202501/vyos-1.5-rolling-202501-amd64.iso +``` + +#### Step 4.2: Create Router VM via CLI + +```bash +# Create VM +qm create 200 \ + --name ORION-Router \ + --memory 32768 \ + --cores 8 \ + --cpu host \ + --sockets 1 \ + --numa 1 \ + --ostype other \ + --boot order='ide2;scsi0' \ + --ide2 local:iso/pfSense-CE-2.7.2-RELEASE-amd64.iso,media=cdrom \ + --scsi0 local-lvm:50,cache=writeback,discard=on,ssd=1 \ + --scsihw virtio-scsi-pci \ + --net0 virtio,bridge=vmbr0,firewall=0 \ + --net1 virtio,bridge=vmbr1,firewall=0 \ + --net2 virtio,bridge=vmbr2,firewall=0 \ + --net3 virtio,bridge=vmbr3,firewall=0 \ + --agent 1 \ + --onboot 1 \ + --startup order=1,up=30 + +# Alternative: PCI Passthrough for 10GbE NICs (better performance) +# First, identify the NIC PCI addresses +lspci | grep -i ethernet + +# Example output: +# 03:00.0 Ethernet controller: Intel Corporation 82599ES 10-Gigabit +# 03:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit + +# Enable IOMMU and passthrough +nano /etc/default/grub +# Add: intel_iommu=on iommu=pt (or amd_iommu=on for AMD) +# GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt" + +update-grub +reboot + +# After reboot, configure VFIO +echo "vfio" >> /etc/modules +echo "vfio_iommu_type1" >> /etc/modules +echo "vfio_pci" >> /etc/modules +echo "vfio_virqfd" >> /etc/modules + +update-initramfs -u -k all +reboot + +# Attach PCI devices to VM +qm set 200 --hostpci0 03:00.0 +qm set 200 --hostpci1 03:00.1 +``` + +#### Step 4.3: Install and Configure pfSense + +1. **Start VM 200** - Proxmox UI > VM 200 > Start +2. **Open Console** - VM 200 > Console +3. **Install pfSense** - Follow installation wizard + - Accept EULA + - Select "Install pfSense" + - Partition: Auto (UFS) + - Reboot after installation + +4. **Configure Interfaces** + +``` +┌───────────────────────────────────────────┐ +│ pfSense Initial Configuration │ +├───────────────────────────────────────────┤ +│ │ +│ Should VLANs be set up now? n │ +│ │ +│ Enter WAN interface name: vtnet0 │ +│ Enter LAN interface name: vtnet1 │ +│ Enter OPT1 interface name: vtnet2 │ +│ Enter OPT2 interface name: vtnet3 │ +│ │ +│ Proceed? y │ +│ │ +└───────────────────────────────────────────┘ + +┌───────────────────────────────────────────┐ +│ Configure WAN Interface │ +├───────────────────────────────────────────┤ +│ Configure IPv4 via DHCP? n │ +│ IPv4 Address: 206.75.1.126 │ +│ Subnet: 24 │ +│ Upstream Gateway: 206.75.1.1 │ +│ │ +│ Configure IPv6 via DHCP6? n │ +│ IPv6 Address: 2602:F674::1 │ +│ Prefix: 48 │ +│ │ +└───────────────────────────────────────────┘ + +┌───────────────────────────────────────────┐ +│ Configure LAN Interface │ +├───────────────────────────────────────────┤ +│ IPv4 Address: 192.168.100.1 │ +│ Subnet: 24 │ +│ IPv6 Address: 2602:F674:1000::1 │ +│ Prefix: 64 │ +│ │ +│ Enable DHCP server? y │ +│ Start: 192.168.100.100 │ +│ End: 192.168.100.254 │ +│ │ +└───────────────────────────────────────────┘ +``` + +5. **Access Web UI** - https://192.168.100.1 (admin/pfsense) + +6. **Configure BGP** (via FRR package) + +```bash +# In pfSense Web UI: +# System > Package Manager > Available Packages +# Search for "FRR" and install + +# Services > FRR > Global Settings +# Enable: [✓] Enable FRR +# Default Router ID: 100.64.0.1 + +# Services > FRR > BGP +# Enable: [✓] Enable BGP Routing +# Local AS: 394955 + +# Add BGP Neighbors (Telus Gateways) +┌─────────────────────────────────────────────┐ +│ Neighbor 1: │ +│ IP: 206.75.1.127 │ +│ Remote AS: 6939 (Hurricane Electric) │ +│ Description: Telus Gateway 1 │ +│ Enable: ✓ │ +│ │ +│ Neighbor 2: │ +│ IP: 206.75.1.47 │ +│ Remote AS: 6939 │ +│ Description: Telus Gateway 2 │ +│ Enable: ✓ │ +│ │ +│ Neighbor 3: │ +│ IP: 206.75.1.48 │ +│ Remote AS: 6939 │ +│ Description: Telus Gateway 3 │ +│ Enable: ✓ │ +└─────────────────────────────────────────────┘ + +# Configure Route Redistribution +# Services > FRR > BGP > Advanced +# Redistribute: Connected Routes, Static Routes +``` + +--- + +### Phase 5: Testing and Validation + +#### Test 1: Proxmox Host Connectivity + +```bash +# From Proxmox host +ping -c 4 1.1.1.1 +ping -c 4 google.com +ip addr show +brctl show +``` + +#### Test 2: Router VM Network + +```bash +# From pfSense console (VM 200) +# Option 7: Ping host +ping -c 4 206.75.1.127 # Telus gateway +ping -c 4 8.8.8.8 # Internet + +# Check BGP sessions +# Option 8: Shell +vtysh +show ip bgp summary +show ip bgp neighbors +show ip route +``` + +#### Test 3: macOS VM Installation + +``` +1. Start VM 100 (HACK-Sequoia-01) +2. Open VNC Console +3. Boot to macOS Installer +4. Expected: OpenCore boot menu appears +5. Select "macOS Installer" +6. Open Disk Utility +7. Erase main disk as APFS +8. Close Disk Utility +9. Install macOS to the formatted disk +10. Wait 30-45 minutes for installation +11. Complete macOS setup wizard +12. Verify network connectivity (should get IP from 192.168.100.0/24) +``` + +#### Test 4: Performance Validation + +```bash +# Network throughput test +# From a client on LAN: +iperf3 -s # On macOS VM or dev VM + +# From another client: +iperf3 -c 192.168.100.x -t 60 -P 10 + +# Expected: >9 Gbps on 10GbE interfaces + +# CPU performance (on macOS VM) +# Install Geekbench from App Store +# Run CPU benchmark +# Expected: Single-core >1000, Multi-core >10000 (12 cores) + +# Storage performance (on macOS VM) +# Install Blackmagic Disk Speed Test +# Run test +# Expected: >500 MB/s read/write on virtio-scsi +``` + +--- + +## 📊 Monitoring and Management + +### Proxmox Monitoring + +```bash +# Install monitoring tools +apt-get install -y prometheus prometheus-node-exporter grafana + +# Enable Prometheus +systemctl enable prometheus prometheus-node-exporter +systemctl start prometheus prometheus-node-exporter + +# Configure Grafana +systemctl enable grafana-server +systemctl start grafana-server + +# Access Grafana: http://192.168.100.10:3000 +# Default credentials: admin/admin +# Import Proxmox dashboard: Dashboard ID 10048 +``` + +### Router Monitoring + +``` +pfSense Web UI > Status > Dashboard +- Interface Statistics +- BGP Session Status +- Gateway Status +- Traffic Graphs +- System Resources + +Configure Alerts: +System > Advanced > Notifications +- Email alerts for gateway down +- BGP session state changes +- High CPU/memory usage +``` + +### macOS VM Monitoring + +```bash +# From macOS terminal +# CPU usage +top + +# Network stats +nettop + +# Disk I/O +iostat -w 1 + +# System info +system_profiler SPHardwareDataType +``` + +--- + +## 🔧 Troubleshooting + +### Issue 1: macOS VM Won't Boot + +**Symptoms:** Stuck at Apple logo, blank screen, or reboot loop + +**Solutions:** + +```bash +# 1. Check VM configuration +qm config 100 | grep -E "cpu|args" + +# 2. Verify OpenCore ISO is attached +qm config 100 | grep ide2 + +# 3. Ensure CPU type is compatible +qm set 100 --cpu Haswell-noTSX + +# 4. Check TSC (timestamp counter) +dmesg | grep -i tsc +# Should show: "clocksource: Switched to clocksource tsc" + +# 5. Force TSC if needed +nano /etc/default/grub +# Add: clocksource=tsc tsc=reliable +update-grub +reboot +``` + +### Issue 2: BGP Sessions Not Establishing + +**Symptoms:** pfSense shows BGP neighbors in "Active" or "Connect" state + +**Solutions:** + +```bash +# 1. Verify WAN interface has correct IP +# pfSense > Interfaces > WAN +# Ensure static IP is configured correctly + +# 2. Check routing to BGP peers +# pfSense > Diagnostics > Ping +ping -S 206.75.1.126 206.75.1.127 # Use WAN IP as source + +# 3. Verify FRR is running +# pfSense > Status > Services +# Ensure FRR service is running + +# 4. Check BGP configuration +vtysh +show run +# Verify "router bgp 394955" section exists + +# 5. Debug BGP +debug bgp +tail -f /var/log/frr/frr.log +``` + +### Issue 3: Poor Network Performance + +**Symptoms:** Low throughput (<1 Gbps on 10GbE), high latency + +**Solutions:** + +```bash +# 1. Enable virtio offloading +qm set 100 --net0 virtio,bridge=vmbr2,firewall=0 + +# 2. Tune VM CPU settings +qm set 100 --cpu host + +# 3. Enable NUMA +qm set 100 --numa 1 + +# 4. Disable firewall on bridge (if not needed) +qm set 100 --net0 virtio,bridge=vmbr2,firewall=0 + +# 5. Check for packet loss +ethtool -S vmbr2 | grep -i drop + +# 6. Increase TX/RX ring buffers +ethtool -g eno5 +ethtool -G eno5 rx 4096 tx 4096 +``` + +### Issue 4: GPU Passthrough Not Working + +**Symptoms:** macOS shows black screen on external monitor + +**Solutions:** + +```bash +# 1. Verify IOMMU is enabled +dmesg | grep -i iommu +# Should show IOMMU enabled messages + +# 2. Check IOMMU groups +find /sys/kernel/iommu_groups/ -type l + +# 3. Verify GPU is bound to vfio-pci +lspci -k | grep -A 3 VGA + +# 4. Disable "Above 4G Decoding" in BIOS +# (Access via iDRAC > BIOS Settings) + +# 5. Add ACS override if needed +nano /etc/default/grub +# Add: pcie_acs_override=downstream,multifunction +update-grub +reboot +``` + +--- + +## 📚 Additional Resources + +### Documentation + +- **Proxmox VE:** https://pve.proxmox.com/pve-docs/ +- **OSX-PROXMOX:** https://github.com/luchina-gabriel/OSX-PROXMOX +- **pfSense:** https://docs.netgate.com/pfsense/ +- **FRR (BGP):** https://docs.frrouting.org/ +- **OpenCore:** https://dortania.github.io/OpenCore-Install-Guide/ + +### Community Support + +- **Proxmox Forum:** https://forum.proxmox.com/ +- **Universo Hackintosh (Discord):** https://discord.universohackintosh.com.br +- **pfSense Forum:** https://forum.netgate.com/ +- **Reddit:** r/Proxmox, r/hackintosh, r/homelab + +--- + +## ✅ Success Criteria Checklist + +- [ ] Proxmox VE installed and accessible via web UI +- [ ] All 8 network interfaces detected and configured +- [ ] Network bridges (vmbr0-vmbr3) created and functional +- [ ] OSX-PROXMOX installer completed successfully +- [ ] macOS Sequoia VM created and boots to installer +- [ ] macOS installation completes and reaches desktop +- [ ] Router VM (pfSense) installed and configured +- [ ] BGP sessions established with all 3 Telus gateways +- [ ] IPv4 and IPv6 routing working (can reach internet from LAN) +- [ ] Network performance >9 Gbps on 10GbE interfaces +- [ ] Latency <2ms to Telus gateways from router +- [ ] All VMs auto-start on boot (onboot=1) +- [ ] Monitoring dashboards operational (Grafana, pfSense) +- [ ] Backup strategy configured (Proxmox Backup Server or scripts) +- [ ] Documentation updated with actual IP addresses and settings + +--- + +## 🎯 Next Steps After Deployment + +### Week 1: Stabilization +- Monitor all VMs for 7 days +- Fine-tune CPU core allocation +- Optimize network throughput +- Configure automated backups + +### Week 2: Development Environment +- Create Linux dev VMs (Ubuntu, Debian) +- Setup Docker host VM +- Configure NFS/iSCSI storage +- Deploy CI/CD runners + +### Week 3: Advanced Features +- Implement HA (High Availability) clustering +- Configure GPU passthrough for macOS +- Setup VPN server (WireGuard/OpenVPN) +- Implement monitoring alerts + +### Week 4: Production Hardening +- Security audit (firewall rules, SSH hardening) +- Disaster recovery testing +- Performance benchmarking +- Documentation finalization + +--- + +## 🔐 Security Recommendations + +### Proxmox Host + +```bash +# Change default SSH port +nano /etc/ssh/sshd_config +# Port 2222 + +# Disable root SSH login +# PermitRootLogin no + +# Enable fail2ban +apt-get install -y fail2ban +systemctl enable fail2ban +systemctl start fail2ban + +# Configure UFW firewall +apt-get install -y ufw +ufw default deny incoming +ufw default allow outgoing +ufw allow 2222/tcp # SSH +ufw allow 8006/tcp # Proxmox web UI +ufw enable +``` + +### pfSense Router + +``` +1. Enable automatic updates + System > Update > Check for Updates + +2. Configure firewall rules (deny-all default) + Firewall > Rules > WAN + - Block all inbound except established/related + - Rate limit ICMP + +3. Enable IDS/IPS (Snort or Suricata) + System > Package Manager > Install Suricata + Services > Suricata > Enable + +4. Configure VPN (WireGuard recommended) + VPN > WireGuard > Add Tunnel + - Use for remote management + +5. Enable logging + Status > System Logs > Settings + - Log to remote syslog server +``` + +--- + +## 📝 Conclusion + +You now have a **unified Proxmox-based platform** running on the Dell PowerEdge R730 (ORION) that provides: + +✅ **Enterprise Routing** - pfSense with BGP, replacing Telus modem +✅ **macOS Virtualization** - Run Sequoia and other macOS versions +✅ **Development Platform** - Host additional VMs and containers +✅ **High Performance** - 10GbE networking, 56 CPU cores, 384GB RAM +✅ **Scalability** - Easy to add more VMs and services +✅ **Manageability** - Centralized Proxmox web UI for all resources + +**Total Setup Time:** ~4-6 hours (depending on experience level) + +**Questions or issues?** Refer to the troubleshooting section or community resources above. + +--- + +**Document Version:** 1.0.0 +**Last Updated:** 2025-01-19 +**Maintained By:** ORION Project Team +**License:** MIT (where applicable, respecting upstream licenses) diff --git a/ORION_QUICKSTART.md b/ORION_QUICKSTART.md new file mode 100644 index 0000000..28ba954 --- /dev/null +++ b/ORION_QUICKSTART.md @@ -0,0 +1,286 @@ +# ORION Quick Start Guide + +## Dell R730 CQ5QBM2 - Proxmox with macOS and Routing + +This guide provides a quick start for deploying the ORION platform on Dell PowerEdge R730. + +--- + +## What is ORION? + +**ORION** is a unified platform that combines: + +1. **High-Performance Router** - pfSense with BGP, replacing ISP modem +2. **macOS Virtualization** - Run macOS Sequoia and other versions +3. **Development Platform** - Host Linux/Windows VMs and containers + +All running on **Proxmox VE** hypervisor on Dell PowerEdge R730 hardware. + +--- + +## Hardware Requirements + +- **Server:** Dell PowerEdge R730 (Service Tag: CQ5QBM2) +- **CPU:** 2x Intel Xeon E5-2690 v4 (56 threads total) +- **RAM:** 384GB DDR4-2400 +- **NICs:** 8x Network Interfaces (4x10GbE + 2x1GbE + 2x10GbE) +- **Storage:** PERC H730 RAID Controller + +--- + +## Quick Installation (5 Steps) + +### Step 1: Install Proxmox VE + +1. Download Proxmox VE ISO from https://www.proxmox.com/en/downloads +2. Create bootable USB drive +3. Boot Dell R730 from USB (via iDRAC Virtual Media) +4. Install Proxmox VE with default settings +5. Configure management IP: 192.168.100.10/24 + +**Time:** ~15 minutes + +### Step 2: Run Automated Deployment + +```bash +# SSH to Proxmox server +ssh root@192.168.100.10 + +# Download deployment script +git clone https://github.com/luci-digital/luci-macOSX-PROXMOX.git /root/orion-deploy +cd /root/orion-deploy + +# Run full deployment +./deploy-orion.sh --full-deploy +``` + +**Time:** ~30-60 minutes (downloads ISOs, creates VMs) + +### Step 3: Configure Router VM (pfSense) + +1. Access Proxmox Web UI: https://192.168.100.10:8006 +2. Start VM 200 (ORION-Router) +3. Open Console and install pfSense +4. Configure WAN interface (Telus connection) +5. Configure BGP peering (FRR package) + +**Time:** ~20 minutes + +### Step 4: Install macOS + +1. Start VM 100 (HACK-Sequoia-01) +2. Open VNC Console +3. Boot from "macOS Installer" +4. Format disk with Disk Utility (APFS) +5. Install macOS Sequoia +6. Complete setup wizard + +**Time:** ~45-60 minutes + +### Step 5: Install Monitoring Services + +```bash +# On Proxmox host +cd /root/orion-deploy/scripts +./install-orion-services.sh + +# Start monitoring +systemctl start orion-gateway-monitor +systemctl start orion-bgp-monitor +systemctl start orion-vm-watchdog +``` + +**Time:** ~5 minutes + +--- + +## Architecture Overview + +``` +Proxmox VE (Hypervisor) +├── VM 200: ORION-Router (pfSense) +│ ├── WAN: vmbr0 (eno3) → Telus Fiber +│ ├── LAN: vmbr1 (eno4) → Internal Network +│ └── BGP: AS 394955 → Telus AS 6939 +│ +├── VM 100: HACK-Sequoia-01 (macOS) +│ ├── CPU: 12 cores +│ ├── RAM: 64GB +│ └── Network: vmbr2 (dedicated 10GbE) +│ +└── Monitoring Services + ├── Gateway Monitor (ping Telus gateways) + ├── BGP Monitor (check BGP sessions) + └── VM Watchdog (auto-restart critical VMs) +``` + +--- + +## Network Configuration + +| Bridge | Interface | Purpose | IP Address | +|--------|-----------|---------|------------| +| vmbr0 | eno3 | WAN (Router VM) | - | +| vmbr1 | eno4 | LAN (Internal) | 192.168.100.1/24 | +| vmbr2 | eno5 | macOS VMs | - | +| vmbr3 | eno6 | Storage | - | + +--- + +## Resource Allocation + +| Component | CPU Cores | RAM | Purpose | +|-----------|-----------|-----|---------| +| Proxmox Host | 4 | 16GB | Hypervisor | +| Router VM | 8 | 32GB | Routing, BGP | +| macOS VM | 12 | 64GB | Development | +| Available | 32 | 272GB | Other VMs | + +--- + +## Access Points + +| Service | URL | Default Credentials | +|---------|-----|---------------------| +| Proxmox Web UI | https://192.168.100.10:8006 | root / (set during install) | +| pfSense Web UI | https://192.168.100.1 | admin / pfsense | +| iDRAC | https://192.168.1.2 | (Dell default) | +| Grafana | http://192.168.100.10:3000 | admin / admin | + +--- + +## Common Tasks + +### Start/Stop VMs + +```bash +# Start router +qm start 200 + +# Stop router +qm stop 200 + +# Check status +qm status 200 +``` + +### View Monitoring Logs + +```bash +# Gateway monitor +journalctl -u orion-gateway-monitor -f + +# BGP monitor +journalctl -u orion-bgp-monitor -f + +# VM watchdog +journalctl -u orion-vm-watchdog -f + +# All ORION logs +tail -f /var/log/orion/*.log +``` + +### Backup VMs + +```bash +# Backup router VM +vzdump 200 --mode snapshot --compress zstd --storage local + +# Backup macOS VM +vzdump 100 --mode snapshot --compress zstd --storage local +``` + +### Update Proxmox + +```bash +apt-get update +apt-get dist-upgrade +pveam update +``` + +--- + +## Troubleshooting + +### macOS Won't Boot + +**Problem:** Stuck at Apple logo or blank screen + +**Solution:** + +```bash +# Check TSC (should show "tsc") +cat /sys/devices/system/clocksource/clocksource0/current_clocksource + +# Force TSC if needed +nano /etc/default/grub +# Add: clocksource=tsc tsc=reliable +update-grub +reboot +``` + +### BGP Sessions Not Establishing + +**Problem:** pfSense shows BGP neighbors in "Active" state + +**Solution:** + +1. Verify WAN interface has correct IP +2. Check routing to BGP peers: `ping -S 206.75.1.126 206.75.1.127` +3. Verify FRR is running: `Status > Services` +4. Check FRR logs: `/var/log/frr/frr.log` + +### Poor Network Performance + +**Problem:** Low throughput or high latency + +**Solution:** + +```bash +# Enable virtio offloading +qm set 100 --net0 virtio,bridge=vmbr2,firewall=0 + +# Tune NIC ring buffers +ethtool -G eno5 rx 4096 tx 4096 + +# Enable performance tuning service +systemctl restart orion-performance-tuning +``` + +--- + +## Documentation + +- **Complete Guide:** [DELL_R730_ORION_PROXMOX_INTEGRATION.md](DELL_R730_ORION_PROXMOX_INTEGRATION.md) +- **Proxmox Docs:** https://pve.proxmox.com/pve-docs/ +- **OSX-PROXMOX:** https://github.com/luchina-gabriel/OSX-PROXMOX +- **pfSense Docs:** https://docs.netgate.com/pfsense/ + +--- + +## Support + +- **Issues:** https://github.com/luci-digital/Dell_R730_CQ5QBM2_ORION/issues +- **Proxmox Forum:** https://forum.proxmox.com/ +- **Universo Hackintosh:** https://discord.universohackintosh.com.br + +--- + +## Success Checklist + +- [ ] Proxmox VE installed and accessible +- [ ] Network bridges configured (vmbr0-vmbr3) +- [ ] Router VM created and pfSense installed +- [ ] BGP sessions established with Telus gateways +- [ ] macOS VM created and Sequoia installed +- [ ] Monitoring services running +- [ ] Internet connectivity verified from LAN +- [ ] Backup strategy configured + +--- + +**Version:** 1.0.0 +**Last Updated:** 2025-01-19 +**Deployment Time:** ~2-3 hours (full setup) + +Happy virtualizing! 🚀 diff --git a/deploy-orion.sh b/deploy-orion.sh new file mode 100755 index 0000000..5c3b14b --- /dev/null +++ b/deploy-orion.sh @@ -0,0 +1,654 @@ +#!/bin/bash + +######################################################################################################################### +# +# Script: deploy-orion.sh +# Purpose: Deploy Proxmox with macOS support on Dell R730 ORION +# Description: Automated deployment script for integrating OSX-PROXMOX with Dell PowerEdge R730 CQ5QBM2 +# +# Usage: ./deploy-orion.sh [OPTIONS] +# Options: +# --install-proxmox Install and configure Proxmox VE base system +# --configure-network Configure network bridges for routing and VMs +# --install-osx Install OSX-PROXMOX for macOS support +# --create-router-vm Create and configure router VM (pfSense) +# --create-macos-vm Create macOS Sequoia VM +# --full-deploy Execute all deployment steps +# --help Display this help message +# +######################################################################################################################### + +# Exit on any error +set -e + +# Color codes for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Configuration +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +LOG_DIR="/var/log/orion-deploy" +LOG_FILE="${LOG_DIR}/deploy-$(date +%Y%m%d-%H%M%S).log" +CONFIG_FILE="${SCRIPT_DIR}/orion-config.json" + +# Dell R730 ORION Specifications +DELL_SERVICE_TAG="CQ5QBM2" +TOTAL_CPU_CORES=56 +TOTAL_RAM_GB=384 +TOTAL_NICS=8 + +# Network Interface Mapping (Dell R730 specific) +WAN_INTERFACE="eno3" # D0:94:66:24:96:7E - 10GbE +LAN_INTERFACE="eno4" # D0:94:66:24:96:80 - 10GbE +MACOS_INTERFACE="eno5" # 10GbE +STORAGE_INTERFACE="eno6" # 10GbE +MGMT_INTERFACE="eno1" # 1GbE - Proxmox management + +# Network Configuration +PROXMOX_IP="192.168.100.10" +PROXMOX_GATEWAY="192.168.100.1" +PROXMOX_NETMASK="24" +PROXMOX_DNS="1.1.1.1 8.8.8.8" + +# Telus BGP Configuration +TELUS_AS="6939" +LOCAL_AS="394955" +TELUS_GATEWAY1="206.75.1.127" +TELUS_GATEWAY2="206.75.1.47" +TELUS_GATEWAY3="206.75.1.48" +IPV6_PREFIX="2602:F674::/48" + +# VM Configuration +ROUTER_VM_ID=200 +ROUTER_VM_NAME="ORION-Router" +ROUTER_CPU_CORES=8 +ROUTER_RAM_GB=32 +ROUTER_DISK_GB=50 + +MACOS_VM_ID=100 +MACOS_VM_NAME="HACK-Sequoia-01" +MACOS_CPU_CORES=12 +MACOS_RAM_GB=64 +MACOS_DISK_GB=256 + +# Functions + +log() { + local level=$1 + shift + local message="$@" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + + case $level in + INFO) + echo -e "${BLUE}[INFO]${NC} $message" | tee -a "$LOG_FILE" + ;; + SUCCESS) + echo -e "${GREEN}[SUCCESS]${NC} $message" | tee -a "$LOG_FILE" + ;; + WARNING) + echo -e "${YELLOW}[WARNING]${NC} $message" | tee -a "$LOG_FILE" + ;; + ERROR) + echo -e "${RED}[ERROR]${NC} $message" | tee -a "$LOG_FILE" + ;; + esac + + echo "${timestamp} [${level}] ${message}" >> "$LOG_FILE" +} + +check_root() { + if [ "$EUID" -ne 0 ]; then + log ERROR "This script must be run as root" + exit 1 + fi +} + +check_hardware() { + log INFO "Validating Dell R730 hardware..." + + # Check if running on Dell hardware + if command -v dmidecode >/dev/null 2>&1; then + local system_manufacturer=$(dmidecode -s system-manufacturer 2>/dev/null) + local system_product=$(dmidecode -s system-product-name 2>/dev/null) + local service_tag=$(dmidecode -s system-serial-number 2>/dev/null) + + log INFO "System Manufacturer: $system_manufacturer" + log INFO "System Product: $system_product" + log INFO "Service Tag: $service_tag" + + if [[ ! "$system_manufacturer" =~ "Dell" ]]; then + log WARNING "Not running on Dell hardware. Proceeding anyway..." + fi + + if [[ "$service_tag" != "$DELL_SERVICE_TAG" ]]; then + log WARNING "Service tag mismatch. Expected: $DELL_SERVICE_TAG, Got: $service_tag" + log WARNING "Proceeding anyway, but configuration may need adjustment." + fi + else + log WARNING "dmidecode not available. Skipping hardware validation." + fi + + # Check CPU cores + local cpu_cores=$(nproc) + log INFO "Detected CPU cores: $cpu_cores" + + if [ "$cpu_cores" -lt 28 ]; then + log WARNING "Expected $TOTAL_CPU_CORES cores, found $cpu_cores. Configuration may need adjustment." + fi + + # Check RAM + local total_ram_kb=$(grep MemTotal /proc/meminfo | awk '{print $2}') + local total_ram_gb=$((total_ram_kb / 1024 / 1024)) + log INFO "Detected RAM: ${total_ram_gb}GB" + + if [ "$total_ram_gb" -lt 256 ]; then + log WARNING "Expected ${TOTAL_RAM_GB}GB RAM, found ${total_ram_gb}GB. Configuration may need adjustment." + fi + + # Check network interfaces + local nic_count=$(ip link show | grep -c "^[0-9].*: en") + log INFO "Detected network interfaces: $nic_count" + + log SUCCESS "Hardware validation complete" +} + +check_proxmox() { + log INFO "Checking Proxmox VE installation..." + + if ! command -v pveversion >/dev/null 2>&1; then + log ERROR "Proxmox VE not detected. Please install Proxmox VE first." + log INFO "Visit: https://www.proxmox.com/en/downloads/proxmox-virtual-environment/iso" + exit 1 + fi + + local pve_version=$(pveversion | grep "pve-manager" | awk '{print $2}') + log INFO "Proxmox VE version: $pve_version" + + # Check if version is 7.0 or higher + local major_version=$(echo $pve_version | cut -d'/' -f1 | cut -d'.' -f1) + if [ "$major_version" -lt 7 ]; then + log WARNING "Proxmox VE version $pve_version is older than recommended (7.0+)" + fi + + log SUCCESS "Proxmox VE installation verified" +} + +configure_repositories() { + log INFO "Configuring Proxmox repositories..." + + # Remove enterprise repositories + if [ -f /etc/apt/sources.list.d/pve-enterprise.list ]; then + log INFO "Removing enterprise repository..." + rm -f /etc/apt/sources.list.d/pve-enterprise.list + fi + + if [ -f /etc/apt/sources.list.d/pve-enterprise.sources ]; then + rm -f /etc/apt/sources.list.d/pve-enterprise.sources + fi + + if [ -f /etc/apt/sources.list.d/ceph.list ]; then + rm -f /etc/apt/sources.list.d/ceph.list + fi + + if [ -f /etc/apt/sources.list.d/ceph.sources ]; then + rm -f /etc/apt/sources.list.d/ceph.sources + fi + + # Add no-subscription repository + log INFO "Adding no-subscription repository..." + cat > /etc/apt/sources.list.d/pve-no-subscription.list <> "$LOG_FILE" 2>&1 + + log SUCCESS "Repositories configured" +} + +install_packages() { + log INFO "Installing required packages..." + + local packages=( + "git" "curl" "wget" "vim" "tmux" "htop" "iotop" + "net-tools" "bridge-utils" "vlan" "ifenslave" + "ethtool" "smartmontools" "lm-sensors" + "iperf3" "tcpdump" "nmap" "mtr" + "jq" "bc" "pv" "rsync" + "python3-pip" "build-essential" + ) + + for package in "${packages[@]}"; do + if ! dpkg -l | grep -q "^ii $package"; then + log INFO "Installing $package..." + apt-get install -y "$package" >> "$LOG_FILE" 2>&1 + else + log INFO "$package already installed" + fi + done + + log SUCCESS "Packages installed" +} + +configure_network_bridges() { + log INFO "Configuring network bridges..." + + # Backup existing configuration + if [ -f /etc/network/interfaces ]; then + log INFO "Backing up existing network configuration..." + cp /etc/network/interfaces /etc/network/interfaces.backup-$(date +%Y%m%d-%H%M%S) + fi + + # Create new network configuration + log INFO "Creating network bridge configuration..." + cat > /etc/network/interfaces </dev/null 2>&1; then + log SUCCESS "Bridge $bridge exists" + + # Show bridge members + local members=$(bridge link show | grep "$bridge" | awk '{print $2}' | cut -d'@' -f1 | tr '\n' ' ') + log INFO " Members: $members" + else + log WARNING "Bridge $bridge does not exist (may need reboot)" + fi + done + + # Check internet connectivity + if ping -c 3 1.1.1.1 >/dev/null 2>&1; then + log SUCCESS "Internet connectivity verified" + else + log WARNING "No internet connectivity detected" + fi +} + +install_osx_proxmox() { + log INFO "Installing OSX-PROXMOX..." + + # Run the official installer + log INFO "Running OSX-PROXMOX installer from https://install.osx-proxmox.com" + + if /bin/bash -c "$(curl -fsSL https://install.osx-proxmox.com)" >> "$LOG_FILE" 2>&1; then + log SUCCESS "OSX-PROXMOX installed successfully" + else + log ERROR "OSX-PROXMOX installation failed. Check log: $LOG_FILE" + exit 1 + fi +} + +create_router_vm() { + log INFO "Creating router VM (pfSense)..." + + # Check if VM already exists + if qm status "$ROUTER_VM_ID" >/dev/null 2>&1; then + log WARNING "VM $ROUTER_VM_ID already exists. Skipping creation." + return 0 + fi + + # Download pfSense ISO if not present + local pfsense_iso="/var/lib/vz/template/iso/pfSense-CE-2.7.2-RELEASE-amd64.iso" + if [ ! -f "$pfsense_iso" ]; then + log INFO "Downloading pfSense ISO..." + cd /var/lib/vz/template/iso/ + wget -q --show-progress \ + https://sgpfiles.netgate.com/mirror/downloads/pfSense-CE-2.7.2-RELEASE-amd64.iso.gz \ + -O pfSense-CE-2.7.2-RELEASE-amd64.iso.gz + gunzip pfSense-CE-2.7.2-RELEASE-amd64.iso.gz + log SUCCESS "pfSense ISO downloaded" + else + log INFO "pfSense ISO already present" + fi + + # Create VM + log INFO "Creating VM $ROUTER_VM_ID ($ROUTER_VM_NAME)..." + qm create "$ROUTER_VM_ID" \ + --name "$ROUTER_VM_NAME" \ + --memory $((ROUTER_RAM_GB * 1024)) \ + --cores "$ROUTER_CPU_CORES" \ + --cpu host \ + --sockets 1 \ + --numa 1 \ + --ostype other \ + --boot order='ide2;scsi0' \ + --ide2 local:iso/pfSense-CE-2.7.2-RELEASE-amd64.iso,media=cdrom \ + --scsi0 local-lvm:${ROUTER_DISK_GB},cache=writeback,discard=on,ssd=1 \ + --scsihw virtio-scsi-pci \ + --net0 virtio,bridge=vmbr0,firewall=0 \ + --net1 virtio,bridge=vmbr1,firewall=0 \ + --net2 virtio,bridge=vmbr2,firewall=0 \ + --net3 virtio,bridge=vmbr3,firewall=0 \ + --agent 1 \ + --onboot 1 \ + --startup order=1,up=30 \ + >> "$LOG_FILE" 2>&1 + + log SUCCESS "Router VM created (ID: $ROUTER_VM_ID)" + log INFO "To complete setup:" + log INFO " 1. Start VM: qm start $ROUTER_VM_ID" + log INFO " 2. Open console: Access via Proxmox web UI" + log INFO " 3. Install pfSense and configure interfaces" + log INFO " 4. Configure BGP with Telus gateways" +} + +create_macos_vm() { + log INFO "Creating macOS VM..." + + # Check if VM already exists + if qm status "$MACOS_VM_ID" >/dev/null 2>&1; then + log WARNING "VM $MACOS_VM_ID already exists. Skipping creation." + return 0 + fi + + # This requires OSX-PROXMOX to be installed first + if [ ! -d "/root/OSX-PROXMOX" ]; then + log ERROR "OSX-PROXMOX not installed. Run --install-osx first." + exit 1 + fi + + log INFO "Launching OSX-PROXMOX setup wizard..." + log INFO "Please follow the interactive prompts to create macOS VM." + log INFO "Recommended settings:" + log INFO " - macOS Version: Sequoia (15)" + log INFO " - VM ID: $MACOS_VM_ID" + log INFO " - VM Name: $MACOS_VM_NAME" + log INFO " - CPU Cores: $MACOS_CPU_CORES" + log INFO " - RAM: ${MACOS_RAM_GB}GB" + log INFO " - Disk Size: ${MACOS_DISK_GB}GB" + log INFO " - Network Bridge: vmbr2" + + # Run the setup script + /root/OSX-PROXMOX/setup + + log SUCCESS "macOS VM creation wizard completed" +} + +generate_summary() { + log INFO "========================================" + log INFO "ORION Deployment Summary" + log INFO "========================================" + log INFO "" + log INFO "Hardware:" + log INFO " Dell PowerEdge R730 (Service Tag: $DELL_SERVICE_TAG)" + log INFO " CPU: $TOTAL_CPU_CORES cores" + log INFO " RAM: ${TOTAL_RAM_GB}GB" + log INFO " NICs: $TOTAL_NICS x 10GbE/1GbE" + log INFO "" + log INFO "Proxmox VE:" + log INFO " Management IP: https://${PROXMOX_IP}:8006" + log INFO " Default credentials: root / (password set during install)" + log INFO "" + log INFO "Network Bridges:" + log INFO " vmbr0: WAN (${WAN_INTERFACE}) - Router VM" + log INFO " vmbr1: LAN (${LAN_INTERFACE}) - Internal network" + log INFO " vmbr2: macOS (${MACOS_INTERFACE}) - macOS VMs" + log INFO " vmbr3: Storage (${STORAGE_INTERFACE}) - Storage network" + log INFO "" + log INFO "Virtual Machines:" + log INFO " VM $ROUTER_VM_ID: $ROUTER_VM_NAME (${ROUTER_CPU_CORES} cores, ${ROUTER_RAM_GB}GB RAM)" + log INFO " VM $MACOS_VM_ID: $MACOS_VM_NAME (${MACOS_CPU_CORES} cores, ${MACOS_RAM_GB}GB RAM)" + log INFO "" + log INFO "Telus BGP Configuration:" + log INFO " Local AS: $LOCAL_AS" + log INFO " Telus AS: $TELUS_AS" + log INFO " Gateway 1: $TELUS_GATEWAY1" + log INFO " Gateway 2: $TELUS_GATEWAY2" + log INFO " Gateway 3: $TELUS_GATEWAY3" + log INFO " IPv6 Prefix: $IPV6_PREFIX" + log INFO "" + log INFO "Next Steps:" + log INFO " 1. Configure pfSense router (VM $ROUTER_VM_ID)" + log INFO " 2. Setup BGP peering with Telus gateways" + log INFO " 3. Install macOS on VM $MACOS_VM_ID" + log INFO " 4. Configure monitoring and backups" + log INFO "" + log INFO "Documentation:" + log INFO " ${SCRIPT_DIR}/DELL_R730_ORION_PROXMOX_INTEGRATION.md" + log INFO "" + log INFO "Logs:" + log INFO " $LOG_FILE" + log INFO "" + log INFO "========================================" +} + +show_help() { + cat </dev/null 2>&1; then + local router_status=$(qm status "$ROUTER_VM_ID" | awk '{print $2}') + log INFO "Router VM ($ROUTER_VM_ID): $router_status" + else + log WARNING "Router VM ($ROUTER_VM_ID) not found" + fi + + if qm status "$MACOS_VM_ID" >/dev/null 2>&1; then + local macos_status=$(qm status "$MACOS_VM_ID" | awk '{print $2}') + log INFO "macOS VM ($MACOS_VM_ID): $macos_status" + else + log WARNING "macOS VM ($MACOS_VM_ID) not found" + fi + ;; + + --help|-h) + show_help + ;; + + *) + log ERROR "Unknown option: $1" + show_help + exit 1 + ;; + esac + + log INFO "" + log SUCCESS "Operation completed successfully" + log INFO "========================================" +} + +# Run main function +main "$@" diff --git a/orion-config.json b/orion-config.json new file mode 100644 index 0000000..1f42704 --- /dev/null +++ b/orion-config.json @@ -0,0 +1,340 @@ +{ + "hardware": { + "manufacturer": "Dell", + "model": "PowerEdge R730", + "serviceTag": "CQ5QBM2", + "cpu": { + "model": "Intel Xeon E5-2690 v4", + "sockets": 2, + "coresPerSocket": 14, + "threadsPerCore": 2, + "totalCores": 28, + "totalThreads": 56 + }, + "memory": { + "total": "384GB", + "modules": [ + { + "slot": "A1-A6", + "size": "32GB", + "type": "DDR4-2400", + "manufacturer": "Samsung" + }, + { + "slot": "B1-B6", + "size": "32GB", + "type": "DDR4-2400", + "manufacturer": "Samsung" + } + ] + }, + "storage": { + "controller": "PERC H730 Mini", + "raidLevel": "RAID 10", + "disks": [] + }, + "networkInterfaces": [ + { + "name": "eno1", + "mac": "D0:94:66:24:96:7C", + "speed": "1GbE", + "type": "Integrated", + "purpose": "Proxmox Management" + }, + { + "name": "eno2", + "mac": "D0:94:66:24:96:7D", + "speed": "1GbE", + "type": "Integrated", + "purpose": "Reserved" + }, + { + "name": "eno3", + "mac": "D0:94:66:24:96:7E", + "speed": "10GbE", + "type": "Integrated", + "purpose": "WAN (Telus Fiber)", + "bridge": "vmbr0" + }, + { + "name": "eno4", + "mac": "D0:94:66:24:96:80", + "speed": "10GbE", + "type": "Integrated", + "purpose": "LAN (Internal Network)", + "bridge": "vmbr1" + }, + { + "name": "eno5", + "mac": "", + "speed": "10GbE", + "type": "Integrated", + "purpose": "macOS VM Network", + "bridge": "vmbr2" + }, + { + "name": "eno6", + "mac": "", + "speed": "10GbE", + "type": "Integrated", + "purpose": "Storage Network", + "bridge": "vmbr3" + }, + { + "name": "enp3s0f0", + "mac": "", + "speed": "10GbE", + "type": "Slot 3", + "purpose": "Router VM Passthrough (Optional)" + }, + { + "name": "enp3s0f1", + "mac": "", + "speed": "10GbE", + "type": "Slot 3", + "purpose": "Router VM Passthrough (Optional)" + } + ] + }, + "network": { + "proxmox": { + "hostname": "orion-pve.local", + "ip": "192.168.100.10", + "netmask": "24", + "gateway": "192.168.100.1", + "dns": ["1.1.1.1", "8.8.8.8"], + "managementInterface": "eno1" + }, + "bridges": { + "vmbr0": { + "interface": "eno3", + "purpose": "WAN - Router VM", + "vlanAware": true, + "stp": false + }, + "vmbr1": { + "interface": "eno4", + "purpose": "LAN - Internal Network", + "ip": "192.168.100.1/24", + "vlanAware": true, + "stp": false + }, + "vmbr2": { + "interface": "eno5", + "purpose": "macOS VM Network", + "vlanAware": false, + "stp": false + }, + "vmbr3": { + "interface": "eno6", + "purpose": "Storage Network", + "vlanAware": false, + "stp": false + } + }, + "telus": { + "isp": "Telus Communications", + "connection": "Fiber 10Gbps", + "bgp": { + "localAS": "394955", + "remoteAS": "6939", + "gateways": [ + { + "name": "Telus Gateway 1", + "ip": "206.75.1.127", + "priority": 1, + "enabled": true + }, + { + "name": "Telus Gateway 2", + "ip": "206.75.1.47", + "priority": 2, + "enabled": true + }, + { + "name": "Telus Gateway 3", + "ip": "206.75.1.48", + "priority": 3, + "enabled": true + } + ] + }, + "ipv6": { + "prefix": "2602:F674::/48", + "allocation": "2602:F674:1000::/64" + } + } + }, + "virtualMachines": { + "router": { + "id": 200, + "name": "ORION-Router", + "os": "pfSense CE 2.7.2", + "resources": { + "cpu": { + "cores": 8, + "type": "host", + "sockets": 1, + "numa": true + }, + "memory": "32GB", + "storage": "50GB" + }, + "network": [ + { + "id": "net0", + "bridge": "vmbr0", + "model": "virtio", + "purpose": "WAN" + }, + { + "id": "net1", + "bridge": "vmbr1", + "model": "virtio", + "purpose": "LAN" + }, + { + "id": "net2", + "bridge": "vmbr2", + "model": "virtio", + "purpose": "OPT1" + }, + { + "id": "net3", + "bridge": "vmbr3", + "model": "virtio", + "purpose": "OPT2" + } + ], + "autostart": true, + "startupOrder": 1, + "startupDelay": 30 + }, + "macOS": { + "id": 100, + "name": "HACK-Sequoia-01", + "os": "macOS Sequoia 15", + "resources": { + "cpu": { + "cores": 12, + "type": "Haswell-noTSX", + "sockets": 1, + "numa": false + }, + "memory": "64GB", + "storage": "256GB" + }, + "network": [ + { + "id": "net0", + "bridge": "vmbr2", + "model": "virtio", + "purpose": "Primary" + } + ], + "opencore": { + "version": "1.0.4", + "smbios": "iMacPro1,1", + "sip": "enabled", + "secureBootModel": "Default" + }, + "autostart": false, + "startupOrder": 10 + } + }, + "resourceAllocation": { + "proxmoxHost": { + "cpuCores": 4, + "memory": "16GB", + "purpose": "Hypervisor overhead" + }, + "routerVM": { + "cpuCores": 8, + "memory": "32GB", + "purpose": "Network routing, BGP, firewall" + }, + "macOSPrimary": { + "cpuCores": 12, + "memory": "64GB", + "purpose": "macOS Sequoia development" + }, + "macOSSecondary": { + "cpuCores": 8, + "memory": "32GB", + "purpose": "macOS Sonoma testing (optional)" + }, + "developmentVMs": { + "cpuCores": 24, + "memory": "240GB", + "purpose": "Linux/Windows VMs, containers, CI/CD" + }, + "totalAllocated": { + "cpuCores": 56, + "memory": "384GB" + } + }, + "monitoring": { + "prometheus": { + "enabled": true, + "port": 9090, + "retention": "30d" + }, + "grafana": { + "enabled": true, + "port": 3000, + "dashboards": [ + "Proxmox Node Exporter", + "pfSense Dashboard", + "VM Resource Usage" + ] + }, + "alerting": { + "enabled": true, + "channels": [ + { + "type": "email", + "address": "admin@orion.local" + } + ], + "rules": [ + "High CPU usage (>90% for 5 minutes)", + "High memory usage (>95%)", + "BGP session down", + "Gateway unreachable", + "Disk usage >85%", + "VM offline unexpectedly" + ] + } + }, + "backup": { + "enabled": true, + "schedule": "daily 2:00 AM", + "retention": { + "daily": 7, + "weekly": 4, + "monthly": 3 + }, + "targets": [ + { + "type": "PBS", + "name": "Proxmox Backup Server", + "location": "local-pbs" + }, + { + "type": "NFS", + "name": "Network Storage", + "location": "192.168.100.50:/backup" + } + ], + "excludes": [ + "VM 100 - HACK-Sequoia-01 (optional - large disk)" + ] + }, + "deployment": { + "version": "1.0.0", + "deployedDate": "", + "deployedBy": "ORION Automation Script", + "lastModified": "2025-01-19", + "status": "pending" + } +} diff --git a/scripts/install-orion-services.sh b/scripts/install-orion-services.sh new file mode 100755 index 0000000..572936d --- /dev/null +++ b/scripts/install-orion-services.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +######################################################################################################################### +# +# Script: install-orion-services.sh +# Purpose: Install ORION monitoring and automation services +# Description: Deploys systemd services and scripts for ORION deployment +# +######################################################################################################################### + +set -e + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +log() { + local level=$1 + shift + case $level in + INFO) echo -e "${BLUE}[INFO]${NC} $@" ;; + SUCCESS) echo -e "${GREEN}[SUCCESS]${NC} $@" ;; + WARNING) echo -e "${YELLOW}[WARNING]${NC} $@" ;; + ERROR) echo -e "${RED}[ERROR]${NC} $@" ;; + esac +} + +# Check if running as root +if [ "$EUID" -ne 0 ]; then + log ERROR "This script must be run as root" + exit 1 +fi + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PARENT_DIR="$(dirname "$SCRIPT_DIR")" + +log INFO "Installing ORION services..." +log INFO "Script directory: $SCRIPT_DIR" +log INFO "Parent directory: $PARENT_DIR" + +# 1. Copy scripts to /usr/local/bin +log INFO "Installing monitoring scripts to /usr/local/bin..." +cp "$SCRIPT_DIR/orion-gateway-monitor" /usr/local/bin/ +cp "$SCRIPT_DIR/orion-bgp-monitor" /usr/local/bin/ +cp "$SCRIPT_DIR/orion-vm-watchdog" /usr/local/bin/ +cp "$SCRIPT_DIR/orion-performance-tuning" /usr/local/bin/ + +chmod +x /usr/local/bin/orion-gateway-monitor +chmod +x /usr/local/bin/orion-bgp-monitor +chmod +x /usr/local/bin/orion-vm-watchdog +chmod +x /usr/local/bin/orion-performance-tuning + +log SUCCESS "Scripts installed" + +# 2. Copy systemd service files +log INFO "Installing systemd service files..." +cp "$PARENT_DIR/systemd/"*.service /etc/systemd/system/ + +# 3. Create log directory +mkdir -p /var/log/orion +mkdir -p /var/run/orion + +log SUCCESS "Log directories created" + +# 4. Reload systemd +log INFO "Reloading systemd daemon..." +systemctl daemon-reload + +# 5. Enable services (but don't start yet) +log INFO "Enabling ORION services..." +systemctl enable orion-performance-tuning.service +systemctl enable orion-gateway-monitor.service +systemctl enable orion-bgp-monitor.service +systemctl enable orion-vm-watchdog.service + +log SUCCESS "Services enabled" + +# 6. Start performance tuning (one-time) +log INFO "Running performance tuning..." +systemctl start orion-performance-tuning.service + +log SUCCESS "Performance tuning complete" + +# 7. Show status +log INFO "" +log INFO "Service Status:" +log INFO "===============" +systemctl status orion-performance-tuning.service --no-pager || true +echo "" + +# 8. Instructions +log INFO "" +log INFO "ORION services have been installed and enabled." +log INFO "" +log INFO "To start monitoring services:" +log INFO " systemctl start orion-gateway-monitor.service" +log INFO " systemctl start orion-bgp-monitor.service" +log INFO " systemctl start orion-vm-watchdog.service" +log INFO "" +log INFO "To view logs:" +log INFO " journalctl -u orion-gateway-monitor -f" +log INFO " journalctl -u orion-bgp-monitor -f" +log INFO " journalctl -u orion-vm-watchdog -f" +log INFO "" +log INFO "Log files are located in: /var/log/orion/" +log INFO "State files are located in: /var/run/orion/" +log INFO "" +log SUCCESS "Installation complete!" + +exit 0 diff --git a/scripts/orion-bgp-monitor b/scripts/orion-bgp-monitor new file mode 100755 index 0000000..56b5104 --- /dev/null +++ b/scripts/orion-bgp-monitor @@ -0,0 +1,91 @@ +#!/bin/bash + +######################################################################################################################### +# +# Script: orion-bgp-monitor +# Purpose: Monitor BGP sessions on router VM +# Description: Checks BGP session status and alerts on changes +# +######################################################################################################################### + +# Configuration +ROUTER_VM_ID="${ROUTER_VM_ID:-200}" +LOCAL_AS="${LOCAL_AS:-394955}" +REMOTE_AS="${REMOTE_AS:-6939}" +CHECK_INTERVAL="${CHECK_INTERVAL:-60}" +LOG_FILE="/var/log/orion/bgp-monitor.log" +ALERT_FILE="/var/log/orion/bgp-alerts.log" +STATE_FILE="/var/run/orion/bgp-state.json" + +# Create directories +mkdir -p /var/log/orion /var/run/orion + +# Logging function +log() { + local level=$1 + shift + local message="$@" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + echo "${timestamp} [${level}] ${message}" | tee -a "$LOG_FILE" +} + +# Alert function +alert() { + local neighbor=$1 + local status=$2 + local message="$3" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + + echo "${timestamp} [ALERT] BGP Neighbor: ${neighbor}, Status: ${status}, Message: ${message}" | tee -a "$ALERT_FILE" + + logger -t orion-bgp-monitor -p daemon.warning "BGP Neighbor ${neighbor} ${status}: ${message}" +} + +# Check if VM is running +check_vm_running() { + local vm_id=$1 + + if qm status "$vm_id" 2>/dev/null | grep -q "running"; then + return 0 + else + return 1 + fi +} + +# Get BGP session status +get_bgp_status() { + local vm_id=$1 + + # This would execute a command on the router VM to check BGP status + # For pfSense with FRR, we'd use something like: + # qm guest exec $vm_id -- vtysh -c "show ip bgp summary" + + # Placeholder - would need to be adapted for actual router implementation + log INFO "Checking BGP sessions on VM $vm_id..." + + # For now, just check if VM is running + if check_vm_running "$vm_id"; then + log INFO "Router VM $vm_id is running" + return 0 + else + log WARNING "Router VM $vm_id is not running" + return 1 + fi +} + +# Main monitoring loop +log INFO "ORION BGP Monitor starting..." +log INFO "Monitoring Router VM ID: $ROUTER_VM_ID" +log INFO "Local AS: $LOCAL_AS, Remote AS: $REMOTE_AS" +log INFO "Check interval: ${CHECK_INTERVAL} seconds" + +while true; do + if ! check_vm_running "$ROUTER_VM_ID"; then + alert "$ROUTER_VM_ID" "VM_DOWN" "Router VM is not running - BGP sessions unavailable" + log ERROR "Router VM $ROUTER_VM_ID is not running" + else + get_bgp_status "$ROUTER_VM_ID" + fi + + sleep "$CHECK_INTERVAL" +done diff --git a/scripts/orion-gateway-monitor b/scripts/orion-gateway-monitor new file mode 100755 index 0000000..fbb6802 --- /dev/null +++ b/scripts/orion-gateway-monitor @@ -0,0 +1,134 @@ +#!/bin/bash + +######################################################################################################################### +# +# Script: orion-gateway-monitor +# Purpose: Monitor Telus gateway connectivity and health +# Description: Continuously monitors BGP gateway availability and alerts on failures +# +######################################################################################################################### + +# Configuration +TELUS_GATEWAY1="${TELUS_GATEWAY1:-206.75.1.127}" +TELUS_GATEWAY2="${TELUS_GATEWAY2:-206.75.1.47}" +TELUS_GATEWAY3="${TELUS_GATEWAY3:-206.75.1.48}" +CHECK_INTERVAL="${CHECK_INTERVAL:-30}" +LOG_FILE="/var/log/orion/gateway-monitor.log" +ALERT_FILE="/var/log/orion/gateway-alerts.log" +STATE_FILE="/var/run/orion/gateway-state.json" + +# Create directories +mkdir -p /var/log/orion /var/run/orion + +# Logging function +log() { + local level=$1 + shift + local message="$@" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + echo "${timestamp} [${level}] ${message}" | tee -a "$LOG_FILE" +} + +# Alert function +alert() { + local gateway=$1 + local status=$2 + local message="$3" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + + echo "${timestamp} [ALERT] Gateway: ${gateway}, Status: ${status}, Message: ${message}" | tee -a "$ALERT_FILE" + + # Send notification (can be extended with email/webhook) + logger -t orion-gateway-monitor -p daemon.warning "Gateway ${gateway} ${status}: ${message}" +} + +# Check gateway function +check_gateway() { + local gateway=$1 + local name=$2 + + # Ping check (3 packets, 2 second timeout) + if ping -c 3 -W 2 "$gateway" >/dev/null 2>&1; then + log INFO "Gateway $name ($gateway) is UP" + return 0 + else + log WARNING "Gateway $name ($gateway) is DOWN" + return 1 + fi +} + +# Update state file +update_state() { + local gw1_status=$1 + local gw2_status=$2 + local gw3_status=$3 + + cat > "$STATE_FILE" < "$cpu" 2>/dev/null || log WARNING "Failed to set governor for $cpu" + fi +done + +# 2. Disable CPU C-States (prevents TSC issues with macOS) +log INFO "Disabling CPU C-States for stable TSC..." +# This is typically done in BIOS, but we can try via kernel +if [ -f /sys/module/intel_idle/parameters/max_cstate ]; then + echo 0 > /sys/module/intel_idle/parameters/max_cstate 2>/dev/null || log WARNING "Failed to disable C-States" +fi + +# 3. Network Interface Optimizations +log INFO "Tuning network interfaces..." +for iface in eno1 eno2 eno3 eno4 eno5 eno6 enp3s0f0 enp3s0f1; do + if ip link show "$iface" >/dev/null 2>&1; then + log INFO "Tuning $iface..." + + # Increase ring buffer sizes + ethtool -G "$iface" rx 4096 tx 4096 2>/dev/null || log WARNING "Failed to set ring buffers for $iface" + + # Enable hardware offloading + ethtool -K "$iface" tso on gso on gro on 2>/dev/null || log WARNING "Failed to enable offloading for $iface" + + # Disable power management + ethtool -s "$iface" wol d 2>/dev/null || log WARNING "Failed to disable WoL for $iface" + fi +done + +# 4. Kernel Network Stack Tuning +log INFO "Tuning kernel network stack..." +sysctl -w net.core.rmem_max=134217728 >/dev/null 2>&1 +sysctl -w net.core.wmem_max=134217728 >/dev/null 2>&1 +sysctl -w net.core.rmem_default=16777216 >/dev/null 2>&1 +sysctl -w net.core.wmem_default=16777216 >/dev/null 2>&1 +sysctl -w net.core.netdev_max_backlog=50000 >/dev/null 2>&1 +sysctl -w net.ipv4.tcp_rmem="4096 87380 134217728" >/dev/null 2>&1 +sysctl -w net.ipv4.tcp_wmem="4096 65536 134217728" >/dev/null 2>&1 +sysctl -w net.ipv4.tcp_congestion_control=bbr >/dev/null 2>&1 + +# 5. VM Swap and Memory Tuning +log INFO "Tuning memory and swap..." +sysctl -w vm.swappiness=10 >/dev/null 2>&1 +sysctl -w vm.vfs_cache_pressure=50 >/dev/null 2>&1 +sysctl -w vm.dirty_ratio=10 >/dev/null 2>&1 +sysctl -w vm.dirty_background_ratio=5 >/dev/null 2>&1 + +# 6. Increase open file limits +log INFO "Increasing file descriptor limits..." +ulimit -n 1048576 2>/dev/null || log WARNING "Failed to set file descriptor limit" + +# 7. Disable unnecessary services +log INFO "Optimizing system services..." +# (Be careful with this - only disable if certain) +# systemctl disable bluetooth.service 2>/dev/null +# systemctl disable cups.service 2>/dev/null + +# 8. IRQ Affinity (balance interrupts across CPUs) +log INFO "Configuring IRQ affinity..." +if command -v irqbalance >/dev/null 2>&1; then + systemctl enable irqbalance + systemctl restart irqbalance + log INFO "IRQ balancing enabled" +fi + +# 9. Transparent Huge Pages (THP) - Enable for better performance +log INFO "Configuring Transparent Huge Pages..." +if [ -f /sys/kernel/mm/transparent_hugepage/enabled ]; then + echo always > /sys/kernel/mm/transparent_hugepage/enabled 2>/dev/null || log WARNING "Failed to enable THP" +fi + +# 10. I/O Scheduler - Set to none for SSDs, mq-deadline for HDDs +log INFO "Configuring I/O scheduler..." +for disk in /sys/block/sd*/queue/scheduler; do + if [ -f "$disk" ]; then + echo none > "$disk" 2>/dev/null || echo mq-deadline > "$disk" 2>/dev/null + fi +done + +log INFO "Performance tuning completed successfully" +log INFO "Optimization summary:" +log INFO " - CPU governor: performance" +log INFO " - Network interfaces: optimized (ring buffers, offloading)" +log INFO " - Kernel network stack: BBR, large buffers" +log INFO " - Memory: low swappiness, optimized cache pressure" +log INFO " - IRQ balancing: enabled" +log INFO " - Transparent Huge Pages: enabled" + +exit 0 diff --git a/scripts/orion-vm-watchdog b/scripts/orion-vm-watchdog new file mode 100755 index 0000000..f843532 --- /dev/null +++ b/scripts/orion-vm-watchdog @@ -0,0 +1,119 @@ +#!/bin/bash + +######################################################################################################################### +# +# Script: orion-vm-watchdog +# Purpose: Monitor critical VMs and restart if needed +# Description: Ensures router and critical VMs stay running +# +######################################################################################################################### + +# Configuration +ROUTER_VM_ID="${ROUTER_VM_ID:-200}" +MACOS_VM_ID="${MACOS_VM_ID:-100}" +CHECK_INTERVAL="${CHECK_INTERVAL:-30}" +RESTART_ON_FAILURE="${RESTART_ON_FAILURE:-true}" +LOG_FILE="/var/log/orion/vm-watchdog.log" +STATE_FILE="/var/run/orion/vm-watchdog-state.json" + +# Create directories +mkdir -p /var/log/orion /var/run/orion + +# Logging function +log() { + local level=$1 + shift + local message="$@" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + echo "${timestamp} [${level}] ${message}" | tee -a "$LOG_FILE" +} + +# Check VM status +check_vm() { + local vm_id=$1 + local vm_name=$2 + local auto_restart=$3 + + if qm status "$vm_id" 2>/dev/null | grep -q "running"; then + log INFO "VM $vm_id ($vm_name) is running" + return 0 + elif qm status "$vm_id" 2>/dev/null | grep -q "stopped"; then + log WARNING "VM $vm_id ($vm_name) is stopped" + + if [[ "$auto_restart" == "true" && "$RESTART_ON_FAILURE" == "true" ]]; then + log INFO "Attempting to start VM $vm_id ($vm_name)..." + if qm start "$vm_id" >> "$LOG_FILE" 2>&1; then + log INFO "Successfully started VM $vm_id ($vm_name)" + logger -t orion-vm-watchdog -p daemon.notice "Restarted VM $vm_id ($vm_name)" + return 0 + else + log ERROR "Failed to start VM $vm_id ($vm_name)" + logger -t orion-vm-watchdog -p daemon.err "Failed to restart VM $vm_id ($vm_name)" + return 1 + fi + fi + return 1 + else + log WARNING "VM $vm_id does not exist or status unknown" + return 1 + fi +} + +# Update state file +update_state() { + local router_status=$1 + local macos_status=$2 + + cat > "$STATE_FILE" </dev/null 2>&1; then + if check_vm "$MACOS_VM_ID" "HACK-Sequoia-01" "false"; then + macos_status="running" + else + macos_status="stopped" + fi + else + macos_status="not_configured" + fi + + # Update state + update_state "$router_status" "$macos_status" + + sleep "$CHECK_INTERVAL" +done diff --git a/systemd/orion-bgp-monitor.service b/systemd/orion-bgp-monitor.service new file mode 100644 index 0000000..27729f2 --- /dev/null +++ b/systemd/orion-bgp-monitor.service @@ -0,0 +1,32 @@ +[Unit] +Description=ORION BGP Session Monitor +Documentation=https://github.com/luci-digital/Dell_R730_CQ5QBM2_ORION +After=network-online.target orion-gateway-monitor.service +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/orion-bgp-monitor +Restart=always +RestartSec=60 +StandardOutput=journal +StandardError=journal +SyslogIdentifier=orion-bgp-monitor + +# Environment +Environment="TELUS_GATEWAY1=206.75.1.127" +Environment="TELUS_GATEWAY2=206.75.1.47" +Environment="TELUS_GATEWAY3=206.75.1.48" +Environment="LOCAL_AS=394955" +Environment="REMOTE_AS=6939" +Environment="ROUTER_VM_ID=200" + +# Security hardening +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=strict +ProtectHome=true +ReadWritePaths=/var/log/orion + +[Install] +WantedBy=multi-user.target diff --git a/systemd/orion-gateway-monitor.service b/systemd/orion-gateway-monitor.service new file mode 100644 index 0000000..2f228e1 --- /dev/null +++ b/systemd/orion-gateway-monitor.service @@ -0,0 +1,24 @@ +[Unit] +Description=ORION Gateway Health Monitor +Documentation=https://github.com/luci-digital/Dell_R730_CQ5QBM2_ORION +After=network-online.target pve-cluster.service +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/orion-gateway-monitor +Restart=always +RestartSec=30 +StandardOutput=journal +StandardError=journal +SyslogIdentifier=orion-gateway-monitor + +# Security hardening +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=strict +ProtectHome=true +ReadWritePaths=/var/log/orion + +[Install] +WantedBy=multi-user.target diff --git a/systemd/orion-performance-tuning.service b/systemd/orion-performance-tuning.service new file mode 100644 index 0000000..dc12a4e --- /dev/null +++ b/systemd/orion-performance-tuning.service @@ -0,0 +1,16 @@ +[Unit] +Description=ORION Performance Tuning (One-time at boot) +Documentation=https://github.com/luci-digital/Dell_R730_CQ5QBM2_ORION +After=local-fs.target +Before=network-pre.target + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/orion-performance-tuning +RemainAfterExit=yes +StandardOutput=journal +StandardError=journal +SyslogIdentifier=orion-performance-tuning + +[Install] +WantedBy=multi-user.target diff --git a/systemd/orion-vm-watchdog.service b/systemd/orion-vm-watchdog.service new file mode 100644 index 0000000..a74a50c --- /dev/null +++ b/systemd/orion-vm-watchdog.service @@ -0,0 +1,30 @@ +[Unit] +Description=ORION VM Health Watchdog +Documentation=https://github.com/luci-digital/Dell_R730_CQ5QBM2_ORION +After=pve-cluster.service pveproxy.service +Requires=pve-cluster.service + +[Service] +Type=simple +ExecStart=/usr/local/bin/orion-vm-watchdog +Restart=always +RestartSec=30 +StandardOutput=journal +StandardError=journal +SyslogIdentifier=orion-vm-watchdog + +# Environment +Environment="ROUTER_VM_ID=200" +Environment="MACOS_VM_ID=100" +Environment="CHECK_INTERVAL=30" +Environment="RESTART_ON_FAILURE=true" + +# Security hardening +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=strict +ProtectHome=true +ReadWritePaths=/var/log/orion + +[Install] +WantedBy=multi-user.target