mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-12-03 11:14:01 +01:00
fix(mihomo): use fake-IP for gateway IPv6 (#442)
This commit is contained in:
1 parent
c888dd65e9
commit
bb89987640
5 files changed
+26
-30
No files matched your search
@@ -62,12 +62,19 @@ Verge UI. Verge logs `Unregistered Clash configuration key "ipv6"` for the pin -
|
||||
still reaches the core.
|
||||
|
||||
The gateway (`suzi`, not a host in this flake) runs the same config with a fixed set of deltas --
|
||||
`gateway-config.nu` renders it from the same `sources.yaml` and `policy.yaml`. Its output carries
|
||||
the subscriptions and the private domains, so never commit it; the secret is filled in on the box,
|
||||
not here. Its binary is a static release build under `/usr/local/bin`, not a package: update it by
|
||||
hand, validate the live config with the new core (`mihomo -t -d /etc/mihomo -f <candidate>`) before
|
||||
swapping, and keep the previous binary. The release ships no checksums, so TLS plus `-v` is the
|
||||
whole verification.
|
||||
`gateway-config.nu` renders it from the same `sources.yaml` and `policy.yaml`. The gateway uses
|
||||
nftables TProxy, disables the desktop TUN auto-route, and uses `fake-ip` DNS with `dns.ipv6: true`:
|
||||
LAN clients receive stable fake A/AAAA mappings so mihomo retains the domain for routing and
|
||||
sniffing. Its output carries the subscriptions and the private domains, so never commit it; the
|
||||
secret is filled in on the box, not here. Its binary is a static release build under `/usr/local/bin`,
|
||||
not a package: update it by hand, validate the live config with the new core (`mihomo -t -d /etc/mihomo
|
||||
-f <candidate>`) before swapping, and keep the previous binary. The release ships no checksums, so TLS
|
||||
plus `-v` is the whole verification.
|
||||
|
||||
Gateway mode contract: the tested working combinations are nftables TProxy with both `tun.enable`
|
||||
and `tun.auto-route` disabled, using either `redir-host` or `fake-ip` DNS. This generator selects
|
||||
`fake-ip` because it preserves more domain information. Do not combine LAN TProxy with the desktop
|
||||
TUN auto-route: in this gateway topology it can recapture fake IPv6 dials and cause timeouts.
|
||||
|
||||
## Why generate
|
||||
|
||||
|
||||
@@ -36,9 +36,14 @@ def main [
|
||||
| insert external-ui "ui"
|
||||
| insert external-ui-url $UI_URL
|
||||
| update secret "GATEWAY-SECRET-PLACEHOLDER"
|
||||
# the base leaves the stack at upstream's default; this box has run the kernel stack for months
|
||||
| upsert tun.stack "mixed"
|
||||
# The gateway uses nftables TProxy for LAN traffic; its desktop-style TUN
|
||||
# auto-route would capture the gateway's own DIRECT IPv6 dials again.
|
||||
| upsert tun.enable false
|
||||
| upsert tun.auto-route false
|
||||
| update tun.strict-route false
|
||||
# TProxy handles fake IPv4 and IPv6 destinations when the desktop TUN
|
||||
# auto-route is disabled; fake-IP preserves the domain mapping for LAN flows.
|
||||
| upsert dns.enhanced-mode "fake-ip"
|
||||
# the desktop's resolver is loopback; a gateway serves the LAN instead
|
||||
| update dns.listen ":1053"
|
||||
# LAN clients that use DoH dial the IPs they resolved; sniff so the node dials a name
|
||||
|
||||
Reference in new issue
Block a user