OpenWrt做简单的NAS

456次阅读
没有评论

硬件为极路由 B70,4 个天线,一个 USB3.0,一个 USB2.0。
硬件上,它与极路由 4 完全一致,代号 HC5962,唯一的区别是它多了两根天线。
在所有的软件上,它们两个都已 HC5962 为代号,不做区分。
他是 OpenWrt 官方支持的设备之一 https://openwrt.org/toh/hwdata/hiwifi_gee/hiwifi_gee_hc5962

配置

CPU: MediaTek MT7621AT
CPU Cores: 2
CPU MHz: 880
Flash MB: 128NAND
RAM MB: 256

硬盘盒

https://item.jd.com/51162249361.html

刷入 Breed

首先解锁原版系统的 ssh。
https://www.hiwifi.wtf/
这应该是前员工搞的秘钥生成器。
之后登录 ssh,刷不死 Breed

cd /tmp
wget https://breed.hackpascal.net/breed-mt7621-hiwifi-hc5962.bin
mtd -r write /tmp/breed-mt7621-hiwifi-hc5962.bin u-boot   

刷入 OpenWrt

https://openwrt.org/toh/hwdata/hiwifi_gee/hiwifi_gee_hc5962 下载 factory 固件。

断电,按住路由器的 rest 按键,上电,保持按住 10 秒。

这会让路由器进入 breed 恢复模式,通过有线 lan 口,打开 192.168.1.1,在网页上上传固件。

配置 OpenWrt 为 NAS

本地化

# 切换国内源
sed -i 's_downloads.openwrt.org_mirrors.tuna.tsinghua.edu.cn/openwrt_' /etc/opkg/distfeeds.conf
opkg update
# 切换中文
opkg install luci-i18n-base-zh-cn

挂载硬盘

# 挂载点功能
opkg install block-mount
# USB 驱动
opkg install   usbutils kmod-usb-core kmod-usb-ehci kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-usb-storage kmod-scsi-core kmod-fs-ext4

从网页上,系统 -> 挂载点处,可以配置自动挂载硬盘。

OpenWrt 做简单的 NAS

从网页上,服务 -> 硬盘休眠,配置硬盘自动休眠。

可以通过命令检测硬盘当前状态,以确定自动休眠生效。

# 查看硬盘状态
smartctl -d sat -n standby /dev/sda

网络共享 SMB

# 网络共享 smb
opkg install  ksmbd-server kmod-fs-ksmbd luci-app-ksmbd luci-i18n-ksmbd-zh-cn
# 硬盘自动休眠
opkg install luci-i18n-hd-idle-zh-cn

从网页上,服务 -> 网络共享,可以配置 SMB。

注意勾选强制 root,防止出现奇怪的权限问题。

允许用户并不是 linux 用户,而是独立的一套用户名密码,通过命令添加

ksmbd.adduser -a legend -p 12864

OpenWrt 做简单的 NAS

安装 Transmission

官方说明 https://openwrt.org/docs/guide-user/services/downloading_and_filesharing/transmission

opkg update
opkg install transmission-daemon
opkg install transmission-cli
opkg install transmission-web
opkg install transmission-remote
opkg install luci-app-transmission

# 下边的东西用来启动服务,只需要执行一次
uci set transmission.@transmission[0].enabled="1"
uci commit transmission
service transmission restart

从网页上,服务 -> Transmission,修改下载目录到刚才挂载的硬盘里,以 root 运行,并且配置文件也放在硬盘里。重启 一下路由器才会生效。

OpenWrt 做简单的 NAS

OpenWrt 做简单的 NAS

管理页面在 http://ip:9091/,不过不太好用,建议用 Transmission Remote 这个 APP

安装 Aria2

opkg install luci-i18n-aria2-zh-cn

在网页上添加附加配置, 用于伪装

peer-id-prefix=-TR2770-
user-agent=Transmission/2.77

其他常用软件

opkg install luci-i18n-frpc-zh-cn

正文完
 0
评论(没有评论)