☕ Buy a Coffee
Home / System Engineering

How to Install OpenWrt on Ubiquiti EdgeRouter X (ER-X & ER-X-SFP)

Unlock WireGuard, LuCI, and modern SQM on the $59 Ubiquiti EdgeRouter X: EdgeOS kernel transition, MT7621 hardware NAT offloading, and dual-boot recovery.

Sachin Siju
Sachin Siju
Lead Systems Engineer & Tech Blogger
Aug 18, 2026 6 min read
How to Install OpenWrt on Ubiquiti EdgeRouter X (ER-X & ER-X-SFP)

Why Bother Replacing EdgeOS

The Ubiquiti EdgeRouter X (ER-X) and its SFP-equipped sibling (ER-X-SFP) are absurdly capable for their price: a MediaTek MT7621A dual-core MIPS SoC clocked at 880MHz, five Gigabit Ethernet ports, and enough throughput to route at close to line rate for a typical home or small-office WAN link. EdgeOS, the Vyatta-derived firmware Ubiquiti ships on it, is stable but stuck in time — no WireGuard, no modern Smart Queue Management (SQM/cake) for fighting bufferbloat, and a configuration model that feels like it was frozen around 2015. OpenWrt gives you a current Linux kernel, a full package repository, a proper web UI (LuCI), and first-class WireGuard support, all on hardware you probably already own.

This is not a five-minute job. You are replacing the bootloader-adjacent firmware on a router that has no reset-to-factory-EdgeOS button once you're deep into the process, so read the whole guide before you start, and keep a second device (phone hotspot, old router) around in case you need internet access mid-recovery.

Read this first: The ER-X and ER-X-SFP are different hardware targets in OpenWrt's device tree despite looking almost identical. Flashing the wrong image can leave the device unbootable. Always download the image from the exact device page matching your model, and check the board label on the underside of the unit if you're unsure which one you have.

What You'll Need

  • An ER-X or ER-X-SFP with EdgeOS still on it (any recent EdgeOS version works)
  • An Ethernet cable and a PC with a wired NIC — Wi-Fi will not work for this
  • A TFTP client (Windows: tftp is built in but disabled by default; Tftpd64/Tftpd32 is easier. macOS/Linux: the tftp command)
  • The current OpenWrt firmware for your exact model from the official OpenWrt downloads page — the device target is ramips/mt7621, and you need both the initramfs-kernel image (for the first boot over TFTP) and the sysupgrade image (for the permanent install)
  • A backed-up copy of your EdgeOS config, just in case you need to reference port assignments or VLAN IDs later

Step 1: Back Up and Note Your Current Config

Before touching anything, SSH into the router and export the config in case you want to reference it while rebuilding your setup in OpenWrt (the two systems don't share a config format, so this is for reference, not restore):

show configuration commands > /tmp/edgeos-backup.conf
scp /tmp/edgeos-backup.conf user@yourpc:~/edgeos-backup.conf

Write down anything you'll need to recreate: VLAN IDs, static DHCP reservations, port forwards, and the WAN connection type (DHCP, PPPoE, static).

Step 2: Enter TFTP Recovery Mode

The ER-X's U-Boot bootloader has a built-in TFTP recovery mode that lets you push a new kernel image directly, bypassing EdgeOS entirely.

  1. Set your PC's Ethernet adapter to a static IP of 192.168.1.2 with subnet mask 255.255.255.0, and connect it directly to the router's eth0 port (labeled port 0 or the leftmost RJ45 port).
  2. Power off the router completely.
  3. Press and hold the reset button, then apply power while continuing to hold reset.
  4. Keep holding reset for roughly 15-20 seconds. Watch the port LEDs — when the bootloader enters TFTP recovery mode, the LEDs will start blinking in a steady synchronized pattern instead of their normal link/activity flicker. Release the button at that point.
  5. The router is now listening for a TFTP put on 192.168.1.1.

Step 3: Push the Initramfs Image

Rename the downloaded OpenWrt initramfs image to a short, simple filename to avoid any client-side path quirks, then push it:

tftp -i 192.168.1.1 PUT openwrt-initramfs.bin

The transfer typically finishes in a few seconds over Gigabit. Once it completes, the router boots the image directly into RAM — nothing is written to flash yet. Give it 30-60 seconds, then check whether it's reachable:

ping 192.168.1.1

If it responds, SSH in (no password is set at this point):

ssh root@192.168.1.1

You're now running OpenWrt entirely from RAM. This is your safety net: if anything looks wrong (wrong image, missing ports, kernel panic on boot), just power-cycle the router and you're back to unmodified EdgeOS on flash, because nothing has been written yet.

Step 4: Write OpenWrt to Flash

Once you've confirmed the initramfs image is the correct one for your hardware, copy the sysupgrade image to the router and commit it to flash:

scp openwrt-sysupgrade.bin root@192.168.1.1:/tmp/
ssh root@192.168.1.1
sysupgrade -n /tmp/openwrt-sysupgrade.bin

The -n flag skips trying to preserve settings from the currently-running (RAM-only) instance, giving you a clean default configuration to start from. The router will reboot automatically once the flash write finishes — don't power-cycle it manually during this step.

Step 5: First Boot and LuCI Setup

After reboot, OpenWrt comes up with its default LAN address of 192.168.1.1 and DHCP enabled on the LAN-side ports. Connect and browse to http://192.168.1.1 to reach LuCI, or SSH in directly. Set a root password immediately under System > Administration — an unset root password on OpenWrt allows only local login, but you should lock it down before exposing any services.

Enable Software Flow Offloading

The MT7621's proprietary hardware NAT acceleration that EdgeOS uses isn't available under mainline OpenWrt for this target, so throughput at gigabit line rate depends on software offloading instead. Turn it on under Network > Firewall > General Settings: enable Software Flow Offloading (and hardware offloading only if your build explicitly supports it for this SoC — check the release notes for your firmware build first). This alone gets routed throughput close to wire speed for typical WAN links.

Install WireGuard and SQM

opkg update
opkg install wireguard-tools luci-proto-wireguard luci-app-sqm

WireGuard interfaces are then configured under Network > Interfaces > Add New Interface, and cake-based SQM is under Network > SQM QoS — point it at your WAN interface and set the up/down rates to roughly 95% of your measured link speed to keep bufferbloat under control.

Recovery: Getting Back to TFTP Mode If Something Breaks

Because you flashed via the TFTP recovery mode rather than EdgeOS's own dual-boot image slots, there's no built-in "revert to EdgeOS" menu once OpenWrt is on flash. If you brick the config (not the hardware — a bad network config, not a bad flash) you can always re-enter the same TFTP recovery mode described in Step 2 and push either the OpenWrt initramfs image again or, if you saved it beforehand, Ubiquiti's official EdgeOS recovery image to go back to stock firmware.

Tip: Download and keep a copy of the stock EdgeOS firmware image for your exact hardware revision before you start. It's your fallback path if OpenWrt doesn't fit your needs after all, and TFTP recovery mode accepts it exactly the same way it accepts the OpenWrt image.

Wrapping Up

Once it's running, the ER-X under OpenWrt behaves like any other supported router: full opkg package access, LuCI for day-to-day admin, and mainline kernel networking features EdgeOS never got. It's a five-port gigabit router with real WireGuard support and modern bufferbloat control for the price of a nice lunch — just respect the flashing process and keep a recovery path handy.

Featured Infrastructure Partner

Deploy on High-Performance Hostinger Cloud

Get up to 75% OFF + free domain & SSL. Powering xube.me's sub-second response times.

Claim Discount ↗

Discussion & Insights

Related Technical Essays