找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 4|回复: 0

手把手教你如何在飞牛 OS 中使用网

[复制链接]

18

主题

0

回帖

58

积分

注册会员

积分
58
发表于 3 天前 | 显示全部楼层 |阅读模式

没有代理设置怎么行,这可是直接与世界脱离连接了啊,于是我便开始努力寻找解决方案,最后得到了一个并不完美但可行的方案:使用虚空终端 mihomo(clash meta) 及对应的 WebUI。

知道怎么 ssh 连接的读者可直接跳过该部分

更改系统设置

测试连接

以下是部分连接举例。

Powershell
1
2
3
4
# 输入下方命令,自行替换用户名和 IP
ssh 用户名@IP
# 举例如下
ssh windowbr@192.168.1.1

若您看到类似以下字样则代表连接成功

1
windowbr@MyNAS:~$
Termius

依次填入 IP、用户名、密码后连接。

前往 [color=var(--color-primary)]mihomo 发布页面 下载安装包,根据文档中的[color=var(--color-primary)]我应该下载哪个文件?来选择合适的版本。

然后用任何你喜欢的方式将安装包上传到 NAS,当然你也可以直接 ssh 进去使用终端下载,但如果你都会这么做了也不需要看这部分教程了不是吗。

安装 mihomo

如果你不知道路径是什么,就前往文件管理→右键存放安装包的文件夹→详细信息→复制原始路径,然后直接粘贴到对应位置
注:许多 ssh 工具无法使用 Ctrl+C/V 复制粘贴,请使用 Ctrl+insert 复制,shift+insert 粘贴

使用dpkg命令安装

1
2
# 自行替换为安装包的文件名
$ sudo dpkg -i 文件名

使用以下命令拉取镜像并运行

1
$ sudo docker run -d --restart always -p 9097:80 --name metacubexd ghcr.io/metacubex/metacubexd

如果一切顺利,你应该能在 docker 容器中看到 metacubexd

使用浏览器输入IP:端口来访问 WebUI(即使现在它并没有实际作用,但你也应该能够访问)

编写 config.yaml

其中 proxy-providers 内的几个尖括号需要你自行更改(修改后不含尖括号),提供者名称和前缀可随意填写,仅影响显示不影响使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
mixed-port: 7890
allow-lan: true
bind-address: '*'
mode: rule
log-level: info
external-controller: '0.0.0.0:9090'

tun:
  enable: true
  stack: mixed
  dns-hijack:
    - "any:53"
    - "tcp://any:53"
  auto-route: true
  auto-redirect: true
  auto-detect-interface: true

proxy-providers:
  <节点提供者名称>:
    url: "<节点订阅链接>"
    type: http
    interval: 86400
    health-check: {enable: true,url: "https://www.gstatic.com/generate_204", interval: 300}
    override:
      additional-prefix: "<节点名称前缀>"

proxies:
  - name: "直连"
    type: direct
    udp: true

geodata-mode: true
geox-url:
  geoip: "https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat"
  geosite: "https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat"
  mmdb: "https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country-lite.mmdb"
  asn: "https://mirror.ghproxy.com/https://github.com/xishang0128/geoip/releases/download/latest/GeoLite2-ASN.mmdb"

dns:
  enable: true
  ipv6: true
  respect-rules: true
  enhanced-mode: fake-ip
  fake-ip-filter:
    - "*"
    - "+.lan"
    - "+.local"
    - "+.market.xiaomi.com"
  nameserver:
    - https://120.53.53.53/dns-query
    - https://223.5.5.5/dns-query
  proxy-server-nameserver:
    - https://120.53.53.53/dns-query
    - https://223.5.5.5/dns-query
  nameserver-policy:
    "geosite:cn,private":
      - https://120.53.53.53/dns-query
      - https://223.5.5.5/dns-query
    "geosite:geolocation-!cn":
      - "https://dns.cloudflare.com/dns-query"
      - "https://dns.google/dns-query"

