352 words
2 minutes
Forwarding Traffic with Realm for a Proxy Landing Setup
2025-01-20

Background#

In Using Alice DNS to Unlock Server Access Restrictions, I already had Alice DNS unlocking access. But since Alice DNS is a public service, it gets shaky during peak hours. So this time I switched to an Alice Hong Kong box as the landing server.

What You Need#

  • A box with well-optimized routes but a “dirty” IP, acting as the relay that gets traffic through the GFW — for example a Claw Cloud Hong Kong machine
  • An Alice Hong Kong box as the landing server — no GFW in the path, but the IP needs to be clean, for example an Alice Hong Kong machine

Diagram#

alt text

Implementation#

The Relay#

The relay uses Realm to forward traffic to the landing server.

Terminal window
# One-click Realm installer script
wget -N https://raw.githubusercontent.com/qqrrooty/EZrealm/main/realm.sh && chmod +x realm.sh && ./realm.sh

Once you’re in the panel, install Realm first, then add a forwarding rule:

  • Local listen port: anything in 1-65535
  • IP to forward to: the landing server’s IP
  • Port to forward to: any port in 1-65535 — this must be the port the landing server receives traffic on (the port generated when you set up the proxy protocol on the landing server later, e.g. 28175)

The Landing Server#

Just set up a proxy protocol with the usual script. For ss, for example:

Terminal window
# One-click ss installer script
wget -O ss-rust.sh --no-check-certificate https://raw.githubusercontent.com/xOS/Shadowsocks-Rust/master/ss-rust.sh && chmod +x ss-rust.sh && ./ss-rust.sh
IMPORTANT

If you go with SS, pick a 2022-series cipher — otherwise the IP will get blocked by the GFW.

After adding the protocol, the script prints something like this:

Terminal window
# The output below has been sanitized — don't try to use it as-is
Shadowsocks Rust 配置:
——————————————————————————————————
地址:173.152.108.142
地址:2a12:2813:321::69
端口:28175 # forwarding port on the relay
密码:QiHQ2B0j6dsya1982xE1uVbElK6pn5x8HNfmm+Mzky394=
加密:2022-blake3-aes-256-gcm
TFO :true
——————————————————————————————————
链接 [IPv4]:ss://MjAyMi1ibGFrZTMtYWV23hsjda8213HUS12nd1oWHkreEUxdVZiRWxLNnBuNXg4SE5mbW0rTXpreTM5ND1AMTU3LjI1NC4yMS4xNDI6MjgxNzU
二维码[IPv4]:https://cli.im/api/qrcode/code?text=ss://MjAyMi1ibGFrZTMtYWV23hsjda8213HUS12nd1oWHkreEUxdVZiRWxLNnBuNXg4SE5mbW0rTXpreTM5ND1AMTU3LjI1NC4yMS4xNDI6MjgxNzU
链接 [IPv6]:ss://MjAyMi1ibGFrZTMtYWV23hsjda8213HUS12nd1oWHkreEUxdVZiRWxLNnBuNXg4SE5mbW0rTXpreTM5ND1AMmExNDo2N2MwOjMwMzo6Njk6MjgxNzU
二维码[IPv6]:https://cli.im/api/qrcode/code?text=ss://MjAyMi1ibGFrZTMtYWV23hsjda8213HUS12nd1oWHkreEUxdVZiRWxLNnBuNXg4SE5mbW0rTXpreTM5ND1AMmExNDo2N2MwOjMwMzo6Njk6MjgxNzU
—————————————————————————
[信息] Surge 配置:
Const0822.alice.ws = ss,173.152.108.142,28175,encrypt-method=2022-blake3-aes-256-gcm,password=QiHQ2B0j6dsya1982xE1uVbElK6pn5x8HNfmm+Mzky394=,tfo=true,udp-relay=true,ecn=true
—————————————————————————

Testing#

First, test the proxy by connecting directly to the landing server’s protocol.

alt text

Then create a new proxy with the same credentials, but swap the IP and port for the relay’s, and test again:

alt text

TIP

The testing tool I used is Surge’s network-info module

Forwarding Traffic with Realm for a Proxy Landing Setup
https://www.mihouo.com/en/posts/server/using-realm-for-traffic-forwarding-to-achieve-proxy-landing/
Author
Jia
Published at
2025-01-20
License
CC BY-NC-SA 4.0