type
status
date
slug
summary
tags
category
icon
password
Property
Nov 8, 2023 04:35 AM
URL
说明
- 机器: 黑群晖 dsm3167
- cpu: x86 处理器
- 系统: 7.1
这里说的是旁路由,那么旁路由是干嘛的呢?网上的例子太复杂,不然来说一个场景
比如你现在有 iPhone,安卓手机,电脑,平板,以及家人的各种设备,你现在想上 YouTube,你怎么做?
当然你可以每个设备都下载科学上网软件, 这样固然可以,但是会存在一些问题,比如说你每一个设备都需要安装科学软件,这样的话就很麻烦, 很多时候比如说你 ps5 我或者说有 switch 等设备, 这些设备是无法安装科学软件的, 那么我们怎么才能科学上网呢这个时候就需要用旁路由来操作了.
1. 准备工作
1.1 双网口
将你的 nas 的两个网口的线都插入到路由器上面,这点很重要,也就是说如果你的 nas 是单网口的你就不用继续往下看了
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F3050d355-3d38-48ab-bd76-57f4607b16d9%2FUntitled.png?table=block&id=4065974d-2344-4dc5-b771-ffacc86a624c&t=4065974d-2344-4dc5-b771-ffacc86a624c&width=384&cache=v2)
1.2 安装 docker
到群晖商店安装 docker 就行了
1.3 开启 ssh
进入群晖控制面板开启 ssh,端口号自己随便填,但是自己得记住
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fde8a87d9-e681-4cb7-8a72-1ed31fe78740%2FUntitled.png?table=block&id=baa12c4c-8ba9-49ec-b23b-01d3b47206ce&t=baa12c4c-8ba9-49ec-b23b-01d3b47206ce&width=2136&cache=v2)
2. 安装 openwrt
2.1 进入ssh
下载 ssh 工具(点我下载), 我的 nas 的局域网 ip 是: 192.168.1.12
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F75bd4db9-ba7d-4654-b2f3-332550d9bea2%2FUntitled.png?table=block&id=0d130a74-588a-40d3-aa89-9ee162991655&t=0d130a74-588a-40d3-aa89-9ee162991655&width=2252&cache=v2)
2.2 查看网卡
使用命令
我的 nas 的 ip 是
192.168.1.12
,所以我看一下下面的哪个是匹配的,从下面图中可以看到网卡名字叫做 eth0
的是匹配的,如果你的 nas 使用了虚拟机可能会不一样,注意区分![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F4b6cd4e0-353d-40ce-aa04-b113e06dc3c2%2FUntitled.png?table=block&id=9f7d5676-59c6-495e-9969-cc8a933ca1db&t=9f7d5676-59c6-495e-9969-cc8a933ca1db&width=2252&cache=v2)
2.3 开启混杂模式
首先开启管理员模式
密码是你的nas的密码
接着使用命令
上面的
eth0
是我的网卡2.4 创建 docker macvlan 网络
注意上面的
192.168.1.1
是你的路由器,每个人的不一样
192.168.1.0/24
中的192.168.1
是你路由器192.168.1.1
的前三位
eth0
是你的网卡名字,上面已经说过了
使用上面的命令之后,在群晖的 docker 上便可以看到了
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F202f8319-e64e-43f2-8a8d-7d645e20e930%2FUntitled.png?table=block&id=5783d71f-9201-47c0-8bf6-1afe1f3c1ed1&t=5783d71f-9201-47c0-8bf6-1afe1f3c1ed1&width=2064&cache=v2)
可以看到上面的图中和我们填的一样的
2.5 拉取 OpenWrt 容器
2.6 启动 OpenWrt 容器
注意上面的
192.168.1.13
是我设定的旁路由的 ip ,自己到路由器查看一下有没有设备占用这个 ip ,如果有就改成一个其他的,比如 192.168.1.14
等等,具体看你的家庭路由器情况2.7 OpenWrt 容器设置
- 使用命令进入 openwrt 容器
- 修改配置
找到
config interface ‘lan’
下面的 option ipaddr
后面的ip ,修改成我上面修改的 192.168.1.13
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fac879923-9378-4eb3-8455-72d4115146ea%2FUntitled.png?table=block&id=8d077440-d4d7-4123-b4a5-20d45f227afc&t=8d077440-d4d7-4123-b4a5-20d45f227afc&width=2252&cache=v2)
- 重启服务
- 退出容器的ssh
到这里 openwrt 就安装好了, 可以在浏览器输入
192.168.1.13
就能进入容器了3. openwrt 设置
默认账号是 root ,开始的时候没有账号,进入后会提示你修改
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F34ee6d96-0c62-404d-a622-d6584e13fec6%2FUntitled.png?table=block&id=5ae875ad-d890-4d4f-8543-28b6f4109647&t=5ae875ad-d890-4d4f-8543-28b6f4109647&width=2338&cache=v2)
3.1 LAN 口修改
进入后,找到如下所示的地方,修改
LAN
口![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F682aba92-875d-4c5d-a0f6-ff7bb6af31a1%2FUntitled.png?table=block&id=40337fbd-2e00-4c5e-9757-25a35f78545b&t=40337fbd-2e00-4c5e-9757-25a35f78545b&width=2338&cache=v2)
修改如下
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fa176409d-2417-471d-a550-023960c727e9%2FUntitled.png?table=block&id=a6543be3-4f34-4cfb-a552-5be4283f93c9&t=a6543be3-4f34-4cfb-a552-5be4283f93c9&width=2338&cache=v2)
拉到下面选中这个忽略此接口,最后
保存&应用
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F593ff099-962b-4169-be61-940a9d8b255e%2FUntitled.png?table=block&id=01f0c4c6-7dc6-491f-86ac-511db9d4f85d&t=01f0c4c6-7dc6-491f-86ac-511db9d4f85d&width=2338&cache=v2)
3.2 防火墙设置
按照下面设置就行了
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F8bddfb76-d753-4864-8441-9f5f5afe366b%2FUntitled.png?table=block&id=a4da50fc-4227-46ad-adcc-9954d47a9c96&t=a4da50fc-4227-46ad-adcc-9954d47a9c96&width=2600&cache=v2)
3.3 安装 clash
到这里下载(点我),下载
clash-linux-amd64
的![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fa397bfcb-2849-4b5d-bccd-f2df54296710%2FUntitled.png?table=block&id=75f6562b-27c9-4e6e-b83f-1a2f61a99f0c&t=75f6562b-27c9-4e6e-b83f-1a2f61a99f0c&width=2632&cache=v2)
下载后解压,然后将名字改成
clash
,然后上传到 openwrt![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fdb863c61-4db6-42b9-ae61-cd7b870c85b6%2FUntitled.png?table=block&id=9dba7892-dee8-4ba0-9ce9-b55e8caa0a14&t=9dba7892-dee8-4ba0-9ce9-b55e8caa0a14&width=2516&cache=v2)
然后拉到下面会提示你安装,你安装就行了
3.4 clash 科学上网
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F706dc905-4b25-4fc8-92b2-42e52991a311%2FUntitled.png?table=block&id=6b163aab-b5b6-4702-bb66-7e38dacf3e0f&t=6b163aab-b5b6-4702-bb66-7e38dacf3e0f&width=2300&cache=v2)
然后更新使用配置就行了
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F1de7d7d3-5396-425b-a511-1dff3c6dc140%2FUntitled.png?table=block&id=6a2ff97c-9084-422f-9e41-b4fb56a08efc&t=6a2ff97c-9084-422f-9e41-b4fb56a08efc&width=2572&cache=v2)
最后启动 clash
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F3f1a982c-058f-4ddc-8f5b-f8b7cba002d8%2FUntitled.png?table=block&id=14055d16-0fa3-4f5f-8f92-b1f9008ebeec&t=14055d16-0fa3-4f5f-8f92-b1f9008ebeec&width=1978&cache=v2)
最后 clash 会自动帮你检测是否可以科学上网
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F88181ddc-7660-481e-bfad-6dc1d70c6206%2FUntitled.png?table=block&id=ce2b37a2-f481-4eb9-b11f-7abe82bcd939&t=ce2b37a2-f481-4eb9-b11f-7abe82bcd939&width=2574&cache=v2)
最后可以设置一下自动更新
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F03ebd75c-a8ca-4835-8601-945ff33a6827%2FUntitled.png?table=block&id=a4ac1de2-365d-43ec-a433-8b64a7efde4c&t=a4ac1de2-365d-43ec-a433-8b64a7efde4c&width=2198&cache=v2)
4. 客户端使用
这里拿 iPhone 手机举例子
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc1545d32-fa93-4c1d-a74f-ed7e803386b7%2FUntitled.png?table=block&id=7ea3eff1-fb3f-4440-b907-9e2d419adae2&t=7ea3eff1-fb3f-4440-b907-9e2d419adae2&width=288&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ff58109e3-546d-4970-b9c1-8cfb31d48280%2FUntitled.png?table=block&id=79935715-c1e5-4952-900a-86e3c2da223c&t=79935715-c1e5-4952-900a-86e3c2da223c&width=480&cache=v2)
5. 参考教程
- 作者:我心永恒
- 链接:https://wxyhgk.com/article/nas-synology-openwrt
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。