
Installing OpenWRT on your NAS can be a bit of a challenge, but it's a great way to breathe new life into an old device.
First, you'll need to download the OpenWRT firmware image and upload it to your NAS using a tool like TFTP.
With OpenWRT installed, you can start customizing your NAS to suit your needs.
One of the first things you'll want to do is configure the network settings, which can be done through the LuCI web interface.
You can then move on to installing packages and adding features, such as Samba for file sharing or SSH for remote access.
By following these steps, you can turn your NAS into a fully-fledged media server or file server.
Setup and Installation
To set up your OpenWrt NAS, you'll need to run the NAS setup script, which requires installing relevant packages to enable your router to function as a file server.
First, power down your NAS and connect it to the same network as your installation server. Make sure to note down the IP address of the installation server, as you'll need it later.
To serve the OpenWrt boot image, you'll need to download the necessary files, including the "openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-initramfs-uImage" file. You can use a TFTP server, such as the pghalliday/tftp server docker image, to serve the boot image.
Here's a list of the necessary files to download:
- openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-initramfs-uImage
- openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-squashfs-ubinized.bin
- openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-squashfs-sysupgrade.tar
Note that these files may be outdated, so be sure to check the OpenWrt wiki page for the current version.
Custom Build
If you're looking to convert your router into a home server or file server, you'll want to create a custom OpenWRT image. This is because router firmware is flashed to a read-only section, making it difficult to uninstall unwanted packages and recover the space they took up.
To build a custom image, you'll need to use the Image Builder, which can be downloaded from the same place as your router's firmware. Once you've downloaded the archive, unzip it and switch to the directory.
Using the Image Builder is a straightforward process. You'll need to create a custom image with the router profile and the packages you want to add or remove. To do this, run the command: `make image PROFILE="linksys_wrt1900ac-v1" FILES="files" DISABLED_SERVICES="dnsmasq odhcpd" PACKAGES="..."`. The PACKAGES parameter is where you can specify the packages you want to add or remove, separated by spaces.
Here's an interesting read: Openwrt Firmware

Some packages you can safely remove to save space include the DHCP server, odhcpd, and dnsmasq. You can also disable services like odhcpd and dnsmasq to free up space.
Here's a list of packages that can be safely removed to save space:
- dhcp server
- odhcpd
- dnsmasq
Keep in mind that devices with only 4MB flash may require a custom build image. The Image Builder can help you create a custom image that's tailored to your specific device and needs.
网口绑定
网口绑定 is a crucial step in setting up your device. You'll need to bind your device to a network port to establish a stable connection.
To do this, follow the instructions in the "网络设置" section, where you'll learn how to configure your device's network settings.
A static IP address is required for binding. You can find more information on setting a static IP address in the "IP地址设置" section.
Make sure to choose the correct network port to bind to, as specified in the "网络设置" section.
A reboot may be necessary after binding to ensure the changes take effect.
Format and Partition USB Drive
To format and partition your USB drive, you'll need to choose the right format depending on the device you're using. You can use the OpenWrt router, a machine running Linux, or even Windows to format the drive.
For an Ext4 partition, you can use OpenWrt or Linux to format the drive. You can also use a GUI-based partition manager like GParted Live.
You can use either a command-line interface or a GUI-based partition manager to create an Ext4 partition on the USB drive.
Here's an interesting read: Wd My Cloud 4tb Nas Drive
Flashing and Upgrading
Flashing OpenWrt onto your NAS device can be done in a few ways. The most straightforward method is to use the U-Boot Manual to enter magic commands into the bootloader.
To start OpenWrt, you'll need to interrupt the bootloader by pressing a key, then enter a few specific commands. This will load OpenWrt from memory, but it won't be stored on the device yet. You can test OpenWrt at this point if you want.

Once you've booted OpenWrt, you'll need to configure the network settings using a static IP address. This involves logging into the serial console and entering specific commands to set the IP address and subnet range.
After configuring the network, you can access the OpenWrt web interface by navigating to the IP address you used in the previous step. From there, you can navigate to the Backup/Flash-firmware area and select the file you downloaded earlier to start the flashing process.
The flashing process can take around 6 minutes, during which time you may see CRC-error messages on the serial console. Once the process is complete, the device will reboot, but it may forget its statically configured IP address, so you'll need to reconfigure it manually.
You can also use sysupgrade images to upgrade OpenWRT firmware from the Luci web interface. This method is specifically for devices already running OpenWrt. The sysupgrade images are available for various devices, including Planex and clones, Edimax, and Mvixusa.
Here's a list of devices that support sysupgrade images:
Build Custom Image

