🛠 Configure BPI-RT2 as network gateway and light storage

Banana Pi BPI-RT2: AX3000 WiFi 6 Router Board · intermediaire · Transformez votre routeur WiFi 6 en serveur de fichiers et passerelle sécurisée grâce à ses ports USB et à OpenWrt.

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

Étapes

  1. 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.
  2. 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.
  3. Automatic Mounting: Edit /etc/fstab to mount the drive at startup. Add: /dev/sda1 /mnt/usb ext4 defaults 0 0. Mount manually to test: mount -a.
  4. Samba Installation: Update packages and install the file server: opkg update && opkg install samba4-server luci-app-samba4.
  5. 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.
  6. 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.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials