mnmivm-se/README.md

358 lines
6.7 KiB
Markdown
Raw Normal View History

2025-12-18 21:07:59 -05:00
# 🚀 MNMIVM-SE (Server Edition)
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
### *A LAN-Native VM Cloud with a Minimal Control Plane*
2025-12-15 21:06:22 -05:00
![MNMIVM Hero](./assets/tuxrockets.jpg)
2025-12-18 21:07:59 -05:00
**MNMIVM-SE** is the **server-focused edition** of MNMIVM — a minimal, single-binary VM launcher built on **QEMU + KVM + cloud-init** that turns your **LAN into a local VM cloud**.
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
Unlike traditional platforms, MNMIVM-SE exposes the raw infrastructure primitives directly:
bridges, TAP devices, MAC addresses, static IPs, and Linux processes.
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
> Your LAN is the fabric.
> The kernel is the scheduler.
> The CLI is the control plane.
2025-12-15 21:06:22 -05:00
---
2025-12-18 21:07:59 -05:00
## ☁️ What MNMIVM-SE Is
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
* A **local VM cloud** built directly on your LAN
* A **process-native control plane**
* A **CLI-first infrastructure tool**
* A Proxmox-style networking model **without Proxmox**
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
Each VM:
- Has a persistent MAC address
- Has a static IP on your LAN
- Appears as a first-class network device
- Can host real infrastructure services (DNS, CI, storage, routing, etc.)
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
Routers, firewalls, and switches see MNMIVM-SE VMs as **real machines**, not NAT artifacts.
2025-12-15 21:06:22 -05:00
---
2025-12-18 21:07:59 -05:00
## 🧠 Control Plane Model
MNMIVM-SE **does have a control plane** — its just intentionally **minimal, local, and explicit**.
The control plane is implemented as:
- A single CLI binary
- A file-backed state store
- Linux process lifecycle tracking
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
There is:
- No always-on daemon
- No API server
- No database
- No reconciliation loop
- No scheduler service
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
Instead:
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
- VM lifecycle = Linux process lifecycle
- State = files under `/var/lib/microvm`
- Configuration changes = cloud-init regeneration
- Access = SSH + VNC
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
> The filesystem is the state store.
> `/proc` is the source of truth.
> Each CLI command is a deliberate control action.
This makes MNMIVM-SE closer to **early private IaaS** and **bare-metal virtualization** than modern hyperscaler platforms.
2025-12-15 21:06:22 -05:00
---
2025-12-18 21:07:59 -05:00
## 🧱 Supported Host Operating Systems
MNMIVM-SE is conservative about host support and only documents what is tested.
### ✅ Supported
| Host OS | Version |
|------|---------|
| **Debian** | 12+ |
| **Alpine Linux** | 3.22+ |
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
### 🕒 Coming Soon
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
| Host OS | Notes |
|------|------|
| Ubuntu | Netplan-based host networking support planned |
> Ubuntu is not currently documented due to netplan-specific bridge handling.
> Support will be added, but is not a top priority.
### ❌ Not Supported
- Wi-Fionly hosts
- WSL / nested hypervisors
- Desktop laptop setups expecting NAT
2025-12-15 21:06:22 -05:00
---
## 🧱 Architecture Overview
2025-12-18 21:07:59 -05:00
* **QEMU + KVM**
* **Linux bridge (`br0`)**
* **TAP devices**
* **Cloud-init seed ISO**
* **Static IP networking**
* **VNC console for recovery**
2025-12-15 21:06:22 -05:00
```
2025-12-18 21:07:59 -05:00
2025-12-15 21:06:22 -05:00
/var/lib/microvm/
2025-12-18 21:07:59 -05:00
├── images/
2025-12-15 21:06:22 -05:00
└── vms/
2025-12-18 21:07:59 -05:00
└── vm1/
├── disk.qcow2
├── seed.iso
├── pubkey.pub
├── os.name
├── vm.ip
├── vm.mac
├── vnc.port
└── vm.pid
````
No libvirt.
No XML.
2025-12-15 21:06:22 -05:00
No daemon.
---
2025-12-18 21:07:59 -05:00
## 🌐 Host Networking Requirements (CRITICAL)
MNMIVM-SE requires a **proper Linux bridge**.
### Example: `/etc/network/interfaces` (Debian)
```ini
auto lo
iface lo inet loopback
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
auto ens18
iface ens18 inet manual
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
auto br0
iface br0 inet static
address 192.168.86.10
netmask 255.255.255.0
gateway 192.168.86.1
dns-nameservers 1.1.1.1 8.8.8.8
bridge_ports ens18
bridge_stp off
bridge_fd 0
````
**Rules that must be followed:**
* The host IP must live on `br0`
* The physical NIC must have no IP
* Wi-Fi cannot be bridged
* VMs attach via TAP devices
2025-12-15 21:06:22 -05:00
---
2025-12-18 21:07:59 -05:00
## 🔥 Kernel Bridge Filtering (THIS WILL BREAK VMs)
Linux defaults can silently block bridged traffic.
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
This **must** be disabled:
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
```bash
cat /proc/sys/net/bridge/bridge-nf-call-iptables
# must be 0
```
If set to `1`, VMs will:
* Boot successfully
* Have valid IPs
* Be completely unreachable
### Fix (runtime)
```bash
sudo sysctl -w net.bridge.bridge-nf-call-iptables=0
sudo sysctl -w net.bridge.bridge-nf-call-ip6tables=0
sudo sysctl -w net.bridge.bridge-nf-call-arptables=0
```
### Persistent fix
`/etc/sysctl.d/99-bridge.conf`:
```ini
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-arptables = 0
```
2025-12-15 21:06:22 -05:00
---
2025-12-18 21:07:59 -05:00
## 🔐 QEMU Bridge Permissions
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
QEMU must be allowed to attach TAP devices.
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
### `/etc/qemu/bridge.conf`
```ini
allow br0
```
Verify helper:
```bash
ls -l /usr/lib/qemu/qemu-bridge-helper
```
2025-12-15 21:06:22 -05:00
---
2025-12-18 21:07:59 -05:00
## 🐧 Alpine Linux Host Notes (3.22+)
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
Alpine does not ship a hypervisor stack by default.
Install required packages:
2025-12-15 21:06:22 -05:00
```bash
2025-12-18 21:07:59 -05:00
apk add \
qemu-system-x86_64 \
qemu-img \
qemu-hw-display-virtio-vga \
bridge-utils \
cdrkit \
go
2025-12-15 21:06:22 -05:00
```
2025-12-18 21:07:59 -05:00
Notes:
* `cdrkit` provides `genisoimage`
* `bridge-utils` provides `brctl`
* `qemu-hw-display-virtio-vga` is required for VNC
* No libvirt or services are used
* OpenRC is sufficient
Alpine works well as a **minimal KVM host** once assembled.
---
## ⚙️ Server Edition Configuration (Code-Level)
Networking and sizing are configured **in code**, not via runtime flags.
Edit these constants in `main.go` (around lines 2530):
```go
// Networking
bridgeName = "br0"
lanCIDR = "192.168.86.0/24"
lanGW = "192.168.86.1"
lanDNS1 = "192.168.86.1"
lanDNS2 = "8.8.8.8"
// VM sizing
baseDiskSize = "12G"
memMB = "1024"
cpus = "1"
```
This keeps runtime behavior explicit and predictable.
---
## 🧰 CLI Usage
### Create a VM
2025-12-15 21:06:22 -05:00
```bash
2025-12-18 21:07:59 -05:00
sudo mnmivm-se create vm1 \
--os debian \
--pubkey-path ~/.ssh/id_ed25519.pub \
--ip 192.168.86.53
2025-12-15 21:06:22 -05:00
```
2025-12-18 21:07:59 -05:00
### Start a VM
2025-12-15 21:06:22 -05:00
```bash
2025-12-18 21:07:59 -05:00
sudo mnmivm-se start vm1
2025-12-15 21:06:22 -05:00
```
2025-12-18 21:07:59 -05:00
### SSH in
2025-12-15 21:06:22 -05:00
```bash
2025-12-18 21:07:59 -05:00
ssh debian@192.168.86.53
2025-12-15 21:06:22 -05:00
```
2025-12-18 21:07:59 -05:00
### Stop a VM
2025-12-15 21:06:22 -05:00
```bash
2025-12-18 21:07:59 -05:00
sudo mnmivm-se stop vm1
2025-12-15 21:06:22 -05:00
```
2025-12-18 21:07:59 -05:00
### Update cloud-init (SSH key / IP)
2025-12-15 21:06:22 -05:00
```bash
2025-12-18 21:07:59 -05:00
sudo mnmivm-se update-cloud vm1 \
--pubkey-path newkey.pub \
--ip 192.168.86.54
2025-12-15 21:06:22 -05:00
```
---
2025-12-18 21:07:59 -05:00
## 🔑 Security Model
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
* SSH keyonly access
* No password authentication
* No root login
* Static IPs (no DHCP ambiguity)
* MAC addresses pinned via cloud-init
* VNC console for recovery only
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
This follows **server-grade discipline**, not container ergonomics.
2025-12-15 21:06:22 -05:00
---
2025-12-18 21:07:59 -05:00
## ⚠️ What MNMIVM-SE Is Not
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
* ❌ A managed cloud service
* ❌ A multi-tenant platform
* ❌ A scheduler or orchestrator
* ❌ A UI-driven system
* ❌ A laptop-friendly NAT tool
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
If you want **policy, HA, quotas, tenants**, use Proxmox or OpenStack.
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
If you want **direct control over real infrastructure**, MNMIVM-SE is the tool.
2025-12-15 21:06:22 -05:00
---
2025-12-18 21:07:59 -05:00
## 🐧 Why MNMIVM-SE Exists
Because sometimes you dont want:
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
* libvirt
* XML
* dashboards
* APIs
* orchestration layers
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
You want:
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
> “Put a VM on my LAN, give it an IP, and let me build infrastructure.”
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
MNMIVM-SE does exactly that — and nothing more.
---
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
### ⚠️ Final Note
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
If you break networking with MNMIVM-SE, it isnt a bug.
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
Its Linux doing exactly what you told it to do.
2025-12-15 21:06:22 -05:00
2025-12-18 21:07:59 -05:00
And thats the point.
2025-12-15 21:06:22 -05:00