proxy-groups:

  - name: 默认
    type: select
    proxies: [自动选择,直连,香港,台湾,日本,新加坡,美国,其它地区,全部节点]

  - name: Google
    type: select
    proxies: [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]

  - name: Telegram
    type: select
    proxies: [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]

  - name: Twitter
    type: select
    proxies: [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]

  - name: 哔哩哔哩
    type: select
    proxies: [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]

  - name: 巴哈姆特
    type: select
    proxies: [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]

  - name: YouTube
    type: select
    proxies: [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]

  - name: NETFLIX
    type: select
    proxies: [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]

  - name: Spotify
    type: select
    proxies:  [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]

  - name: Github
    type: select
    proxies:  [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]

  - name: 国内
    type: select
    proxies:  [直连,默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择]

  - name: 其他
    type: select
    proxies:  [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]

  #分隔,下面是地区分组
  - name: 香港
    type: select
    include-all: true
    filter: "(?i)港|hk|hongkong|hong kong"

  - name: 台湾
    type: select
    include-all: true
    filter: "(?i)台|tw|taiwan"

  - name: 日本
    type: select
    include-all: true
    filter: "(?i)日|jp|japan"

  - name: 美国
    type: select
    include-all: true
    filter: "(?i)美|us|unitedstates|united states"

  - name: 新加坡
    type: select
    include-all: true
    filter: "(?i)(新|sg|singapore)"

  - name: 其它地区
    type: select
    include-all: true
    filter: "(?i)^(?!.*(?:🇭🇰|🇯🇵|🇺🇸|🇸🇬|🇨🇳|港|hk|hongkong|台|tw|taiwan|日|jp|japan|新|sg|singapore|美|us|unitedstates)).*"

  - name: 全部节点
    type: select
    include-all: true

  - name: 自动选择
    type: url-test
    include-all: true
    tolerance: 10

rules:
  - GEOIP,lan,直连,no-resolve
  - GEOSITE,github,Github
  - GEOSITE,twitter,Twitter
  - GEOSITE,youtube,YouTube
  - GEOSITE,google,Google
  - GEOSITE,telegram,Telegram
  - GEOSITE,netflix,NETFLIX
  - GEOSITE,bilibili,哔哩哔哩
  - GEOSITE,bahamut,巴哈姆特
  - GEOSITE,spotify,Spotify
  - GEOSITE,CN,国内
  - GEOSITE,geolocation-!cn,其他

  - GEOIP,google,Google
  - GEOIP,netflix,NETFLIX
  - GEOIP,telegram,Telegram
  - GEOIP,twitter,Twitter
  - GEOIP,CN,国内
  - MATCH,其他

我不会详细介绍各配置项的内容及其含义,需要详细了解的请自行查阅 [color=var(--color-primary)]mihomo 文档

使用 ssh 连接,输入以下命令

1
2
# 自行替换为 config.yaml 文件所在的文件夹的路径
$ sudo mihomo -d 路径

找不到路径的前文有说明,自行往回翻阅

至此,你应该已经能够自行使用并畅游网络了

注:若您没有安装 WebUI,请自行研究相关管理方案,因为我也不会,所以不会提供纯命令行使用 mihomo 的教学

我的后台运行方案基于screen,其他方法自行研究。

screen 是一个终端多窗口软件,可以使终端能做到类似 Windows 一样将窗口最小化并挂起,即使关闭终端也不会关闭使用 screen 创建的窗口

所以本方法的原理基本相当于开一个窗口前台运行 mihomo,然后把它最小化挂在那

安装 screen

这一步或许会需要你输入密码,输入过程中不会显示,输入完成后直接回车

创建窗口并运行 mihomo
1
2
3
# 创建新窗口并进入
# mihomo 为窗口名称,你可意改为自己喜欢的名字
$ screen -R mihomo

退出窗口请使用快捷键 Ctrl+A+D,重新进入窗口的命令与创建并进入窗口的命令相同,设备重启后需重新创建窗口并运行 mihomo。

Q&AQ:为什么本地运行 mihomo 而使用 docker 运行 WebUI?

A:因为我发现在线版本我连接不上 NAS 的后端,原因未知,有人知道原因的话麻烦评论留言告诉我一下。

Q:为什么 WebUI 选择了 metacubexd 而不是 yacd 或其他?

A:因为 screen 足够简单好用,我也不刚需开机自启动。

Q:感觉 config.yaml 写得不够好?

A:也许你的感觉是对的,我也是现学现写的,或许不够好但它确实能用,如果有什么改进的方案欢迎留言。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|图拉丁吧社区

GMT+8, 2025-7-20 22:01 , Processed in 0.058016 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表