Post

Build a Raspberry Pi Based DIY Router and Wi-Fi AP

Step-by-step guide to setting up OpenWrt on a Raspberry Pi, installing LuCI, and configuring custom USB Wi-Fi adapters for a powerful DIY router.

Build a Raspberry Pi Based DIY Router and Wi-Fi AP

Setting up OpenWrt on a Raspberry Pi allows for a flexible, configurable DIY router or wireless access point. This guide covers installing OpenWrt, configuring LuCI, and adding USB Wi-Fi adapters.

Requirements

  • Raspberry Pi: Pi 4 or newer recommended for better performance.
  • MicroSD Card: At least 8GB.
  • USB Wi-Fi Adapter: Must be compatible with OpenWrt (e.g., Ralink RT5572, MediaTek MT7612U).
  • Ethernet Cable: Required for initial setup.
  • Power Supply: 5V/3A recommended.

Installing OpenWrt

  1. Download OpenWrt: Visit the OpenWrt Firmware Selector and download the correct image for your Raspberry Pi model (e.g., bcm27xx/bcm2711 for Pi 4).
  2. Flash the Image to a MicroSD Card:
  3. Boot OpenWrt: Insert the MicroSD card, connect the Raspberry Pi to your network via Ethernet, and power it on.

Accessing LuCI

  1. Connect a computer to the Raspberry Pi via Ethernet.
  2. Open a browser and go to http://192.168.1.1.
  3. Login with:
    • Username: root
    • No default password (set one immediately).

Configuring OpenWrt

Setting Up Network Interfaces

  1. In LuCI, navigate to Network > Interfaces.
  2. Configure the LAN interface:
    • Set a static IP if needed.
    • Assign DHCP settings if acting as a router.
  3. Save and apply changes.

Enabling Wi-Fi

  1. Go to Network > Wireless.
  2. If the internal Wi-Fi adapter is listed, enable it. Otherwise, follow the next section to set up a USB adapter.

Adding a USB Wi-Fi Adapter

  1. Check for Adapter Recognition:
    • SSH into OpenWrt or use the system log in LuCI.
    • Run lsusb to confirm detection.
  2. Install Necessary Drivers (via LuCI):
    • Go to System > Software.
    • Click Update lists.
    • Search for and install drivers based on chipset:
      • Ralink RT5572: Install kmod-rt2800-usb.
      • MediaTek MT7612U: Install kmod-mt76x2u.
  3. Configure Wi-Fi:
    • Go to Network > Wireless.
    • Click Add to configure a new Wi-Fi network.
    • Set SSID, encryption (WPA2/WPA3 recommended), and password.
    • Assign the network to LAN or another firewall zone.
  4. Save and apply changes.

Final Steps

  • Set up a firewall under Network > Firewall.
  • Enable remote SSH/Web access under System > Administration.
  • If using this setup as a router, configure DHCP and DNS under Network > DHCP and DNS.

Your Raspberry Pi is now a fully functional OpenWrt-powered router.

This post is licensed under CC BY 4.0 by the author.