Network & Cyber DefenseEngineer

Raspberry Pi Router and Firewall with OpenWrt

Turn a Pi into a powerful router with VLANs, ad blocking and VPN — between your modem and your network.

LevelEngineer
Time2 h
Est. cost~$140
Steps5

OpenWrt is the open-source router operating system used by enthusiasts and many commercial routers. On a Pi 5 with a second Ethernet adapter it routes at gigabit speeds.

Video tutorial

Video by Royalsoft, embedded from YouTube. The written steps below are our own and match the parts list.

Mission steps

  1. Download OpenWrt

    Get the image for your Pi model from the OpenWrt firmware selector and flash it with Imager (Use custom).

  2. First login

    Connect your laptop to the Pi's built-in Ethernet and open 192.168.1.1 (LuCI web interface). Set a root password immediately.

  3. Add the WAN port

    Install the USB Ethernet driver package for your adapter and assign it as WAN, connected to your modem.

  4. Connect Wi-Fi

    Plug your existing router in 'access point' mode into the LAN side, or use a dedicated access point.

  5. Harden and extend

    Keep default-deny inbound rules, add a guest/IoT network, install adblock or WireGuard packages.

Questions

Will this replace my ISP modem?

No — it replaces the router behind the modem. Put your ISP device in bridge mode if possible to avoid double NAT.