NAS (Network Attached Storage)
Using OpenWrt for NAS usually involves a device with a single ethernet port and some kind of mass storage.
Disable Unused Services
After Basic configuration of your device, as a typical NAS user, you may need to configure your device to obtain an IP number from some other router and then just sit there and be a NAS. This is similar to how we configure a dumb AP using managed services.
Do the following from the command line as root to disable unnecessary services (an alternative is of course to build the image without these components by removing them during menuconfig):
- Disable dnsmasq
service dnsmasq disable service dnsmasq stop
- Disable odhcpd
service odhcpd disable service odhcpd stop
- Disable firewall (unless you feel it's a good idea to protect your NAS from the local network)
service firewall disable service firewall stop
- Edit
/etc/config/systemto reflect your timezone, or all timestamps will be in UTC. This matters for NAS storage. For example I set:option timezone 'CET-1CEST,M3.5.0,M10.5.0/3'
- Set up NTP servers that your device will obtain time from. If you are using another instance of OpenWrt as your router it can easily be used for providing NTP inside your own network, for example.
- Type poweroff to shut down the system.
- Plug it into some ethernet port on your LAN that will provide DHCP for devices, and it should happily connect to that network and come up. You need to figure out the IP address but usually you can check what devices have appeared on your network in your main DHCP server/router.
Enable Desired Services
You will probably want to install some services for managing your as an OpenWrt NAS. This would be a typical set of packages:
opkg update opkg install luci ksmbd-server luci-app-ksmbd kmod-usb-storage block-mount e2fsprogs
This will enable the LuCI web UI, the ksmbd file server and the ''block'' tool for block storage on USB as well as the necessary packages for handling USB mass storage.
Prepare Storage
If you have an empty disk attached to your NAS, partition this free space like this:
- Log in to NAS or use the console if you have one.
fdisk /dev/sda(NOTICEfdiskcan only handle up to 2GB disks, for larger storage you need a GPT partition table, then usegdiskinstead)- press n, p ENTER, ENTER, ENTER, ENTER, w to create
/dev/sda1 mkfs.ext4 /dev/sda1- Use the ''block'' tool to set up the
/dev/sda1partion for mounting:block detect | uci import fstab uci set fstab.@mount[0].enabled='1' uci commit fstab
- You can verify that we set up
/dev/sda1for mounting withcat /etc/config/fstab - Reboot
- When the device comes up
dfshould show you/dev/sda1mounted as/mnt/sda1
Documentation
User guide
Additional services
NAS (Network Attached Storage)
- AFP Netatalk share configuration (Apple Time Machine)
- CIFS Client
- FTP servers
- iSCSI
- ksmbd
- Network File System (NFS)
- NFS client
- NFS share configuration
- ownCloud or NextCloud
- RemoteFS Client
- RemoteFS Server
- Samba
- Samba 3 (old version)
- Samba Advanced Settings
- SFTP server
- Share USB hard-drive with Samba using LuCI
- WebDAV Share