To build a custom OpenWRT image, you'll want to use the Image Builder. This is the easiest way to create a custom image for your router.
The first step is to download the Image Builder archive from the same place where you would download your router's firmware.
You'll then need to unzip the archive and switch to the directory. To do this, run the following command in your terminal: tar -J -x -f openwrt-imagebuilder-*.tar.xz cd openwrt-imagebuilder-*
Next, you'll need to create the custom image. This involves specifying the router profile and the packages you want to add or remove. You can get a list of available profiles by running make info. This will show you the profiles available for your router, such as the linksys_wrt1900ac-v1 profile.
To create the custom image, you'll need to run the following command: make image PROFILE="linksys_wrt1900ac-v1" FILES="files" DISABLED_SERVICES="dnsmasq odhcpd" PACKAGES="kmod-usb-storage kmod-fs-ext4 kmod-fs-ntfs kmod-usb-storage-uas kmod-fs-exfat kmod-fs-f2fs kmod-fs-vfat ntfs-3g ntfs-3g-utils block-mount e2fsprogs f2fs-tools dosfstools libblkid fdisk gdisk mount-utils usbutils lsblk blkid jq sudo shadow-useradd shadow-groupadd shadow-groups shadow-usermod luci luci-app-samba4 luci-app-hd-idle kmod-usb3 acme python3 git libupm-nrf24l01-python3 -wpad-mesh-wolfssl -odhcpd -ppp -ppp-mod-pppoe -odhcpd-ipv6only"
Note: The PACKAGES variable in the above command lists the packages you want to add or remove.
Broaden your view: Setup Openwrt Luci Https through Command Line
Flashing
Flashing OpenWrt can be a bit tricky, but with the right steps, you'll be up and running in no time.
To start, you'll need to interrupt the bootloader by pressing a key during the test-boot process. This will allow you to enter a few magic commands to start OpenWrt.
Make sure your TFTP server is running and connected to the same network as the NAS. Now, enter the following commands into the bootloader: `tftp 192.168.0.10; tftp 192.168.0.10; setenv bootdelay 0; setenv bootcmd 'tftp 192.168.0.10; bootd 0x80000000'; saveenv; reset` This will start OpenWrt from memory, and you can test it out before flashing it to the device.
To configure the network, go to your serial console and set a static IP address with the following commands: `uci set network.lan.ipaddr='192.168.0.13'; uci set network.lan.netmask='255.255.255.0'; uci set network.lan.gateway='192.168.0.1'; uci commit network` This will allow you to connect to the OpenWrt web interface.
Once you've logged in to the web interface, navigate to the Backup/Flash-firmware area and click the "Flash image..." button. Select the file "openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-squashfs-sysupgrade.tar" and click continue to start the flashing process.
Here are the supported devices for flashing OpenWrt:
Note that flashing OpenWrt will irrecoverably wipe the old installed Zyxel operating system of the NAS.
Installation Server and Interface
To set up an installation server for your OpenWrt NAS, you'll need a network connection to serve the boot image during the first boot. A tftp server is required for this, and you can use a tool like docker to run it without installing new software.
The OpenWrt images you'll need to download are: openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-initramfs-uImage, openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-squashfs-ubinized.bin, and openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-squashfs-sysupgrade.tar. However, only the openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-initramfs-uImage file is immediately required.
Make a copy of the required file and rename it to "initramfs". Then, start the TFTP server using the pghalliday/tftp server docker image. The installation server IP address will be used to connect to the NAS, so make sure to note it down. In my case, the server IP was 192.168.0.10.
Folders and Files
Let's take a look at the folders and files on our installation server. We have a total of 37 commits, which is a good indication of how much work has gone into setting up this server.
The server has a few folders and files, including a LICENSE file, a README.md file, and some shell scripts like enable_drive_idle.sh and initial_setup.sh.
Here's a list of the folders and files on our server:
You can also access your network drive using a file manager like EX File Manager, which supports network folders.
Installation Server
To set up an installation server, you'll need a network connection to serve the boot image of OpenWrt during the first boot. I used the same machine I controlled the boot from, which made things convenient.
A tftp server is required to serve the OpenWrt bootimage. I regularly use docker for my professional work, so running a tftp server on my machine using docker was the easiest way to do this without installing new software.
You'll need to download the OpenWrt images for booting the first time. The required images are: openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-initramfs-uImage, openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-squashfs-ubinized.bin, and openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-squashfs-sysupgrade.tar. However, only the "openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-initramfs-uImage" seemed to be required immediately.
Make a copy of the "openwrt-19.07.4-oxnas-ox820-mitrastar_stg-212-initramfs-uImage" file and rename it to "initramfs". Then, start the TFTP server using the pghalliday/tftp server docker image.
To start the TFTP server, use the command: docker run -it --rm -v ${PWD}:/data -w /data pghalliday/tftp -p 69:69/udp -l /data/initramfs.
Interface Circuit

