# clash chain proxy config: wiring a two-layer relay + static residential chain

> A hands-on clash chain proxy config walkthrough: how to write the two outbounds, how to pin a select group, how to point rules, how to patch DNS and UDP, and finally how to verify step by step with /ip → /dns → /webrtc → /claude.

- Source: https://ipnet.coffee/en/news/clash-chain-proxy-config-relay-static-residential
- Published: 2026-11-26
- Updated: 2026-11-26
- Publisher: ipnet.coffee

A clash chain proxy config in mihomo needs no plugin: you just add a `dialer-proxy` field to the landing outbound pointing at the front relay. The three things that actually go wrong are elsewhere: circular dependency when DNS resolves the proxy endpoint, UDP not following along, and rules pointing the target domain at the relay group instead of the landing group. Below, in config-file order.

What each layer does is covered elsewhere — see [the two-layer relationship between relay nodes and static IPs](https://ipnet.coffee/news/relay-node-vs-static-ip-two-layers) and [how to order the node chain for your exit IP](https://ipnet.coffee/news/claude-exit-ip-node-chain-static). This article is only about wiring them together.

## clash chain proxy config: how do you write the two outbounds? attach dialer-proxy to the landing

The relay outbound is an ordinary ss / vmess / trojan entry; the landing outbound gets one extra line, `dialer-proxy`. Per the mihomo docs on `dialer-proxy`, this outbound's TCP connection is first handed to the outbound named in `dialer-proxy`, which then connects to the landing server.

```yaml
proxies:
  # 第一层：中转节点，负责把你送出去
  - name: "relay-hk"
    type: ss
    server: 203.0.113.10      # 填数字 IP，不要填域名
    port: 8388
    cipher: aes-256-gcm
    password: "your-password"
    udp: true

  # 第二层：静态住宅落地，对方看到的是这个 IP
  - name: "landing-us-resi"
    type: socks5
    server: 198.51.100.20     # 同样填数字 IP
    port: 1080
    username: "user"
    password: "pass"
    udp: true
    dialer-proxy: "relay-hk" # 关键：这一行把两层串起来
```

Fill both `server` fields with numeric IPs. If you use a domain, mihomo has to resolve that domain before it can connect to the proxy — and that resolution may itself go through the proxy, which loops. If your landing provider only gave you a domain, at least make the relay layer an IP and let `proxy-server-nameserver` resolve the landing domain (next section).

Set `udp: true` on both layers. Enabling it on only one is the same as not enabling it at all; more on that in the UDP section below.

## Why must proxy-groups use select instead of url-test?

Automatic latency-based switching is the worst thing you can do to a chained proxy. url-test will bounce between the two outbounds, the exit IP changes with it, and the platform sees the same session changing IPs. Use `select` and pin it manually to the landing outbound.

```yaml
proxy-groups:
  - name: "AI-落地"
    type: select
    proxies:
      - "landing-us-resi"   # 平时选这个
      - "relay-hk"          # 备用：只走中转，用来对比排查
      - "DIRECT"
```

Keeping `relay-hk` in the group is useful: when you suspect the landing is broken, switch over and compare the `/ip` result — you can quickly tell whether the landing died or the relay did. But don't leave it selected day to day; the relay node's exit IP is usually not the one you want.

## Which group should rules point at?

Miswritten rules are the other common failure: the domain points at the relay group, traffic actually goes single-layer, and `/ip` still shows the relay's IP.

```yaml
rules:
  - DOMAIN-SUFFIX,anthropic.com,AI-落地
  - DOMAIN-SUFFIX,claude.ai,AI-落地
  - DOMAIN-SUFFIX,openai.com,AI-落地
  - DOMAIN-SUFFIX,chatgpt.com,AI-落地
  - DOMAIN-SUFFIX,tiktok.com,AI-落地
  - GEOIP,CN,DIRECT
  - MATCH,DIRECT
```

Note the `MATCH,DIRECT` fallback. Many people write `MATCH,AI-落地` out of habit, and then all traffic exits through the residential IP — burning through your bandwidth quota and adding latency. Point only the domains that need a fixed exit at the group, and let everything else go direct.

To confirm your routing actually took effect after editing rules, use the [connectivity check](https://ipnet.coffee/en/link); it shows the actual exit IP each site sees, which is faster than reading logs.

## How should DNS be configured so it doesn't loop?

```yaml
dns:
  enable: true
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  fake-ip-filter:
    - "*.lan"
    - "*.local"
  nameserver:
    - https://1.1.1.1/dns-query
    - https://8.8.8.8/dns-query
  proxy-server-nameserver:
    - https://223.5.5.5/dns-query
    - https://119.29.29.29/dns-query
```

`fake-ip` keeps domain resolution from blocking connection setup: the browser asks for a domain, mihomo immediately returns a fake 198.18.x.x address, and the real resolution is deferred to connection time and follows your rules. For a chained proxy this avoids the cascading failure where "resolution hasn't finished but the connection has already timed out."

`proxy-server-nameserver` is listed separately because it resolves the proxy servers' own domains. It must use direct DNS, not go through the proxy — otherwise you have the circular dependency of "to connect to the proxy, you first have to resolve the proxy address through the proxy." That's why the previous section recommends numeric IPs for proxy endpoints: with an IP, this dependency doesn't exist at all and `proxy-server-nameserver` is just a fallback.

Keep `*.lan` and `*.local` in `fake-ip-filter` so LAN devices don't break on fake addresses.

## Why does a TCP-only chain leak WebRTC?

This is the most overlooked part of chaining. WebRTC's STUN requests go over UDP (protocol details in [RFC 5389](https://www.rfc-editor.org/rfc/rfc5389)). If the chain only carries TCP, those UDP packets never enter the tunnel — they go straight out your local NIC, and the other side still sees your real IP. The symptom: `/ip` shows the landing residential IP, but `/webrtc` coughs up a local broadband address.

Check three places:

- `udp: true` on the relay outbound
- `udp: true` on the landing outbound
- whether the client is using TUN mode or UDP forwarding (with system proxy only, UDP doesn't go through by default)

TUN mode takes over all traffic, so UDP follows; system proxy only handles HTTP/HTTPS and leaves UDP outside. The difference between the two modes is covered in [system proxy vs TUN](https://ipnet.coffee/news/claude-code-system-proxy-vs-tun).

If the landing is socks5, confirm the server supports UDP ASSOCIATE (SOCKS5 UDP forwarding is defined in [RFC 1928](https://www.rfc-editor.org/rfc/rfc1928) section 7). If it doesn't, the UDP leg is simply broken no matter how you configure the client, and WebRTC checks will still see your local address. In that case, either switch to a landing that supports UDP, or disable WebRTC in the browser.

## How do you verify after changes? Go /ip → /dns → /webrtc → /claude in order

Don't open Claude right after editing. Walk through in this order so that when something breaks you can pinpoint the layer.

**Step one, [/ip](https://ipnet.coffee/en/ip).** Check three things: is the exit IP the landing's static residential IP; is the ASN correct; is the residential/datacenter classification "residential." If it still shows the relay's IP, either `dialer-proxy` didn't take effect or rules point at the wrong group.

**Step two, [/dns](https://ipnet.coffee/en/dns).** Check whether the resolver's location matches the exit IP's region. Exit in the US but resolver in Hong Kong means DNS isn't following the chain, and the platform sees conflicting regional signals.

**Step three, [/webrtc](https://ipnet.coffee/en/webrtc).** Check whether your real IP or a LAN address is exposed. If so, go back to the previous section and check UDP.

**Step four, [/claude](https://ipnet.coffee/en/claude).** Only once the first three are clean, look at the scenario page; it combines exit cleanliness, region, DNS and WebRTC into a verdict. Do it out of order and a scenario-page error won't tell you which layer is at fault.

Once all four pass, open the ChatGPT or TikTok scenario pages ([/gpt](https://ipnet.coffee/en/gpt), [/tiktok](https://ipnet.coffee/en/tiktok)) — same logic, different target market.

## What are the most common misconfigurations?

- `dialer-proxy` is set to a string other than the relay outbound's `name`; mihomo starts without an error but the chain isn't connected, and `/ip` gives it away immediately.
- The landing outbound is missing `udp: true`: TCP works, WebRTC leaks.
- proxy-groups uses url-test, so the exit IP jumps mid-session.
- `MATCH` in rules points at the landing group, sending all traffic through the residential IP.
- The proxy endpoint is a domain and `proxy-server-nameserver` isn't configured properly, so startup hangs on resolution or fails to connect at all.

## FAQ

### Does a clash chain proxy config need a plugin?

No. The mihomo core supports `dialer-proxy` natively; add one line to the landing outbound pointing at the front relay and the two layers are chained. The old Clash core (non-mihomo) doesn't have this field, so you'd need to switch cores.

### Why does /ip still show the relay node's IP as the exit?

Two causes are most common: the `dialer-proxy` value doesn't exactly match the relay outbound's `name` (case and spaces count), or rules point the target domain at the relay group. First check which group the rules point at, then verify the `dialer-proxy` string.

### The chain is configured, but WebRTC still exposes my local IP — what now?

That means UDP isn't entering the tunnel. Check three things in order: does the relay outbound have `udp: true`, does the landing outbound have `udp: true`, and is the client using system proxy only rather than TUN. System proxy only handles HTTP/HTTPS; UDP doesn't pass through it.

### My landing is socks5 — do I have to enable UDP?

Yes, but only if the server supports UDP ASSOCIATE. If it doesn't, the UDP leg is broken no matter how the client is configured, and WebRTC checks will still see your local address. In that case you can only switch to a landing that supports UDP, or disable WebRTC in the browser.

### Why can't proxy-groups use url-test?

url-test switches outbounds automatically based on latency, and the exit IP changes with each switch. An exit IP that jumps mid-session looks like an inconsistent environment to the platform. Use select to pin it manually, and switch by hand only when you need to compare and troubleshoot.

### What do I need to restart after changing the config?

Restart the proxy client so the config takes effect, then restart the browser and terminal — DNS caches and existing connections linger for a while after a config change, and without a restart you may still be measuring the old result.
