
After half a year of tinkering with my home network, I finally got a multi-gateway redundancy architecture working. This article shares the overall design approach—it’s for people with some hands-on experience who want a more stable network.
Why You Need Multiple Gateways
The biggest problem with a single gateway is a single point of failure: if your VPS gets blocked, the line stutters, or the machine crashes, your entire network goes down.
The core value of multiple gateways:
- Circuit redundancy: multiple exit points in the US / Hong Kong / Japan, automatically choosing the fastest one
- Traffic separation: different traffic uses different exits, saving bandwidth while maintaining speed
- Automatic failover: if one circuit goes down, others automatically take over without the user noticing
Overall Architecture
Home devices
↓
OpenWrt primary router (DNS routing → dnsmasq)
↓
mihomo gateway (routing rules → policy groups)
↓
Multiple VPS exits (US / HK / JP)
↓
Target websites
Key components:
- Primary router: OpenWrt, responsible for DNS hijacking and routing traffic to mihomo
- mihomo node: runs on a separate machine, handles proxying and routing logic
- VPS exits: I recommend DMIT—Hong Kong / US nodes have stable latency and support Xray + Hysteria2
mihomo Routing Rule Design
Policy Group Hierarchy
proxy-groups:
# Manual selection group (emergency backup)
- name: "Manual Select"
type: select
# Auto-select fastest node
- name: "Auto Select"
type: url-test
url: "http://www.gstatic.com/generate_204"
interval: 300
# Regional groups
- name: "🇺🇸 US"
type: url-test
filter: "US|United States"
- name: "🇭🇰 Hong Kong"
type: url-test
filter: "Hong Kong|HK"
# Routing decision groups
- name: "Domestic Direct"
type: select
proxies: [DIRECT]
- name: "AI Services"
type: select
proxies: ["🇺🇸 US", "Auto Select"]
Rule Priority
mihomo rules match from top to bottom, so order matters:
rules:
# Local / LAN direct
- IP-CIDR,192.168.0.0/16,DIRECT
- IP-CIDR,10.0.0.0/8,DIRECT
# AI services via US
- DOMAIN-SUFFIX,openai.com,AI Services
- DOMAIN-SUFFIX,anthropic.com,AI Services
- DOMAIN-SUFFIX,claude.ai,AI Services
# Domestic main domains direct (reduce latency)
- GEOSITE,cn,Domestic Direct
- GEOIP,CN,Domestic Direct
# Everything else via auto-select
- MATCH,Auto Select
DNS Anti-Pollution
This is the most error-prone part. Architecture:
Device queries DNS
→ dnsmasq (local cache + routing decision)
→ Domestic domains → 114.114.114.114 (direct)
→ Foreign domains → mihomo's DNS (queried via proxy)
The key is to avoid domestic DNS pollution of foreign domain resolution.
VPS Selection Tips
I’ve used many providers, and DMIT currently offers the best value:
| Data Center | Latency (Guangzhou) | Characteristics |
|---|---|---|
| Hong Kong | 20-40ms | Fastest, ideal for low-latency needs |
| US Los Angeles | 150-180ms | CN2 GIA optimized, stable |
| Japan Tokyo | 60-90ms | Backup option, affordable pricing |
FAQ
Q: What if all nodes time out?
A: First check if the VPS is reachable via ping (to rule out blocking), then verify your mihomo config syntax.
Q: Why are domestic websites slow?
A: Check whether your GEOSITE/GEOIP rules are active—your DNS queries might be routing through the proxy.
Q: How do I monitor latency on each node?
A: mihomo has a built-in API that you can integrate with Grafana for real-time monitoring.
Got questions? Feel free to reach out on Telegram or X.
Further Reading:
- Xray VLESS+XTLS Deployment Guide — Server-side protocol configuration
- VPS Selection Guide — Which VPS providers are best for exit nodes
- VPS IP Blocked—What to Do — Emergency solutions
📷 Hero image · Generated with Flux Schnell AI · panshi.io brand style