An interface circuit is essentially a connection point between the server and the outside world, enabling data exchange and communication.
This circuit typically consists of a combination of hardware and software components, such as a motherboard, CPU, and network interface card.
A well-designed interface circuit is crucial for efficient data transfer and communication between the server and other devices.
It's often implemented using a standardized protocol, such as Ethernet or Wi-Fi, to facilitate seamless communication.
The interface circuit also plays a critical role in ensuring data integrity and security, protecting against unauthorized access and data breaches.
In some cases, an interface circuit may also include additional features, such as power management and fan control, to regulate the server's temperature and power consumption.
The interface circuit's design and configuration can significantly impact the server's overall performance and reliability.
By understanding the intricacies of the interface circuit, you can optimize your server's setup for maximum efficiency and effectiveness.
Expand your knowledge: Openwrt Interface
硬盘分区
硬盘分区是将硬盘空间分割成多个独立的区域,这样可以更好地管理和利用硬盘空间。
1KB等于1024个字节,一个扇区是512个字节,所以1KB需要两个扇区。
30G硬盘空间可以计算成30*1024*1024*2扇区。
起始扇区系统默认,所以中止扇区是起始扇区加上2089984,这样就可以得到中止扇区的值。
例如,30G硬盘空间的起始扇区是0,中止扇区是62914560+2089984=65004544。
分区格式选ext4,兼容性会好一点。
分区好后是立刻生效的,可以马上在系统中看到。
Plugin and Package Management
To set up your OpenWRT NAS, you'll need to install the necessary packages. This includes kernel filesystem packages for NTFS, ext4, and other filesystems, as well as kernel drivers for USB storage and USB3.0.
To install the packages, you'll need to run a script that includes the following packages: kernel filesystem packages, kernel drivers, Samba4 Server + LuCI interface, utilities like fdisk and block-mount, and other relevant packages such as acme and python3.
Here are the packages you'll need to install for mounting drives: block-mount, kmod-usb-storage, and kernel modules and utilities for the filesystems you want to use.
Script
Scripting is a crucial part of plugin and package management in OpenWRT. It allows you to automate tasks and install necessary packages for your NAS setup.
To install relevant packages, you'll need to run a script that includes kernel filesystem packages, kernel drivers, Samba4 Server, LuCI interface, and utilities like fdisk and block-mount. You can also include other packages you frequently use, such as acme and python3.
On a similar theme: Openwrt Install Tailscale
The script to install these packages is provided in the article, and it's essential to run it to set up your NAS correctly. I've found that using a script like this saves time and reduces the risk of human error.
Here's a list of the packages you'll need to install:
- Kernel filesystem packages (e.g., NTFS, ext4)
- Kernel drivers (e.g., USB storage, USB3.0)
- Samba4 Server
- LuCI interface
- Utilities (e.g., fdisk, block-mount)
- Other relevant packages (e.g., acme, python3)
Remember, these scripts assume you have OpenWRT installed and uninitialized, so make sure to reset your router before running the script.
Plugin Installation
To install plugins on your OpenWrt device, you'll need to access the terminal or SSH. This will allow you to run the necessary commands to install the required packages.
To install the relevant packages, including kernel filesystem packages, kernel drivers, Samba4 Server, and utilities, you'll need to run a script. This script will install packages such as kernel filesystem packages for NTFS, ext4, etc., kernel drivers for USB storage, USB3.0, etc., and utilities like fdisk, block-mount, etc.
Some essential packages to install include block-mount, which provides an interface for mounting the drives, and kmod-usb-storage, which provides the kernel modules to detect USB storage devices.

