本文最后更新于 76 天前,其中的信息可能已经有所发展或是发生改变。
这个方案无需软路由,但是需要至少有一台设备始终校园网在线,核心思路还是让其他设备的流量通过一台已登录校园网的设备出网。
当未登录校园网的设备可以访问局域网 IP 时,此方案可用。
首先你需要在已登录校园网的设备上运行任意代理软件的服务端,例如开启了允许局域网、监听了 sock5 端口的 mihomo,即 mihomo 的配置中包含如下内容:
bind-address: 0.0.0.0
socks-port: 7891
allow-lan: true
authentication:
- user:password
注意!请务必确保设置复杂的用户名和密码,并妥善保管!!!!
若你的校园网环境会对 sock5 流量限速,可考虑伪装流量,例如伪装为 HTTP/3 请求。
接下来,在其他需要使用校园网的设备上,使用以下配置启动 mihomo 即可(注意补全相应字段):
proxies:
- name: Mihomo SOCKS5
type: socks5
server: <已登录校园网的设备 IP>
port: <配置中的 socks-port>
udp: true
username: <authentication 中的用户名>
password: <authentication 中的密码>
proxy-groups:
- name: Mihomo
type: select
proxies:
- Mihomo SOCKS5
rules:
- MATCH,Proxy
dns:
enable: true
ipv6: false
enhanced-mode: redir-host
listen: 127.0.0.1:7874
respect-rules: true
nameserver:
- <上游 DNS 地址>
proxy-server-nameserver:
- <上游 DNS 地址>
tun:
enable: true
stack: system
device: utun
dns-hijack:
- any:53
endpoint-independent-nat: true
auto-route: true
auto-detect-interface: true
strict-route: true