Add Proxmox with macOS integration for Dell R730 ORION deployment
Integrate OSX-PROXMOX capabilities with Dell PowerEdge R730 CQ5QBM2 ORION router deployment, creating a unified platform for high-performance routing, macOS virtualization, and development workloads. New Features: - Complete integration documentation (DELL_R730_ORION_PROXMOX_INTEGRATION.md) - Quick start guide (ORION_QUICKSTART.md) - Automated deployment script (deploy-orion.sh) - Hardware configuration template (orion-config.json) Monitoring & Automation: - Gateway health monitor (Telus BGP gateways) - BGP session monitor (router VM) - VM watchdog (auto-restart critical VMs) - Performance tuning (network, CPU, memory optimization) Systemd Services: - orion-gateway-monitor.service - Monitor Telus gateway connectivity - orion-bgp-monitor.service - Monitor BGP session status - orion-vm-watchdog.service - Ensure critical VMs stay running - orion-performance-tuning.service - Boot-time performance optimization Deployment Architecture: - Proxmox VE 8.4.x as hypervisor - VM 200: ORION-Router (pfSense with BGP) - VM 100: macOS Sequoia with OpenCore 1.0.4 - 4 network bridges (WAN, LAN, macOS, Storage) - Resource allocation: 56 cores, 384GB RAM, 8x NICs Hardware Support: - Dell PowerEdge R730 (Service Tag: CQ5QBM2) - 2x Intel Xeon E5-2690 v4 (28 cores, 56 threads) - 384GB DDR4-2400 RAM - 8x Network Interfaces (4x10GbE + 2x1GbE + 2x10GbE) - PERC H730 Mini RAID Controller Network Configuration: - vmbr0: WAN (eno3) - Telus Fiber connection - vmbr1: LAN (eno4) - Internal network (192.168.100.0/24) - vmbr2: macOS (eno5) - Dedicated 10GbE for macOS VMs - vmbr3: Storage (eno6) - Storage network Telus BGP Configuration: - Local AS: 394955 - Remote AS: 6939 (Hurricane Electric) - Gateways: 206.75.1.127, 206.75.1.47, 206.75.1.48 - IPv6 Prefix: 2602:F674::/48 This integration enables running macOS VMs alongside high-performance routing on the same Dell R730 server, consolidating infrastructure while maintaining full routing and virtualization capabilities.
This commit is contained in:
parent
a60e53cb92
commit
51218f3166
File diff suppressed because it is too large
Load Diff
|
|
@ -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! 🚀
|
||||
|
|
@ -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 <<EOF
|
||||
deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription
|
||||
EOF
|
||||
|
||||
# Update package lists
|
||||
log INFO "Updating package lists..."
|
||||
apt-get update >> "$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 <<EOF
|
||||
# /etc/network/interfaces
|
||||
# Deployed by ORION automation script
|
||||
# Generated: $(date)
|
||||
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# Management Interface (Proxmox Web UI)
|
||||
auto ${MGMT_INTERFACE}
|
||||
iface ${MGMT_INTERFACE} inet static
|
||||
address ${PROXMOX_IP}/${PROXMOX_NETMASK}
|
||||
gateway ${PROXMOX_GATEWAY}
|
||||
dns-nameservers ${PROXMOX_DNS}
|
||||
# Dell iDRAC management
|
||||
|
||||
# WAN Bridge (for Router VM) - ${WAN_INTERFACE} (D0:94:66:24:96:7E)
|
||||
auto vmbr0
|
||||
iface vmbr0 inet manual
|
||||
bridge-ports ${WAN_INTERFACE}
|
||||
bridge-stp off
|
||||
bridge-fd 0
|
||||
bridge-vlan-aware yes
|
||||
# WAN interface for Router VM - Telus Fiber connection
|
||||
|
||||
# LAN Bridge (Internal Network) - ${LAN_INTERFACE} (D0:94:66:24:96:80)
|
||||
auto vmbr1
|
||||
iface vmbr1 inet static
|
||||
address ${PROXMOX_GATEWAY}/${PROXMOX_NETMASK}
|
||||
bridge-ports ${LAN_INTERFACE}
|
||||
bridge-stp off
|
||||
bridge-fd 0
|
||||
bridge-vlan-aware yes
|
||||
# LAN interface for all VMs - Internal network
|
||||
|
||||
# macOS VM Bridge (Dedicated 10GbE) - ${MACOS_INTERFACE}
|
||||
auto vmbr2
|
||||
iface vmbr2 inet manual
|
||||
bridge-ports ${MACOS_INTERFACE}
|
||||
bridge-stp off
|
||||
bridge-fd 0
|
||||
# Dedicated network for macOS VMs (high performance)
|
||||
|
||||
# Storage/Backup Bridge - ${STORAGE_INTERFACE}
|
||||
auto vmbr3
|
||||
iface vmbr3 inet manual
|
||||
bridge-ports ${STORAGE_INTERFACE}
|
||||
bridge-stp off
|
||||
bridge-fd 0
|
||||
# Storage network (NFS, iSCSI, backup targets)
|
||||
EOF
|
||||
|
||||
log SUCCESS "Network bridge configuration created"
|
||||
log WARNING "Network configuration has been updated. A reboot is required to apply changes."
|
||||
log INFO "To apply now without reboot (may interrupt network): systemctl restart networking"
|
||||
}
|
||||
|
||||
verify_network() {
|
||||
log INFO "Verifying network configuration..."
|
||||
|
||||
# Check if bridges exist
|
||||
for bridge in vmbr0 vmbr1 vmbr2 vmbr3; do
|
||||
if ip link show "$bridge" >/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 <<EOF
|
||||
ORION Deployment Script for Dell R730 with Proxmox and macOS
|
||||
|
||||
Usage: $0 [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 (except Proxmox install)
|
||||
--verify Verify system configuration and health
|
||||
--help Display this help message
|
||||
|
||||
Examples:
|
||||
# Full automated deployment (after Proxmox is installed)
|
||||
$0 --full-deploy
|
||||
|
||||
# Configure network only
|
||||
$0 --configure-network
|
||||
|
||||
# Create router VM only
|
||||
$0 --create-router-vm
|
||||
|
||||
# Verify existing deployment
|
||||
$0 --verify
|
||||
|
||||
Notes:
|
||||
- This script must be run on a Proxmox VE host
|
||||
- Proxmox VE must be installed before running this script
|
||||
- Root/sudo access is required
|
||||
- Internet connectivity is required for package downloads
|
||||
|
||||
Hardware:
|
||||
- Dell PowerEdge R730 (Service Tag: CQ5QBM2)
|
||||
- 2x Intel Xeon E5-2690 v4 (56 cores total)
|
||||
- 384GB RAM
|
||||
- 8x Network Interfaces (4x10GbE + 2x1GbE + 2x10GbE)
|
||||
|
||||
Documentation:
|
||||
See DELL_R730_ORION_PROXMOX_INTEGRATION.md for complete guide
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
# Create log directory
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
log INFO "========================================"
|
||||
log INFO "ORION Deployment Script Starting"
|
||||
log INFO "========================================"
|
||||
log INFO "Timestamp: $(date)"
|
||||
log INFO "Script: $0"
|
||||
log INFO "Arguments: $@"
|
||||
log INFO "Log file: $LOG_FILE"
|
||||
log INFO ""
|
||||
|
||||
# Parse arguments
|
||||
if [ $# -eq 0 ]; then
|
||||
show_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
--install-proxmox)
|
||||
log ERROR "Proxmox installation must be done manually using ISO installer"
|
||||
log INFO "Download from: https://www.proxmox.com/en/downloads/proxmox-virtual-environment/iso"
|
||||
log INFO "After Proxmox is installed, run: $0 --full-deploy"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
--configure-network)
|
||||
check_root
|
||||
check_proxmox
|
||||
configure_network_bridges
|
||||
verify_network
|
||||
;;
|
||||
|
||||
--install-osx)
|
||||
check_root
|
||||
check_proxmox
|
||||
install_osx_proxmox
|
||||
;;
|
||||
|
||||
--create-router-vm)
|
||||
check_root
|
||||
check_proxmox
|
||||
create_router_vm
|
||||
;;
|
||||
|
||||
--create-macos-vm)
|
||||
check_root
|
||||
check_proxmox
|
||||
create_macos_vm
|
||||
;;
|
||||
|
||||
--full-deploy)
|
||||
check_root
|
||||
check_hardware
|
||||
check_proxmox
|
||||
configure_repositories
|
||||
install_packages
|
||||
configure_network_bridges
|
||||
|
||||
log INFO ""
|
||||
log WARNING "Network configuration complete. Restarting networking..."
|
||||
log WARNING "This may temporarily interrupt network connectivity."
|
||||
read -p "Continue? (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
systemctl restart networking
|
||||
sleep 5
|
||||
verify_network
|
||||
else
|
||||
log INFO "Skipping network restart. Please restart manually: systemctl restart networking"
|
||||
fi
|
||||
|
||||
install_osx_proxmox
|
||||
create_router_vm
|
||||
|
||||
log INFO ""
|
||||
log INFO "Would you like to create a macOS VM now?"
|
||||
read -p "Create macOS VM? (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
create_macos_vm
|
||||
else
|
||||
log INFO "Skipping macOS VM creation. Run later with: $0 --create-macos-vm"
|
||||
fi
|
||||
|
||||
generate_summary
|
||||
;;
|
||||
|
||||
--verify)
|
||||
check_root
|
||||
check_hardware
|
||||
check_proxmox
|
||||
verify_network
|
||||
|
||||
log INFO ""
|
||||
log INFO "Checking VMs..."
|
||||
if qm status "$ROUTER_VM_ID" >/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 "$@"
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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" <<EOF
|
||||
{
|
||||
"timestamp": "$(date -Iseconds)",
|
||||
"gateways": {
|
||||
"gateway1": {
|
||||
"ip": "$TELUS_GATEWAY1",
|
||||
"status": "$gw1_status",
|
||||
"name": "Telus Gateway 1"
|
||||
},
|
||||
"gateway2": {
|
||||
"ip": "$TELUS_GATEWAY2",
|
||||
"status": "$gw2_status",
|
||||
"name": "Telus Gateway 2"
|
||||
},
|
||||
"gateway3": {
|
||||
"ip": "$TELUS_GATEWAY3",
|
||||
"status": "$gw3_status",
|
||||
"name": "Telus Gateway 3"
|
||||
}
|
||||
},
|
||||
"summary": {
|
||||
"total": 3,
|
||||
"up": $((gw1_status == "up" ? 1 : 0 + gw2_status == "up" ? 1 : 0 + gw3_status == "up" ? 1 : 0)),
|
||||
"down": $((gw1_status == "down" ? 1 : 0 + gw2_status == "down" ? 1 : 0 + gw3_status == "down" ? 1 : 0))
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
# Main monitoring loop
|
||||
log INFO "ORION Gateway Monitor starting..."
|
||||
log INFO "Monitoring gateways: $TELUS_GATEWAY1, $TELUS_GATEWAY2, $TELUS_GATEWAY3"
|
||||
log INFO "Check interval: ${CHECK_INTERVAL} seconds"
|
||||
|
||||
while true; do
|
||||
# Check all gateways
|
||||
gw1_status="down"
|
||||
gw2_status="down"
|
||||
gw3_status="down"
|
||||
|
||||
if check_gateway "$TELUS_GATEWAY1" "Telus Gateway 1"; then
|
||||
gw1_status="up"
|
||||
else
|
||||
alert "$TELUS_GATEWAY1" "DOWN" "Telus Gateway 1 is not responding to ping"
|
||||
fi
|
||||
|
||||
if check_gateway "$TELUS_GATEWAY2" "Telus Gateway 2"; then
|
||||
gw2_status="up"
|
||||
else
|
||||
alert "$TELUS_GATEWAY2" "DOWN" "Telus Gateway 2 is not responding to ping"
|
||||
fi
|
||||
|
||||
if check_gateway "$TELUS_GATEWAY3" "Telus Gateway 3"; then
|
||||
gw3_status="up"
|
||||
else
|
||||
alert "$TELUS_GATEWAY3" "DOWN" "Telus Gateway 3 is not responding to ping"
|
||||
fi
|
||||
|
||||
# Update state file
|
||||
update_state "$gw1_status" "$gw2_status" "$gw3_status"
|
||||
|
||||
# Check if all gateways are down
|
||||
if [[ "$gw1_status" == "down" && "$gw2_status" == "down" && "$gw3_status" == "down" ]]; then
|
||||
alert "ALL" "CRITICAL" "All Telus gateways are DOWN - No internet connectivity!"
|
||||
fi
|
||||
|
||||
# Sleep before next check
|
||||
sleep "$CHECK_INTERVAL"
|
||||
done
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
#!/bin/bash
|
||||
|
||||
#########################################################################################################################
|
||||
#
|
||||
# Script: orion-performance-tuning
|
||||
# Purpose: Apply performance optimizations for Dell R730 ORION
|
||||
# Description: One-time boot script to optimize system for routing and virtualization
|
||||
#
|
||||
#########################################################################################################################
|
||||
|
||||
LOG_FILE="/var/log/orion/performance-tuning.log"
|
||||
|
||||
# Create log directory
|
||||
mkdir -p /var/log/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"
|
||||
}
|
||||
|
||||
log INFO "ORION Performance Tuning starting..."
|
||||
|
||||
# 1. CPU Governor - Set to performance mode
|
||||
log INFO "Setting CPU governor to performance mode..."
|
||||
for cpu in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
|
||||
if [ -f "$cpu" ]; then
|
||||
echo performance > "$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
|
||||
|
|
@ -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" <<EOF
|
||||
{
|
||||
"timestamp": "$(date -Iseconds)",
|
||||
"vms": {
|
||||
"router": {
|
||||
"id": $ROUTER_VM_ID,
|
||||
"name": "ORION-Router",
|
||||
"status": "$router_status",
|
||||
"critical": true
|
||||
},
|
||||
"macos": {
|
||||
"id": $MACOS_VM_ID,
|
||||
"name": "HACK-Sequoia-01",
|
||||
"status": "$macos_status",
|
||||
"critical": false
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
# Main monitoring loop
|
||||
log INFO "ORION VM Watchdog starting..."
|
||||
log INFO "Monitoring VMs: Router ($ROUTER_VM_ID), macOS ($MACOS_VM_ID)"
|
||||
log INFO "Check interval: ${CHECK_INTERVAL} seconds"
|
||||
log INFO "Auto-restart on failure: $RESTART_ON_FAILURE"
|
||||
|
||||
while true; do
|
||||
# Check router VM (critical - always restart)
|
||||
router_status="unknown"
|
||||
if check_vm "$ROUTER_VM_ID" "ORION-Router" "true"; then
|
||||
router_status="running"
|
||||
else
|
||||
router_status="stopped"
|
||||
fi
|
||||
|
||||
# Check macOS VM (non-critical - don't auto-restart)
|
||||
macos_status="unknown"
|
||||
if qm status "$MACOS_VM_ID" >/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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
Loading…
Reference in New Issue