Here's a list of some of the packages you may need to install:
- Kernel filesystem packages for NTFS, ext4, etc.
- Kernel drivers for USB storage, USB3.0, etc.
- Samba4 Server + LuCI interface
- Utilities like fdisk, block-mount, etc.
- Other relevant packages, such as acme and python3.
In some cases, you may also need to install kernel modules and utilities for the specific filesystems you want to use, such as Ext4, exFAT, or NTFS.
To install these packages, you can use the opkg install command, specifying the package name, such as opkg install kmod-usb2 kmod-usb-storage-uas usbutils block-mount mount-utils luci-app-hd-idle.
Docker 扩容
Docker 支持两种扩容方式:水平扩容和垂直扩容。
水平扩容通过增加容器的数量来提高应用程序的吞吐量,而垂直扩容则通过增加容器的资源配置来提高应用程序的性能。
Sharing and Access
You can set up a network share on OpenWrt using a USB drive, making it accessible from other devices on the network. To do this, go to System → Mount Points and enable the USB drive's mount point.
The network share can be accessed by typing \\192.168.1.1 into the address bar of Windows File Explorer. Replace the IP address with your OpenWrt router's IP address.
To access the network drive, you'll need to provide the username and password you set up in Step 2 of the Samba user setup process. This ensures secure access to the network share.
Check this out: Backup Nas Drive to Cloud
Sharing
Sharing your files and folders with others can be a bit tricky, but don't worry, I've got you covered. To start, you'll need to set up a network share on your OpenWrt device. This can be done by going to System → Network Share and clicking on the "Edit Template" button, where you'll find a template code to fill in.
One of the most important settings is the "netbios name" which should be a unique name for your network share. You can also set the "interfaces" to the network interface you want to use, such as "br-lan". The "server string" is a description of your server, and the "workgroup" is the name of your network group.
To add a shared directory, you can use the [SSD] section in the template code. Here, you can set the "path" to the directory you want to share, and the "valid users" to the users who can access it. You can also set the "writable" option to yes if you want users to be able to write to the directory.
Once you've set up your network share, you'll need to restart the Samba server by running the command "service samba4 restart". This will make your shared directory available to others on your network.
To access your network share from a Windows device, you can use the Windows File Explorer and type the IP address of your OpenWrt device followed by a backslash, like this: \\192.168.1.1. When prompted for a username and password, use the credentials you set up in Step 2.
If you're using a 3rd party file manager like EX File Manager, you can access your network drive by connecting to your router's network and looking for the network drive under LAN. Simply click on it and login using the credentials you set up earlier.
Here's a quick summary of the settings you'll need to change to set up a network share on OpenWrt:
Aliyun Mount Webdev
Aliyun Mount Webdev allows you to mount your WebDev environment to an Aliyun ECS instance. This enables you to access your WebDev environment from an ECS instance.
Troubleshooting and Security
OpenWRT NAS devices are generally secure, but like any network device, they can be vulnerable to hacking if not properly configured.
To ensure the security of your OpenWRT NAS, it's essential to use a strong password and enable SSH keys for secure access.
Regular software updates are also crucial to keep your NAS device secure, as they often include patches for newly discovered vulnerabilities.
A good rule of thumb is to reboot your NAS device regularly to ensure all software and firmware updates take effect.
Troubleshooting
If you're experiencing issues with writing files, it's likely due to a permission error.
Proper permissions haven't been applied, which is a common problem when using network shares. To fix this, you need to login to SSH as root.
Type chmod -R 777 /mnt/sda1 and press Enter, replacing /mnt/sda1 with your network share directory or partition. This command will apply the necessary permissions to your files.
If you're not sure what your network share directory or partition is, don't worry. You can always check your system settings or ask your IT department for help.
Here are the steps to follow:
- Login to SSH as root.
- Type chmod -R 777 /mnt/sda1 and press Enter, replacing /mnt/sda1 with your network share directory or partition.
By following these steps, you should be able to resolve any permission errors and start writing files without issues.
Setup User Security
Setting up user security is a crucial step in securing your Samba network share. You should never use the root user to access the network share, as it's not recommended for security reasons.
To create a non-root user, you'll need to edit the /etc/passwd file. This can be done by installing the nano text editor using the command `opkg install nano`.
You'll then need to open the /etc/passwd file in nano by typing `nano /etc/passwd` and pressing Enter. Go to the last line and type in the new user's information, replacing `noob404` with your preferred username.
If you need to change the user ID, make sure to check if it's already in use. If it is, you can use the next available number.
Once you've added the new user, press Ctrl + S to save the changes and Ctrl + X to exit the nano editor.
You'll also need to add the new user to the /etc/group file. Open this file in nano by typing `nano /etc/group` and pressing Enter. Go to the last line and type in the new user's information, replacing `noob404` with your preferred username.
Check this out: Upgrade Openwrt from Command Line
Make sure to replace the user ID if you made any changes in the previous step. When you're done, press Ctrl + S to save the changes and Ctrl + X to exit the nano editor.
Finally, you'll need to set up a password for the new user. Type `smbpasswd -a noob404` (replacing `noob404` with your username), press Enter, and then enter a secure password. Confirm the password by entering it again and pressing Enter.
Requirements and Preparation
To set up an OpenWrt NAS, you'll need a device running OpenWrt with a USB or memory card port. This is a crucial requirement, as it will allow you to connect external storage devices.
You'll also need SSH or terminal access to your OpenWrt device, which will give you the ability to configure and manage your NAS.
To ensure you have the necessary tools, make sure you have the following packages installed: block-mount, kmod-usb-storage, and kernel modules and utilities for the filesystems you want to use.
Here's a quick rundown of the required packages:
- block-mount: provides an interface for mounting the drives
- kmod-usb-storage: provides the kernel modules to be able to detect USB storage devices
- Kernel modules and utilities for the filesystems you want to use
Requirements

