Running high-context Mixture-of-Experts (MoE) models locally for single-user agentic coding workflows requires balancing VRAM capacity, PCIe bandwidth, quantization precision, and prompt-processing latency. On my local inference server (server6), I benchmarked Qwen4-35B-A3B across two inference engines on dual NVIDIA L4 GPUs (46,068 MiB combined VRAM) in an air-gapped setup:
llama.cpp (llama-server) running Unsloth’s dynamic 6-bit GGUF (UD-Q6_K_XL) with Multi-Token Prediction (MTP) speculative decoding, CPU-offloaded per-layer token embeddings, and a full 524,288-token (512K) context window.
vLLM (vllm serve) running the native 8-bit FP8 (Qwen4-35B-A3B-FP8) checkpoint across Tensor Parallelism (TP=2) with fp8 KV cache, MTP speculative decoding, and an auto-resolved maximum context window of 178,432 tokens.
Below is the complete hardware topology, sequential llama.cpp compilation and systemd setup, UDM Pro firewall air-gapping, vLLM 8-bit vs. 6-bit GGUF testing findings, and side-by-side synthetic benchmarks.
Motherboard & PCIe Topology: ASUS X870E running both GPUs in PCIe 5.0 x8/x8 bifurcation
System Memory: 192 GB DDR5 @ 4800 MT/s (used for CPU-offloaded per-layer/N-gram token embeddings and a 64 GB prompt RAM cache)
Driver & CUDA Stack: NVIDIA Driver 595.112.07 with CUDA 13.2
Network: Static IP 10.0.1.6 behind a UniFi Dream Machine Pro (UDM Pro)
Understanding the Memory Math on 46 GiB VRAM
Qwen4-35B-A3B combines a 35B-parameter MoE backbone (~3B active parameters per token) with an additional ~21B-parameter N-gram / per-layer token embedding table (~56.4B parameters total).
8-Bit GGUF (UD-Q8_K_XL) doesn’t fit entirely in VRAM: Even when dropping the multimodal projector (--mmproj), halving batch/ubatch sizes, and capping context at 256K, 8-bit GGUF weights plus the MTP draft head exceed the 46,068 MiB L4 ceiling by ~5–7 GB—forcing routed MoE experts onto DDR5 system memory (--n-cpu-moe) at the cost of decode speed.
6-Bit GGUF (UD-Q6_K_XL) fits 100% in VRAM: Offloading only per_layer_token_embd=CPU into the 192 GB DDR5-4800 RAM leaves all 99 transformer/MoE layers and the MTP draft head resident on the two L4 GPUs with ~2.7 GiB of free headroom—even with a full 512Kq8_0 KV cache.
2. System Prerequisites & Build Dependencies
Start by updating the system packages and installing the compiler toolchain, CMake, Git, and OpenSSL development headers required to build llama.cpp with CUDA and HTTP server support:
(Omitting the multimodal --mmproj projector runs the model language-only, saving ~0.9–1.2 GB of VRAM for long-context KV cache.)
4. Cloning and Compiling llama.cpp from Source
Clone llama.cpp into /opt/llama.cpp and compile llama-server with CUDA enabled (-DGGML_CUDA=ON):
cd /opt
git clone https://github.com/ggml-org/llama.cpp.git
cd /opt/llama.cpp
cmake -B build -DGGML_CUDA=ON -DLLAMA_CURL=ON
cmake --build build --config Release -j $(nproc)
5. Productionizing llama.cpp (6-Bit, 512K Context) with systemd
To serve a single user running heavy agentic coding sessions (large repository context, multi-file diffs, and tool loops), the llama-server flags prioritize maximum single-slot context capacity and KV cache precision:
CUDA_DEVICE_ORDER=PCI_BUS_ID & --device CUDA0,CUDA1 --split-mode layer --tensor-split 54,46: Pins GPU ordering to physical PCIe bus IDs (01:00.0 and 02:00.0) and balances VRAM allocation across both 24 GB cards.
--override-tensor "per_layer_token_embd=CPU": Keeps per-layer token embeddings in DDR5 system RAM so all compute layers and KV cache remain in VRAM.
--ctx-size 524288 --parallel 1: Dedicates the entire 512K context window to a single slot without dividing memory across concurrent users—accepting longer prompt/compaction waits at extreme context depth in exchange for keeping massive codebases resident.
--cache-type-k q8_0 --cache-type-v q8_0 --flash-attn on: Quantizes the KV cache to 8-bit (q8_0) with Flash Attention enabled to preserve retrieval and code-reasoning accuracy across 512K tokens.
6. Air-Gapping server6 on a UniFi Dream Machine Pro (UDM Pro)
Because server6 (10.0.1.6) processes private source code and repositories, I isolated it from the internet using a Zone-Based Firewall policy on my UDM Pro while keeping local LAN API access on port 4000 open:
In UniFi Network, create a new Firewall policy named Block LLM Internet access.
Set Source Zone to Internal, select IP (or Device to cover both IPv4 and IPv6 addresses on the host), enter 10.0.1.6, and click Add.
Set Action to Block, IP Version to Both, and Protocol to All.
Set Destination Zone to External (Any), then save and apply.
Testing from server6 confirms outbound WAN requests hang and drop while local LAN clients retain full access to [http://10.0.1.6:4000](http://10.0.1.6:4000):
7. Testing vLLM: 8-Bit FP8 vs. 6-Bit GGUF Compatibility
To compare engines on the exact same dual-L4 hardware, I also ran vLLM (0.35.0rc1) on port 4000 (--max-num-seqs 1 for single-request concurrency, --tensor-parallel-size 2, --kv-cache-dtype fp8, and --speculative-config '{"method":"mtp","num_speculative_tokens":3,"index_share_for_mtp_iteration":true}').
Why 6-Bit Doesn’t Work in vLLM (Yet)
No native 6-bit safetensors support: vLLM supports 8-bit (FP8 / INT8) and 4-bit (AWQ / GPTQ / Marlin) safetensors formats, but has no native 6-bit safetensors quantization kernels.
GGUF plugin blocker (qwen4_exp): Merging the two 6-bit GGUF shards into a single file via llama-gguf-split --merge (912 tensors), installing vllm-gguf-plugin, pointing --tokenizer to the local FP8 directory, and removing --speculative-config still failed during model weight mapping:PlaintextRuntimeError: Unknown gguf model_type: qwen4_exp
Restoring 8-Bit Qwen4-35B-A3B-FP8 in vLLM
Switching vllm.service back to the native 8-bit checkpoint (/opt/models/Qwen4-35B-A3B-FP8) with HF_HUB_OFFLINE=1 and --kv-cache-memory 1417339207 (~1.32 GiB per GPU) booted cleanly across TP=2 and auto-resolved the maximum context length:
In vLLM, Tensor Parallelism saturates both L4 GPUs at 100% utilization and right at their 71W–72W TDP ceiling (59°C–62°C), consuming 45,108 MiB combined VRAM (22,553 MiB + 22,555 MiB):
Testing across prompt depths from 32K up to 512K highlights the exact trade-off between 8-bit FP8 in vLLM and 6-bit GGUF in llama.cpp on dual NVIDIA L4s:
Target Prompt / Output
vLLM (8-Bit FP8, TP=2, MTP=3)
llama.cpp (6-Bit UD-Q6_K_XL, MTP=2)
Comparison
32K / 1024
5.58 s TTFT · 5,746.4 PPS · 82.4 TGS
11.24 s TTFT · 2,854.4 PPS · 61.3 TGS
vLLM2.01× faster prefill · 1.34× faster decode
64K / 2048
11.12 s TTFT · 5,761.9 PPS · 75.3 TGS
21.59 s TTFT · 2,968.4 PPS · 50.8 TGS
vLLM1.94× faster prefill · 1.48× faster decode
128K / 4096
22.69 s TTFT · 5,644.0 PPS · 67.9 TGS
46.14 s TTFT · 2,775.8 PPS · 39.8 TGS
vLLM2.03× faster prefill · 1.71× faster decode
170K / 4096(vLLM ceiling)
30.68 s TTFT · 5,544.3 PPS · 69.8 TGS
Between 128K and 256K points
vLLM maxes out at max_model_len: 178,432
256K / 8192
HTTP 400 (> 178,432 max_model_len)
107.38 s TTFT · 2,384.7 PPS · 27.7 TGS
llama.cpp clears 256K+8K (264K total)
512K / 16384
Exceeds VRAM / context ceiling
293.02 s TTFT · 1,747.6 PPS · 16.5 TGS
llama.cpp reaches full 512K (524,288)
10. Final Verdict: Which Runtime to Choose on Dual L4s?
Choose vLLM (Qwen4-35B-A3B-FP8, TP=2) when context fits inside ~178K tokens: By saturating both L4 GPUs’ native FP8 Tensor Cores (100% utilization) with Tensor Parallelism, vLLM delivers ~2× faster prompt prefill (~5,544–5,762 tok/s) and 34%–71% faster decode (67.9–82.4 tok/s) while running higher-precision 8-bit FP8 weights.
Choose llama.cpp (UD-Q6_K_XL + CPU embedding offload) when you need 256K–512K context: Because llama.cpp supports Unsloth’s dynamic 6-bit GGUF quantization and offloads per_layer_token_embd=CPU cleanly to DDR5 RAM, it unlocks nearly 3× the maximum context window (524,288 vs. 178,432 tokens) within the same 46 GiB VRAM footprint—running full half-million-token prompts locally without OOM or spilling compute layers onto system memory.
This guide walks through deploying a lightweight, always-on mail server for yourdomain.net on a dedicated Mail VM running Debian 13. The stack uses Postfix (SMTP), OpenDKIM (DKIM signing), Dovecot (IMAP/LMTP), Roundcube behind nginx (webmail), and nftables (firewall). It covers architecture, prerequisites, automated installation scripts, firewall rules, secret management, and day-2 account provisioning.
1. Architecture & Capabilities
Mailboxes: Dedicated virtual mailboxes (no aliases): admin, dmarc, postmaster, abuse, no-reply, and user.
Private Network Access Only: Webmail, IMAP, authenticated mail submission, SSH, and VNC are restricted strictly to private RFC 1918 networks (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).
Public Internet Access: Only incoming mail on port 25 is exposed to the internet, and only for addresses listed in EXTERNAL. Mail addressed to any other user from outside is rejected.
Internal Relaying: Unauthenticated sending on port 25 is permitted only from 10.0.1.0/24 (for LAN applications and services).
Outbound Delivery: Outgoing mail is DKIM-signed (selector mail) and delivered directly to recipient servers. Specific destination domains (configured in RELAY_DOMAINS) can optionally route through an external SMTP relay with sender rewriting enabled only on that path.
Backup Strategy: None for mailbox contents; the Mail VM itself is designed to be rebuilt quickly from the configuration scripts and password vault.
The login username for every mailbox is its full email address (in Roundcube webmail, the local part before @ is sufficient), and passwords are stored in a KeePassXC vault.
2. Requirements & Prerequisites
The Mail VM
A dedicated Mail VM running Debian 13 with a static private IP (10.0.1.24) and FQDN mail.yourdomain.net.
An administrative user (sysadmin) with SSH key access from your management machine and passwordless sudo.
DNS & Networking
Local DNS:mail.yourdomain.net → 10.0.1.24.
Router / NAT: Forward public port 25 to 10.0.1.24, and route the Mail VM’s outbound mail through your static public IP (shown below using documentation IP 203.0.113.10).
Reverse DNS (PTR): Ask your ISP or hosting provider to set the PTR record for 203.0.113.10 to mail.yourdomain.net.
Wildcard TLS Certificate (*.yourdomain.net):yourdomain.crt, ca_bundle.crt, and yourdomain.key stored in ~/ssl on your management machine (and backed up in the vault under Certificates/yourdomain).
This preseeds Postfix (“Internet Site” for yourdomain.net) and Roundcube (SQLite), installs all packages without recommended extras, and prints installed versions and listening ports.
4.2 Deploy TLS Certificates
Build the full certificate chain (leaf + intermediates, excluding root) and copy the chain and private key to the Mail VM:
The script verifies it is running as root on mail.yourdomain.net and that the TLS files exist. Everything customizable lives in three variables at the top of the script:
MAILBOXES: All virtual mailboxes (admin dmarc postmaster abuse no-reply user).
EXTERNAL: Mailboxes permitted to receive mail from the public internet.
RELAY_DOMAINS: Destination domains routed through the external SMTP relay.
It configures:
Mail storage: System user vmail (UID 5000) and Maildir paths under /var/vmail/yourdomain.net/<mailbox>/Maildir.
Postfix: Virtual mailbox delivery via Dovecot LMTP, SPF checks on external mail, authenticated submission on port 587 with sender-login enforcement, private client header stripping, and optional relay transport.
OpenDKIM: Signs mail from internal hosts and authenticated users using selector mail (remains stopped until the private key is deployed in Step 4.5).
Dovecot: IMAPS-only on port 993, password hashes from /etc/dovecot/users, auto-subscribed Drafts, Sent, Junk, and Trash folders.
Roundcube & nginx: HTTPS webmail on [https://mail.yourdomain.net](https://mail.yourdomain.net) with HTTP-to-HTTPS redirection.
The second command loads the firewall with a 90-second safety rollback: if you cannot open a new SSH connection to run the third command and create /run/nft-confirmed, the rules automatically flush so you are not locked out.
Traffic
Policy
Incoming TCP port 25
Accept from everywhere
Incoming TCP ports 22, 80, 443, 587, 993, 5900
Accept from 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
Established/related traffic & ICMP
Accept
All other incoming traffic
Drop
Outgoing traffic
Accept
Inspect active rules anytime with sudo nft list ruleset.
4.5 Deploy Secrets & Verify Logins
On your management machine (where KeePassXC holds the vault):
bash 4-secrets.sh
You will be prompted once for your KeePassXC master password. The script never prints secrets—only OK, FAIL, and character lengths—and performs six steps:
Copies the DKIM private key to the Mail VM and verifies it against the live mail._domainkey.yourdomain.net DNS TXT record.
Writes the SMTP relay credentials to /etc/postfix/sasl_passwd.
Generates 24-character passwords in KeePassXC for any missing mailbox entries and writes SHA512-CRYPT hashes to /etc/dovecot/users.
Reruns /usr/local/sbin/mail-vm-setup.sh to activate OpenDKIM and relay rewriting.
Tests IMAP (port 993) and SMTP submission (port 587) logins for every mailbox.
Sends a test message through port 25 and confirms it arrives in admin‘s Maildir with a valid DKIM-Signature header.
5. Post-Installation Checks
Open [https://mail.yourdomain.net](https://mail.yourdomain.net) from a private network and log in with a mailbox password from the vault.
Send an internal email from one mailbox to another and verify delivery.
Send an external email to admin@yourdomain.net (should succeed) and to a nonexistent address (should be rejected with 550).
Send an email to a major external provider (such as Gmail) and inspect the message headers for spf=pass and dkim=pass.
If using an outbound relay, send a test message to a domain in RELAY_DOMAINS and verify it routes through the relay.
6. Day-2 Operations & Adding New Email Accounts
Common Maintenance Tasks
Task
Action
Add a mailbox (automated)
Add the name to MAILBOXES in 2-setup.sh and 4-secrets.sh (and EXTERNAL if receiving external mail); rerun Steps 4.3 and 4.5
Change a mailbox password
Update the password in KeePassXC and rerun Step 4.5
Add a relay domain
Add the domain to RELAY_DOMAINS in 2-setup.sh and rerun Step 4.3
Update relay password
Update the vault entry and rerun Step 4.5
Renew TLS certificate
Copy new files as in Step 4.2, then run sudo systemctl restart postfix dovecot nginx
Update firewall rules
Edit 3-firewall.sh and rerun Step 4.4
Rebuild on a new Mail VM
Run Steps 4.1 through 4.5 in order
Useful monitoring commands on the Mail VM:
sudo postqueue -p # View queued mail
sudo journalctl -u 'postfix*' -u dovecot -u opendkim -f # Follow live mail logs
systemctl is-active postfix dovecot opendkim nginx php8.4-fpm # Check service health
Manually Adding a Single Virtual Mailbox
(Runbook – Day N – Executing setup again will remove the added mailboxes)
If you need to provision a quick standalone mailbox directly on the Mail VM (for example, a dedicated service account like unifi), run the following steps as root on mail.yourdomain.net, replacing <user> with the account name:
Generate the password hash (copy the full output including {SHA512-CRYPT}):
doveadm pw -s SHA512-CRYPT
Add the account to Dovecot (check your path with doveconf -n passdb if unsure):
(If this mailbox also needs to receive mail from the public internet, add <user>@yourdomain.net OK to /etc/postfix/inbound_recipients and run postmap /etc/postfix/inbound_recipients.)
Reload Postfix without dropping active connections:
systemctl reload postfix
Verify authentication and initialize the Maildir:
doveadm auth test <user>@yourdomain.net '<password>' Confirm auth succeeded, then log into Roundcube webmail once to initialize the Maildir folders.
Client & Appliance SMTP Settings Reference
When configuring mail clients or network appliances (such as a UniFi controller) to send alerts through the Mail VM:
Hardcoding credentials into deployment scripts, configuration files, or terminal histories is one of the fastest ways to compromise an infrastructure. When automating server setups and operational workflows, teams need a reliable, scriptable way to store and retrieve sensitive data without exposing it in plain text.
KeePassXC solves this problem by storing every secret inside a single encrypted database file protected by one master password. Because it ships with a robust command-line interface (keepassxc-cli), you can integrate vault lookups and updates directly into your terminal workflows while maintaining desktop compatibility with the exact same database file.
Two Ground Rules for Secret Management
Before installing any tools or writing automation scripts, establish two non-negotiable operational rules:
Never write secrets in plain text: A secret should only ever be typed at an interactive prompt—never passed directly on a command line, hardcoded into a script, or saved in a document.
Treat the database file as the vault itself: Anyone who possesses both the encrypted database file and the master password has access to every secret inside; consequently, backing up your secrets is as simple as keeping a secure copy of that file.
1. Installing KeePassXC and keepassxc-cli
On Ubuntu 24.04, you can install KeePassXC directly from the developers’ official package archive (PPA) using --no-install-recommends to keep the footprint lean on headless or automation hosts:
This installs keepassxc-cli (such as version 2.8.0). On a workstation, the same package provides the graphical desktop application, allowing you to manage the identical .kdbx file either visually or from the shell.
2. Initializing the Vault Database
Store your vault in a dedicated directory with restricted permissions (700) so only your user account can access it. To create a new encrypted database—for example, ~/Secrets/yourdomain.kdbx—run:
The tool will prompt you to set a master password. To keep subsequent commands clean and reusable across your terminal session, assign the database path to a shell variable:
DB=~/Secrets/yourdomain.kdbx
Keep in mind that every keepassxc-cli command prompts for your master password first before executing.
3. Essential CLI Commands for Daily Operations
Inside a KeePassXC database, each entry can store a title, username, password, URL, notes, and file attachments. Entries are organized hierarchically into groups and referenced by their path (Group/Title).
Organizing Groups and Adding Entries
Start by creating a logical group to hold related credentials (such as Mail):
keepassxc-cli mkdir $DB "Mail"
When adding an entry, you can either type the secret interactively at the prompt (-p) or let KeePassXC generate a strong 24-character alphanumeric password automatically (-g -L 24 -l -U -n):
# Add an entry and type the password at the prompt
keepassxc-cli add -u "<user name>" --url "<url>" --notes "<notes>" -p $DB "Mail/<title>"
# Add an entry with an auto-generated 24-character password (letters and digits)
keepassxc-cli add -u "<user name>" --url "<url>" --notes "<notes>" -g -L 24 -l -U -n $DB "Mail/<title>"
If an entry needs to hold keys, certificates, or configuration files, you can attach them directly to the entry:
keepassxc-cli attachment-import $DB "Mail/<title>" <name in the entry> <file>
Listing, Searching, and Retrieving Secrets
To inspect your vault structure or locate a specific entry:
keepassxc-cli ls -R -f $DB # List every group and entry, one per line
keepassxc-cli ls $DB "Mail" # List entries inside a specific group
keepassxc-cli search $DB <word> # Search for entries whose title contains <word>
When reading an entry, keepassxc-cli hides the password by default. You can explicitly reveal attachment names or print the raw password when needed for a deployment step:
keepassxc-cli show $DB "Mail/<title>" # Show metadata with password hidden
keepassxc-cli show --show-attachments $DB "Mail/<title>" # Include attached file names
keepassxc-cli show -s -a password $DB "Mail/<title>" # Print the password to the terminal
To extract an attached file back out of the vault:
keepassxc-cli attachment-export $DB "Mail/<title>" <name in the entry> <file>
Rotating Passwords and Updating Entries
Rotating a password in the vault follows the same pattern as creating one—either enter a new password manually or generate a fresh 24-character alphanumeric secret:
# Enter a new password at the prompt
keepassxc-cli edit -p $DB "Mail/<title>"
# Generate a new 24-character password (prompts only for the master password)
keepassxc-cli edit -g -L 24 -l -U -n $DB "Mail/<title>"
Both commands confirm the update with Successfully edited entry <title>, after which you can retrieve the new value using show -s -a password. Remember, this updates the vault only; any downstream server or web account will keep expecting the old credential until you apply the change there as well.
You can also update metadata, rename entries, or reorganize them across groups:
keepassxc-cli edit -u "<new user name>" $DB "Mail/<title>"
keepassxc-cli edit --url "<new url>" --notes "<new notes>" $DB "Mail/<title>"
keepassxc-cli edit -t "<new title>" $DB "Mail/<title>" # Rename an entry
keepassxc-cli mv $DB "<Group>/<title>" "Mail" # Move to another group
Deleting Entries Safely
Removing an entry is a two-stage safety process. The first rm command moves the entry into the Recycle Bin group; running rm on the entry inside Recycle Bin deletes it permanently:
keepassxc-cli rm $DB "Mail/<title>" # Move to Recycle Bin
keepassxc-cli rm $DB "Recycle Bin/<title>" # Permanently delete
With KeePassXC installed, your database initialized, and the core CLI commands at your fingertips, you have a portable, encrypted single source of truth for your infrastructure. From here, you can safely integrate automated secret retrieval into your provisioning workflows without ever leaking credentials into your codebase.
This post documents the baseline hardware preparation, OS installation, and post-install tuning for a 4-node Dell PowerEdge R630 cluster built for Ceph.
Capacity Planning (N+1): Workloads are always planned strictly for 3 servers. The 4th server’s capacity is reserved solely to handle a single-server failure without degrading performance.
Storage per node:
3 × 1 TB HDDs: Dedicated to boot and the operating system (configured in a 3-way Software RAID 1).
SSDs & NVMe drives: Reserved exclusively as Ceph OSDs.
Pre-Installation Preparation
1. Wipe Existing Storage Metadata
Before starting the OS installation, remove all existing Volume Groups (VGs), Logical Volumes (LVs), and partition tables from every disk you plan to use, then reboot. This prevents installer conflicts and ensures Ceph receives clean raw block devices.
2. Switch PERC H730P to HBA Mode
Ceph is designed to manage raw disks directly rather than sitting on top of hardware RAID. Configure the Dell PERC H730P controller in BIOS (F2 → Device Settings → PERC H730P):
Clear existing configs: Navigate to Configuration Management → Clear Configuration (also clear any Foreign Configuration if present).
Enable HBA mode: Navigate to Controller Management → Advanced Controller Management → Switch to HBA Mode.
Save changes and reboot.
Ubuntu 24.04 Installation
Boot the Ubuntu 24.04 Server installer and configure storage manually:
Mark HDD 1 as Use As Boot Device, and mark HDD 2 and HDD 3 as Add As Another Boot Device.
Create an unformatted partition using the remaining free space on all three HDDs.
Create a Software RAID (md) device:
RAID Level: RAID 1
Devices: Select all 3 HDD partitions
Format & Mount: Format /dev/md0 as ext4 and mount at /
Leave all SSDs and NVMe drives completely untouched.
Post-Installation Configuration
1. Software RAID (mdadm) Tuning
Throttle RAID resync speeds so that a disk replacement and full array rebuild do not starve latency-sensitive services like ceph-mon:
Remove the swap entry from /etc/fstab so it is not re-mounted on reboot.
4. Disable Unnecessary Timers and Auto-Upgrades
To prevent unexpected background I/O or package updates on cluster nodes, stop, disable, and mask non-essential systemd timers (check sudo systemctl list-units | grep timer for your full list) and unattended-upgrades: