折腾 NAS

记录了我折腾 NAS 的相关问题和解决方案。

有线 mesh

  1. 子路由连 lan 口
  2. 关闭 DHCP
  3. 子路由修改 wifi 名字和主路由相同

在此之后,子路由会重启,然后就无法再次登录子路由的管理界面了。连着子路由,tracert 也不会显示子路由的 ip。

要做到无缝切换,需要整个过程中 ip 地址是不变的,因此主路由和副路由需要在同一个网段里面。

外网访问

为了实现快速的外网访问,有几种思路:

  1. 使用一个服务器转发
  2. 类似 ZeroTier 的 VPN 方案
  3. 直接使用公网 IP

对于后两种方案,需要:

  1. 首先实现“光猫改桥接”,然后使用路由器拨号。这样,光猫只会负责光信号转电信号,路由器实际上是整个家庭网络的边界了。
  2. 开启路由器的 UPnP 功能。

ZeroTier

光猫改桥接

对于移动来说,路由器拨号的账户是手机号,密码可以打 10086 重置密码。

全局梯子

OpenClash

下面是第一个配置的截图。总共有 10 张图,修改 url 来查看其他的图。

覆写设置 -> 开发者选项

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
#!/bin/sh
. /usr/share/openclash/ruby.sh
. /usr/share/openclash/log.sh
. /lib/functions.sh

# This script is called by /etc/init.d/openclash
# Add your custom overwrite scripts here, they will be take effict after the OpenClash own srcipts

LOG_OUT "Tip: Start Running Custom Overwrite Scripts..."
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
LOG_FILE="/tmp/openclash.log"
CONFIG_FILE="$1" #config path

#Simple Demo:
#General Demo
#1--config path
#2--key name
#3--value
#ruby_edit "$CONFIG_FILE" "['redir-port']" "7892"
#ruby_edit "$CONFIG_FILE" "['secret']" "123456"
#ruby_edit "$CONFIG_FILE" "['dns']['enable']" "true"

#Hash Demo
#1--config path
#2--key name
#3--hash type value
ruby_edit "$CONFIG_FILE" "['experimental']" "{'sniff-tls-sni'=>true}"
#ruby_edit "$CONFIG_FILE" "['sniffer']" "{'sniffing'=>['tls','http']}"

#Array Demo:
#1--config path
#2--key name
#3--position(start from 0, end with -1)
#4--value
#ruby_arr_insert "$CONFIG_FILE" "['dns']['nameserver']" "0" "114.114.114.114"

#Array Add From Yaml File Demo:
#1--config path
#2--key name
#3--position(start from 0, end with -1)
#4--value file path
#5--value key name in #4 file
#ruby_arr_add_file "$CONFIG_FILE" "['dns']['fallback-filter']['ipcidr']" "0" "/etc/openclash/custom/openclash_custom_fallback_filter.yaml" "['fallback-filter']['ipcidr']"

#Ruby Script Demo:
#ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
# begin
# Value = YAML.load_file('$CONFIG_FILE');
# rescue Exception => e
# puts '${LOGTIME} Error: Load File Failed,【' + e.message + '】';
# end;

#General
# begin
# Thread.new{
# Value['redir-port']=7892;
# Value['tproxy-port']=7895;
# Value['port']=7890;
# Value['socks-port']=7891;
# Value['mixed-port']=7893;
# }.join;

# rescue Exception => e
# puts '${LOGTIME} Error: Set General Failed,【' + e.message + '】';
# ensure
# File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)};
# end" 2>/dev/null >> $LOG_FILE

exit 0

注意,和 PS5 相关的要走 DIRECT

1
2
3
4
- DOMAIN-SUFFIX,playstation.com,DIRECT
- DOMAIN-SUFFIX,playstation.com.hk,DIRECT
- DOMAIN-SUFFIX,playstation.net,DIRECT
- DOMAIN-SUFFIX,playstationnetwork.com,DIRECT