To start with, you'll need a device that can run OpenWrt with a USB or memory card port. This is a crucial requirement.
You'll also need SSH or terminal access to the OpenWrt device. This will allow you to interact with the device and make any necessary changes.
If you want to use a USB drive or memory card, you'll need to have one available. Not all devices support these types of storage, so make sure to check your device's specifications.
To re-partition your USB drive or memory card, it's highly recommended that you use GParted Live. You can download it from here.
Check this out: Wd My Cloud Ex2 Ultra Nas Drive
Install Dependencies
To install the dependencies, you'll need to ensure you have the required packages installed. Make sure you have block-mount installed, as it provides an interface for mounting the drives.
You'll also need kmod-usb-storage, which provides the kernel modules to detect USB storage devices. This is a crucial package to have.
Related reading: Openwrt 安装 Usb 无线网卡

Some other packages you'll need include Kernel filesystem packages for the filesystems you want to use, such as NTFS or ext4. You'll also need kernel drivers for USB storage and USB3.0.
To install these packages, you can run a script or type the necessary commands in the terminal. For example, you can type opkg update and press Enter.
Here are the specific packages you'll need to install:
- kmod-usb-storage: provides the kernel modules to detect USB storage devices
- block-mount: provides an interface for mounting the drives
- Kernel filesystem packages for the filesystems you want to use, such as NTFS or ext4
- Kernel drivers for USB storage and USB3.0
- Utilities like fdisk and mount-utils
You can install these packages using the opkg install command, or by running a script that includes the necessary commands.
First Boot and Usage
Once you've connected the Medion header to your computer, it's time to try it out for the first time.
Connect the power supply to the mainboard and switch it on. Try to interrupt the bootloader by pressing a key during the boot. If everything works, you should see the Medion header's screen displaying its output.
You'll need to install the relevant packages to enable the router to be a file server, which is a crucial step in setting up your openWRT NAS.
Connect to the serial terminal using the 'screen' program and the serial connection available on /dev/ttyUSB0. This will allow you to see the bootloader's output and ensure everything is working as expected.
Frequently Asked Questions
What are the disadvantages of OpenWRT?
OpenWRT has a high configuration complexity and requires technical knowledge to use effectively. Additionally, incorrect installation can result in device failure and there is no graphical interface by default.
What is the point of OpenWRT?
OpenWRT is an open-source operating system designed to provide customizable and feature-rich firmware for embedded devices like routers and network equipment. Its main goal is to give users more control and flexibility over their network devices.
Featured Images: pexels.com


