GeoIP & Maps¶
WireBuddy integrates MaxMind GeoLite2 databases for geographic traffic analysis and visualization.
Overview¶
The GeoIP module provides:
- πΊοΈ Interactive Maps: Visual traffic heatmaps
- π Country Analysis: Traffic by destination country
- π’ ASN Tracking: Traffic by Autonomous System Number
- π© Country Flags: Visual country identification
- π Traffic Statistics: Per-country and per-ASN metrics
Setup¶
Enable GeoIP¶
GeoIP is enabled by default. WireBuddy includes GeoLite2 databases.
Navigate to: Settings β General β GeoIP
- Auto-Update: Enable weekly database updates
- Update Now: Manually update databases
Database Information¶
WireBuddy uses two GeoLite2 databases:
| Database | Purpose | Size |
|---|---|---|
| GeoLite2-City | Country, city, and location data | ~70 MB |
| GeoLite2-ASN | Autonomous System information | ~10 MB |
Databases are stored in data/geolite2/.
Features¶
Traffic by Country¶
Navigate to: Traffic β By Country
View traffic breakdown by destination country:
| Country | Flag | Traffic (β) | Traffic (β) | Total | % |
|---|---|---|---|---|---|
| United States | πΊπΈ | 1.2 GB | 300 MB | 1.5 GB | 45% |
| Germany | π©πͺ | 800 MB | 150 MB | 950 MB | 29% |
| Japan | π―π΅ | 500 MB | 100 MB | 600 MB | 18% |
Traffic by ASN¶
Navigate to: Traffic β By ASN
View traffic breakdown by Autonomous System:
| ASN | Organization | Country | Traffic |
|---|---|---|---|
| AS15169 | Google LLC | United States | 1.2 GB |
| AS16509 | Amazon.com | United States | 800 MB |
| AS13335 | Cloudflare | United States | 600 MB |
Interactive Map¶
Navigate to: Traffic β Map
Visual heatmap showing:
- Connection Origins: Where your peers are located
- Traffic Destinations: Where traffic is going
- Intensity: Color-coded by traffic volume
Map Layers:
- Peer Locations: Your WireGuard client IPs (if detectable)
- Destination IPs: Where your peers are connecting
- Traffic Flow: Animated lines showing active connections (optional)
Per-Peer Geographic Data¶
View individual peer traffic breakdown:
Peers β [Select Peer] β Traffic β Geography
Shows that peer's traffic distribution by country and ASN.
Requirements¶
Conntrack Accounting¶
GeoIP analytics require conntrack byte accounting:
Without this:
- β Traffic-by-country charts will be empty
- β ASN statistics unavailable
- β Peer location lookup still works
See Quick Start for setup.
Network Mode Host¶
GeoIP tracking requires network_mode: host to access /proc/net/nf_conntrack.
How It Works¶
Connection Tracking¶
- WireBuddy monitors
/proc/net/nf_conntrackfor active connections - Filters connections by WireGuard peer IPs
- Extracts destination IPs from conntrack entries
- Performs GeoIP lookup for each destination
- Aggregates traffic by country/ASN
Data Collection¶
- Frequency: Every 60 seconds (configurable)
- Storage: Time-series database (TSDB)
- Retention: 90 days (configurable)
Privacy¶
- Local Processing: All GeoIP lookups happen locally (no external API calls)
- No Logging: Destination IPs are not permanently stored (only aggregated stats)
- Anonymization: Option to disable destination tracking per-peer
Configuration¶
Update Schedule¶
Settings β General β GeoIP β Update Schedule
Options:
- Weekly: Automatic updates every Monday (recommended)
- Monthly: First day of month
- Manual: Update via "Update Now" button only
Sampling Interval¶
Settings β General β Monitoring β Sample Interval
Adjust how often conntrack is polled:
- 30 seconds: High-frequency (more accurate, higher CPU)
- 60 seconds: Default (balanced)
- 120 seconds: Low-frequency (less accurate, lower CPU)
Disable Geographic Tracking¶
To disable per-peer geographic tracking:
Peers β Edit Peer β Privacy β Disable GeoIP Tracking
- Statistics for this peer won't be included in country/ASN analytics
- Peer can still see their own traffic totals
- Useful for privacy-conscious users
Use Cases¶
Security Monitoring¶
- Detect unexpected traffic to unusual countries
- Identify compromised accounts (traffic to known malicious ASNs)
- Monitor for C&C (Command and Control) server connections
Compliance¶
- Verify data residency requirements
- Track cross-border data flows
- Generate compliance reports
Network Analysis¶
- Understand traffic patterns
- Optimize CDN usage
- Identify bottlenecks by geographic region
Billing & Usage¶
- Track traffic by destination (useful for traffic-based billing)
- Identify top bandwidth consumers by country/ASN
- Generate usage reports
Troubleshooting¶
No Geographic Data¶
Problem: Traffic charts are empty or show "Unknown"
Solutions:
-
Enable conntrack accounting:
-
Verify GeoIP databases exist:
-
Update databases:
-
Settings β General β GeoIP β Update Now
-
Check logs for errors:
Inaccurate Data¶
Problem: Country identification is wrong
Causes:
- Destination uses CDN (reports CDN edge location, not actual destination)
- VPN chaining (destination appears as intermediate VPN)
- Tor/proxy usage
- GeoIP database outdated
Solutions:
- Update GeoLite2 databases
- Consider destination as CDN edge, not actual server
- No perfect solution for Tor/VPN chaining
High CPU Usage¶
Problem: GeoIP tracking uses too much CPU
Solutions:
- Increase sample interval to 120 seconds
- Reduce number of peers
- Disable geographic tracking for high-traffic peers
Data Export¶
Export Statistics¶
Download geographic statistics:
Traffic β By Country/ASN β Export
Formats:
- CSV: Country, traffic sent, traffic received, total
- JSON: Programmatic access with metadata
API Access¶
Retrieve statistics via API:
# Get country statistics
curl -H "Authorization: Bearer TOKEN" \
https://vpn.example.com/api/metrics/geo/countries
# Get ASN statistics
curl -H "Authorization: Bearer TOKEN" \
https://vpn.example.com/api/metrics/geo/asn
# Get per-peer geographic data
curl -H "Authorization: Bearer TOKEN" \
https://vpn.example.com/api/metrics/peers/PEER_ID/geo
MaxMind Licensing¶
WireBuddy uses GeoLite2 databases:
- License: Creative Commons Attribution-ShareAlike 4.0
- Accuracy: ~99.8% country-level, ~80% city-level
- Updates: Weekly from MaxMind
- Free: No API key required (bundled databases)
For commercial deployments, consider MaxMind GeoIP2 for higher accuracy.
Next Steps¶
- Monitoring - General traffic analytics
- Configuration - Advanced settings
- API Reference - Programmatic access