🌐 NeXuS Gateway Multi-Network Implementation Manual 🌐¶
Complete Guide to Whonix Gateway VM Architecture for Multi-Network Anonymity
Created: 2025-09-28
Co-Created-By: HackenStacks
Co-Authored-By: Claude noreply@anthropic.com
System: Alpine Linux NeXuS + Whonix Gateway VM
🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
🔥 🔥
🔥 ███╗ ██╗███████╗██╗ ██╗██╗ ██╗███████╗ 🔥
🔥 ████╗ ██║██╔════╝╚██╗██╔╝██║ ██║██╔════╝ 🔥
🔥 ██╔██╗ ██║█████╗ ╚███╔╝ ██║ ██║███████╗ 🔥
🔥 ██║╚██╗██║██╔══╝ ██╔██╗ ██║ ██║╚════██║ 🔥
🔥 ██║ ╚████║███████╗██╔╝ ██╗╚██████╔╝███████║ 🔥
🔥 ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ 🔥
🔥 🔥
🔥 🌐 GATEWAY ORCHESTRATOR • MULTI-NETWORK ANONYMITY 🛡️ 🔥
🔥 🔥
🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
📋 TABLE OF CONTENTS¶
- 🎯 Gateway Architecture Overview
- 📁 Directory Structure
- 🔧 Core Management Scripts
- 🌐 Network Configuration
- 📋 Step-by-Step Deployment
- 🐋 Container Integration
- 🔍 Testing & Validation
- 🛠️ Troubleshooting
- 🔒 Security Considerations
- 🚀 Future Multi-Network Integration
🎯 Gateway Architecture Overview¶
🌀 NeXuS Gateway Mission¶
The NeXuS Gateway provides censorship-resistant, multi-network anonymity through a unified VM-based orchestration system that routes traffic through Tor, I2P, and Yggdrassil networks.
🏗️ Architecture Design¶
🌐 INTERNET
↓
🛡️ WHONIX GATEWAY VM (10.152.152.10)
├── 🐙 Medusa-Tor Multi-Circuit Proxy
├── 🌐 I2P Router (Future)
├── 🕸️ Yggdrassil Mesh Node (Future)
└── 🔀 Network Orchestration Engine
↓ (nexus-br0 bridge: 10.152.152.0/18)
💻 ALPINE NEXUS HOST (10.152.152.11)
├── 📦 NeXuS Security Containers (local)
├── 🌀 NeXuS Applications & Services
└── 🔗 ALL traffic routed through Gateway VM
🎯 Key Benefits¶
- ✅ Complete Traffic Isolation - VM boundary prevents correlation attacks
- ✅ Multi-Network Failover - Automatic switching between Tor/I2P/Yggdrassil
- ✅ Transparent Operation - No application-level configuration required
- ✅ Censorship Resistance - Multiple network protocols prevent blocking
- ✅ Democratic Security - Easy setup with enterprise-grade protection
📁 Directory Structure¶
🗂️ Complete File Organization¶
/home/user/gateway-vm/
├── images/ # VM Disk Images & Storage
│ ├── whonix-gateway.qcow2 # Main VM disk image (2.3GB)
│ └── downloads/ # Original download files
├── config/ # VM Configuration Files
│ ├── whonix-gateway.xml # Libvirt VM configuration
│ ├── network-config.xml # Network bridge configuration
│ └── firewall-rules.conf # Custom firewall settings
├── scripts/ # Management & Automation Scripts
│ ├── create-nexus-network.sh # Network bridge setup
│ ├── deploy-whonix-gateway.sh # VM deployment automation
│ ├── configure-transparent-proxy.sh # Proxy configuration
│ ├── test-nexus-connectivity.sh # Testing framework
│ ├── start-gateway.sh # VM startup script
│ ├── stop-gateway.sh # VM shutdown script
│ └── status-gateway.sh # VM status monitoring
├── docs/ # Documentation & Guides
│ ├── WHONIX_GATEWAY_SETUP_GUIDE.md # Complete setup guide
│ ├── DEPLOYMENT_CHECKLIST.md # Deployment validation
│ ├── TROUBLESHOOTING_GUIDE.md # Problem resolution
│ └── NETWORK_ARCHITECTURE.md # Technical specifications
├── backups/ # VM Snapshots & Configuration Backups
│ ├── vm-snapshots/ # VM state preservation
│ ├── config-backups/ # Configuration file backups
│ └── deployment-logs/ # Installation history
└── logs/ # Operation & Monitoring Logs
├── deployment.log # Setup and configuration logs
├── network.log # Network operation logs
└── connectivity.log # Testing and validation logs
🔧 Core Management Scripts¶
🌐 create-nexus-network.sh¶
Location: /home/user/gateway-vm/scripts/create-nexus-network.sh
Purpose: Creates isolated network bridge for gateway-client communication
Network: 10.152.152.0/18 (16,382 host capacity)
Key Functions:
- Creates nexus-br0 bridge interface
- Configures IP forwarding and NAT rules
- Sets up libvirt internal network
- Implements 5-second cancel timer for safety
Usage:
Safety Features: - ✅ Backup existing network configuration - ✅ 5-second visual cancel timer - ✅ Complete rollback capability - ✅ Non-destructive bridge creation
🚀 deploy-whonix-gateway.sh¶
Location: /home/user/gateway-vm/scripts/deploy-whonix-gateway.sh
Purpose: Complete VM deployment automation with multiple deployment options
Deployment Options: 1. Scratch Deployment - Download and configure fresh Whonix image 2. Import Existing - Import pre-downloaded Whonix image 3. Clone Template - Clone from existing VM template
Key Functions: - Downloads Whonix Gateway CLI image (2.3GB) - Converts image format and optimizes for libvirt - Configures dual network interfaces - Generates VM management scripts - Creates VM configuration backups
Usage:
/home/user/gateway-vm/scripts/deploy-whonix-gateway.sh
# Follow interactive prompts for deployment option
Automated Components: - ✅ Image download and verification - ✅ Automatic format conversion (xz → qcow2) - ✅ VM resource allocation (2GB RAM, 2 CPU cores) - ✅ Network interface configuration - ✅ Management script generation
🔗 configure-transparent-proxy.sh¶
Location: /home/user/gateway-vm/scripts/configure-transparent-proxy.sh
Purpose: Configures Tor transparent proxy for custom (non-Whonix) clients
Execution: Inside Whonix Gateway VM after deployment
Key Functions: - Modifies Tor configuration for transparent proxy - Sets up iptables rules for traffic routing - Configures DNS resolution through Tor - Enables gateway self-routing through Tor (critical security)
Configuration Details: - TransPort: 9040 (transparent proxy) - DNSPort: 5300 (DNS resolution) - ControlPort: 9051 (Tor control interface) - VirtualAddrNetwork: 10.192.0.0/10
Usage (Inside VM):
Security Enhancements: - ✅ Gateway self-traffic routing through Tor - ✅ Complete DNS leak prevention - ✅ Transparent proxy rule validation - ✅ Service persistence configuration
🔍 test-nexus-connectivity.sh¶
Location: /home/user/gateway-vm/scripts/test-nexus-connectivity.sh
Purpose: Comprehensive connectivity, anonymity, and performance testing
Testing Framework:
- Anonymity Verification - Multiple IP check services
- DNS Leak Protection - Comprehensive DNS resolution testing
- Performance Analysis - Latency and throughput measurement
- Security Validation - Traffic analysis and isolation confirmation
Test Categories: 1. Basic Connectivity - Internet access through gateway 2. IP Address Verification - Confirms Tor exit node usage 3. DNS Resolution - Tests DNS leak prevention 4. Performance Metrics - Speed and latency analysis 5. Security Validation - Traffic isolation confirmation
Usage:
Validation Services: - ✅ httpbin.org/ip - ✅ icanhazip.com - ✅ whatismyipaddress.com - ✅ DNS leak test servers - ✅ Tor check services
🌐 Network Configuration¶
🔧 Network Architecture Specifications¶
Network Range: 10.152.152.0/18
- Total Hosts: 16,382 available addresses
- Subnet Mask: 255.255.192.0
- Gateway IP: 10.152.152.10 (Whonix Gateway VM)
- Client IP: 10.152.152.11 (Alpine NeXuS Host)
- Bridge Interface: nexus-br0
🌉 Bridge Configuration¶
# Bridge Interface Details
Interface: nexus-br0
IP Range: 10.152.152.0/18
Gateway: 10.152.152.10
DHCP: Disabled (static IP assignment)
NAT: Enabled for internet access
Isolation: Complete internal network isolation
🔀 Traffic Flow¶
Alpine NeXuS (10.152.152.11)
↓ eth0 interface
nexus-br0 bridge (10.152.152.0/18)
↓ bridge forwarding
Whonix Gateway VM (10.152.152.10)
↓ transparent proxy (port 9040)
Tor Network
↓ exit nodes
Internet
🛡️ Firewall Rules¶
Host Firewall (Alpine NeXuS): - Allow traffic to 10.152.152.10 (gateway) - Block direct internet access - Forward all traffic through bridge
Gateway Firewall (Whonix VM): - Accept traffic from 10.152.152.0/18 range - Route all traffic through Tor TransPort 9040 - DNS queries through Tor DNSPort 5300 - Block non-Tor traffic
📋 Step-by-Step Deployment¶
🎯 Phase 1: Network Infrastructure Setup¶
1.1 Network Bridge Creation
# Create network bridge with safety timer
sudo /home/user/gateway-vm/scripts/create-nexus-network.sh
# Verify bridge creation
ip addr show nexus-br0
brctl show nexus-br0
Expected Output:
✅ nexus-br0 bridge created
✅ IP range 10.152.152.0/18 configured
✅ NAT rules established
✅ libvirt network configured
1.2 Bridge Validation
# Check bridge status
sudo brctl show
sudo ip route show table all | grep nexus-br0
# Verify libvirt network
virsh net-list --all
virsh net-info nexus-internal
🎯 Phase 2: VM Deployment¶
2.1 VM Deployment Execution
# Launch deployment script
/home/user/gateway-vm/scripts/deploy-whonix-gateway.sh
# Select deployment option:
# [1] Download fresh Whonix image (recommended)
# [2] Import existing image
# [3] Clone from template
2.2 Deployment Process Monitoring
# Monitor download progress (if option 1 selected)
tail -f /home/user/gateway-vm/logs/deployment.log
# Verify image conversion
ls -la /home/user/gateway-vm/images/
file /home/user/gateway-vm/images/whonix-gateway.qcow2
2.3 VM Configuration Validation
# Check VM definition
virsh dumpxml whonix-gateway > /tmp/vm-config.xml
grep -A5 -B5 "nexus-br0" /tmp/vm-config.xml
# Verify VM resource allocation
virsh dominfo whonix-gateway
🎯 Phase 3: VM Startup & Initial Access¶
3.1 VM Startup
# Start the gateway VM
/home/user/gateway-vm/scripts/start-gateway.sh
# Monitor startup process
tail -f /home/user/gateway-vm/logs/network.log
3.2 VM Access Configuration
# VNC access available on localhost:5901
# Use VNC client to connect to VM console
# Alternative: SSH access (after initial setup)
# ssh user@10.152.152.10
3.3 Initial VM Configuration
# Inside VM: Update package sources
sudo apt update
# Inside VM: Verify Tor service
sudo systemctl status tor@default
sudo journalctl -u tor@default -f
🎯 Phase 4: Transparent Proxy Configuration¶
4.1 Proxy Setup (Inside VM)
# Copy configuration script to VM
# Then execute inside VM:
sudo /home/user/gateway-vm/scripts/configure-transparent-proxy.sh
# Monitor configuration process
sudo journalctl -f
4.2 Tor Configuration Validation
# Inside VM: Verify Tor configuration
sudo cat /etc/tor/torrc | grep -E "(TransPort|DNSPort|VirtualAddr)"
# Check Tor service status
sudo systemctl status tor@default
sudo ss -tuln | grep -E "(9040|5300|9051)"
4.3 Firewall Rules Verification
# Inside VM: Check iptables rules
sudo iptables -t nat -L -n
sudo iptables -L -n | grep -E "(REDIRECT|10\.152\.152)"
# Verify transparent proxy functionality
sudo netstat -tuln | grep -E "(9040|5300)"
🎯 Phase 5: Alpine Client Configuration¶
5.1 Network Interface Configuration
# On Alpine NeXuS host: Configure client network
sudo ip addr add 10.152.152.11/18 dev eth0
sudo ip route add default via 10.152.152.10
# Verify network configuration
ip addr show eth0
ip route show
5.2 DNS Configuration
# Configure DNS to use gateway
echo "nameserver 10.152.152.10" | sudo tee /etc/resolv.conf
# Verify DNS configuration
nslookup google.com
dig @10.152.152.10 google.com
5.3 Client Connectivity Testing
# Test basic connectivity through gateway
ping -c 3 10.152.152.10
curl -s http://httpbin.org/ip
# Verify Tor usage
curl -s https://check.torproject.org/api/ip
🎯 Phase 6: Comprehensive Testing¶
6.1 Connectivity Validation
# Run comprehensive test suite
/home/user/gateway-vm/scripts/test-nexus-connectivity.sh
# Monitor test results
tail -f /home/user/gateway-vm/logs/connectivity.log
6.2 Anonymity Verification
# Multiple IP check services
curl -s http://icanhazip.com
curl -s http://httpbin.org/ip
curl -s https://ifconfig.me/ip
# All should return Tor exit node IP
6.3 DNS Leak Testing
# Verify DNS requests go through Tor
nslookup google.com
dig google.com
# Check for DNS leaks
curl -s https://www.dnsleaktest.com/results.json
🐋 Container Integration¶
🎯 Future Container Architecture¶
Container Deployment Plan: - Medusa-Tor - Multi-circuit Tor proxy (existing) - I2P Router - i2pd containerized router - Yggdrassil Node - Mesh networking container - Network Orchestrator - Traffic routing logic
📦 Container Runtime Preparation¶
Podman Unprivileged Setup (Inside Gateway VM):
# Inside Whonix Gateway VM
sudo apt update && sudo apt install -y podman
# Configure rootless containers
echo 'user:100000:65536' | sudo tee /etc/subuid
echo 'user:100000:65536' | sudo tee /etc/subgid
# Initialize user namespace
podman system migrate
🌐 Container Network Integration¶
Network Architecture for Containers:
# Container network configuration
podman network create nexus-container-net \
--subnet 10.152.153.0/24 \
--gateway 10.152.153.1
# Container to host communication
# Containers: 10.152.153.0/24
# Gateway Host: 10.152.152.10
# Client Host: 10.152.152.11
🔍 Testing & Validation¶
🧪 Connectivity Test Suite¶
Test Categories:
1. Basic Network Connectivity
2. Tor Anonymity Verification
3. DNS Leak Prevention
4. Performance Benchmarking
5. Security Isolation Testing
📊 Test Execution Example¶
Anonymity Test:
# Expected: Tor exit node IP
curl -s http://httpbin.org/ip | jq '.origin'
# Expected: Different IP from previous
curl -s http://icanhazip.com
# Expected: "Congratulations. This browser is configured to use Tor."
curl -s https://check.torproject.org/ | grep -o "Congratulations.*"
DNS Leak Test:
# All DNS queries should resolve through Tor
dig +short google.com @10.152.152.10
nslookup facebook.com 10.152.152.10
# Expected: No direct DNS queries to ISP resolvers
sudo tcpdump -i eth0 port 53 &
curl -s http://google.com > /dev/null
sudo pkill tcpdump
Performance Test:
# Latency measurement
ping -c 10 google.com
# Throughput test
curl -o /dev/null -s -w "Downloaded: %{size_download} bytes\nTime: %{time_total}s\nSpeed: %{speed_download} bytes/s\n" \
http://httpbin.org/bytes/1048576
🛠️ Troubleshooting¶
🚨 Common Issues & Solutions¶
Issue 1: Bridge Creation Fails
# Symptoms: nexus-br0 bridge not created
# Solution: Check permissions and dependencies
sudo apt install bridge-utils
sudo modprobe bridge
sudo /home/user/gateway-vm/scripts/create-nexus-network.sh
Issue 2: VM Won't Start
# Symptoms: VM fails to start or network issues
# Check VM configuration
virsh dumpxml whonix-gateway | grep -A10 interface
# Verify bridge exists
brctl show nexus-br0
# Check libvirt network
virsh net-start nexus-internal
Issue 3: No Internet Through Gateway
# Inside VM: Check Tor service
sudo systemctl status tor@default
sudo journalctl -u tor@default
# Verify transparent proxy rules
sudo iptables -t nat -L -n | grep REDIRECT
# Check gateway routing
ip route show
Issue 4: DNS Resolution Fails
# Check DNS configuration
cat /etc/resolv.conf
# Test DNS through gateway
dig @10.152.152.10 google.com
# Inside VM: Verify Tor DNS port
sudo ss -tuln | grep 5300
🔧 Diagnostic Commands¶
Network Diagnostics:
# Bridge status
sudo brctl show
ip addr show nexus-br0
# Routing table
ip route show table all
# Network connectivity
ping -c 3 10.152.152.10
traceroute 10.152.152.10
VM Diagnostics:
# VM status
virsh list --all
virsh dominfo whonix-gateway
# VM console access
virsh console whonix-gateway
# VM logs
virsh qemu-monitor-command whonix-gateway --hmp 'info network'
Tor Diagnostics (Inside VM):
# Tor service status
sudo systemctl status tor@default
sudo ss -tuln | grep -E "(9040|5300|9051)"
# Tor logs
sudo journalctl -u tor@default -f
sudo tail -f /var/log/tor/log
🔒 Security Considerations¶
🛡️ Security Best Practices¶
Network Isolation: - ✅ Complete VM boundary prevents host compromise - ✅ Bridge network isolates gateway traffic - ✅ No direct internet access from client - ✅ All traffic forced through Tor transparent proxy
VM Security: - ✅ Whonix hardened base system - ✅ Regular security updates via apt - ✅ Minimal attack surface (CLI-only, no GUI) - ✅ AppArmor profiles active by default
Traffic Analysis Protection: - ✅ VM-level isolation prevents traffic correlation - ✅ Tor transparent proxy hides traffic patterns - ✅ DNS queries routed through Tor - ✅ No clearnet connections from client
🔐 Operational Security¶
VM Management:
# Regular VM snapshots
virsh snapshot-create-as whonix-gateway \
"snapshot-$(date +%Y%m%d-%H%M%S)" \
"Pre-update snapshot"
# Security updates inside VM
sudo apt update && sudo apt upgrade -y
# Monitor Tor circuit changes
sudo journalctl -u tor@default | grep "circuit"
Network Monitoring:
# Monitor bridge traffic
sudo tcpdump -i nexus-br0 -n
# Check for DNS leaks
sudo tcpdump -i eth0 port 53 &
curl -s http://google.com > /dev/null
sudo pkill tcpdump
🚨 Security Warnings¶
Critical Security Notes: - ⚠️ Never connect client directly to internet - Always use gateway - ⚠️ Regularly update VM - Security patches critical for anonymity - ⚠️ Monitor Tor circuits - Ensure circuit rotation working - ⚠️ Test for leaks - Regular DNS and traffic leak testing - ⚠️ VM snapshots - Regular backups before major changes
🚀 Future Multi-Network Integration¶
🌐 I2P Integration Plan¶
I2P Router Container:
# Future implementation
podman run -d --name nexus-i2p \
--network nexus-container-net \
--ip 10.152.153.10 \
-p 7657:7657 \
-p 4444:4444 \
i2p/i2p
I2P Traffic Routing: - HTTP Proxy: 10.152.153.10:4444 - SOCKS Proxy: 10.152.153.10:4445 - Router Console: 10.152.153.10:7657 - Eepsite Hosting: Automatic .i2p domain registration
🕸️ Yggdrassil Integration Plan¶
Yggdrassil Mesh Node:
# Future implementation
podman run -d --name nexus-yggdrassil \
--network nexus-container-net \
--ip 10.152.153.20 \
--privileged \
yggdrasil/yggdrasil
Mesh Network Features: - IPv6 Overlay Network - Decentralized Routing - Peer Discovery - End-to-End Encryption
🔀 Network Orchestration Engine¶
Traffic Routing Logic:
# Future multi-network routing
1. Primary: Tor (existing medusa multi-circuit)
2. Failover: I2P router with .i2p domains
3. Mesh: Yggdrassil for peer-to-peer communication
4. Orchestration: Smart routing based on destination/performance
Hidden Service Trinity:
- service.onion (Tor)
- service.i2p (I2P)
- service.ygg (Yggdrassil)
📊 Performance Specifications¶
🔧 Resource Requirements¶
Host System (Alpine NeXuS): - CPU: 2+ cores recommended - RAM: 4GB minimum, 8GB recommended - Storage: 10GB available for VM - Network: Ethernet interface for bridge
Gateway VM: - CPU: 2 cores allocated - RAM: 2GB allocated - Storage: 20GB disk space - Network: Dual interfaces (internal + bridge)
📈 Performance Metrics¶
Typical Performance: - Latency: +200-500ms (Tor overhead) - Throughput: 5-50 Mbps (depending on Tor circuits) - DNS Resolution: 50-200ms (through Tor) - Connection Establishment: 1-3 seconds (circuit building)
Optimization Tips: - Regular Tor circuit rotation - Multiple Tor instances (medusa multi-head) - SSD storage for VM for better I/O - Adequate RAM prevents swap usage
📞 Support & Maintenance¶
🔄 Regular Maintenance Tasks¶
Weekly Tasks:
# VM security updates (inside VM)
sudo apt update && sudo apt upgrade -y
# Check Tor bootstrap status
sudo journalctl -u tor@default | tail -20
# Verify network connectivity
/home/user/gateway-vm/scripts/test-nexus-connectivity.sh
Monthly Tasks:
# VM snapshot for backup
virsh snapshot-create-as whonix-gateway \
"monthly-backup-$(date +%Y%m%d)" \
"Monthly maintenance snapshot"
# Clean old snapshots (keep 3 most recent)
virsh snapshot-list whonix-gateway
# virsh snapshot-delete whonix-gateway <old-snapshot-name>
# Performance analysis
# Review connectivity logs for patterns
tail -100 /home/user/gateway-vm/logs/connectivity.log
📋 Health Monitoring¶
System Health Checks:
# Bridge health
ping -c 3 10.152.152.10
brctl show nexus-br0
# VM resource usage
virsh domstats whonix-gateway
# Tor circuit health (inside VM)
sudo journalctl -u tor@default | grep -E "(circuit|bootstrap)"
🎯 Conclusion¶
The NeXuS Gateway Multi-Network Architecture provides a robust foundation for censorship-resistant, anonymous networking through a professionally managed VM-based system.
Key Achievements: - ✅ Complete Infrastructure - Organized directory structure with comprehensive automation - ✅ Network Isolation - VM boundary with transparent proxy routing - ✅ Democratic Security - Easy setup with enterprise-grade anonymity - ✅ Extensible Design - Ready for I2P and Yggdrassil integration - ✅ Production Ready - Complete testing and validation framework
Next Phase: Container orchestration with Podman unprivileged containers for I2P router and Yggdrassil mesh node integration.
🌀 Generated under NeXuS supervision with multi-network anonymity architecture
Co-Created-By: HackenStacks hackenstacks@nexus.local
Co-Authored-By: Claude noreply@anthropic.com
OAAE Framework: Observe → Assess → Adapt → Evolve
Manual Status: COMPREHENSIVE DEPLOYMENT GUIDE COMPLETE ✅
NeXuS Compliance: FULL DOCUMENTATION WITH SAFETY PROTOCOLS 🌀
Architecture Level: ENTERPRISE-GRADE MULTI-NETWORK ANONYMITY 🛡️
Happy NeXuS Gateway deployment! 🌐🔥🚀