🛠 Configure BPI-RT2 as network gateway and light storage
Objectifs
This tutorial aims to transform the Banana Pi BPI-RT2, initially designed as a WiFi 6 router, into a versatile network node integrating USB storage sharing and advanced network configuration. You will learn to leverage the USB 3.0 port to connect an external drive and configure file sharing (Samba) while maintaining WAN/LAN network security. This intermediate use case requires a basic understanding of Command Line Interfaces (CLI) and IP networking concepts.
Matériel nécessaire
- Banana Pi BPI-RT2 board
- 12V DC Power Supply (Barrel Jack)
- USB drive or external SSD formatted as ext4
- Ethernet cables (WAN and LAN)
- Computer with SSH access and web browser
Étapes
- System Access: Connect via SSH. The default address is often 192.168.1.1. Use
ssh root@192.168.1.1. The password is empty or 'password' depending on the OpenWrt 22.03 firmware version. - Storage Preparation: Insert your USB drive into the USB 3.0 port. Verify detection with
lsblk. Format if necessary (data warning):mkfs.ext4 /dev/sda1. Create a mount point:mkdir /mnt/usb. - Automatic Mounting: Edit
/etc/fstabto mount the drive at startup. Add:/dev/sda1 /mnt/usb ext4 defaults 0 0. Mount manually to test:mount -a. - Samba Installation: Update packages and install the file server:
opkg update && opkg install samba4-server luci-app-samba4. - Share Configuration: Access the LuCI interface (http://192.168.1.1). Go to Services > Samba. Create a new share named 'USBShare' pointing to
/mnt/usb. Enable guest access for simple local testing. - Network Security: In LuCI, navigate to Network > Firewall. Ensure the LAN zone is configured to accept incoming connections from LAN to Samba service (port 445). Block access from WAN.
Vérification
From a computer connected to the LAN, open the file explorer and type \\192.168.1.1. You should see the 'USBShare' folder. Copy a file to test writing. Check logs via logread | grep samba to confirm no authorization errors.
Pour aller plus loin
Explore adding a lightweight FTP or Nextcloud server on the BPI-RT2, keeping in mind the DDR3 RAM limits (256 MB). You can also configure a local DNS server (AdGuard Home) to block ads, leveraging the dual-core MIPS SoC for content filtering.