Skip to content
Contents
GuidesOpenWrt
Editorial verified

How to install or recover OpenWrt over TFTP from macOS

On a Mac, an interface named en7 might be a USB Ethernet adapter; the number varies. Identify the wired port before uploading in binary mode or serving the recovery directory.

Find the en interface with the cable attached

  1. Match the device label to its documentation. Record the hardware revision, computer's static IP, bootloader IP, Ethernet port, recovery LED, accepted image and remote filename. Some models accept only a manufacturer's recovery package. Others use TFTP to boot a temporary system. Check the steps that follow the transfer for your model. Identify your hardware · Choose and verify firmware
  2. Connect the built-in Ethernet port or a USB Ethernet adapter. Run networksetup -listallhardwareports in Terminal. Find the wired adapter and note its Device name, for example en7. The Mac's Wi-Fi interface can also have a name starting with en.
  3. Open System Settings → Network → your Ethernet service → Details → TCP/IP. Record the current settings, choose Manually for IPv4 and enter the documented computer address and subnet mask. Connect to the specified router port. Check the address with ipconfig getifaddr en7, replacing en7 with the actual interface. Temporarily disconnect Wi-Fi or a VPN if it uses the same subnet. Apple's TCP/IP settings guide

Create openwrt-recovery in Downloads. Put a copy of the selected image there and name it firmware.bin for a local name without spaces. Both procedures below start in this directory. Compare the second command's output with the SHA-256 published for the original image. Renaming the copy does not change its format.

cd ~/Downloads/openwrt-recovery
shasum -a 256 ./firmware.bin

Use the Mac's TFTP client when the router waits for an upload

If the device instructions say to put the image to the bootloader, check the client with command -v tftp. Run tftp, then enter the commands below at the tftp> prompt. Replace ROUTER_IP with the bootloader address and REMOTE_NAME with the required receiving filename. If the guide explicitly permits any name, the second filename is optional. WNDR3700 upload example

binary
connect ROUTER_IP
put firmware.bin REMOTE_NAME
quit

You can enter the first two lines in advance. The connect command records the destination without probing the router. Trigger recovery as documented and issue put when the LED or upload window appears. Wait for the transfer result, then enter quit. For a timeout, check the destination, physical port and timing.

Start a read-only server when the router fetches the file

If the computer must run a TFTP server, dnsmasq provides a read-only one. These instructions assume Homebrew is installed. Run brew install dnsmasq while the Mac still has internet access, then connect the isolated Ethernet link. Run the service once in the foreground. Homebrew dnsmasq formula · dnsmasq options

In the firmware directory, replace en7 with the actual wired interface and DEVICE_REQUESTED_FILENAME with the exact filename requested by the bootloader, without a directory path. One example for the Archer C7 v2 is ArcherC7v2_tp_recovery.bin. Archer C7 device page

wired_if=en7
recovery_name='DEVICE_REQUESTED_FILENAME'
tftp_root=$(mktemp -d /private/tmp/openwrt-tftp.XXXXXX)
chmod 755 "$tftp_root"
cp ./firmware.bin "$tftp_root/$recovery_name"
chmod 644 "$tftp_root/$recovery_name"
sudo "$(brew --prefix dnsmasq)/sbin/dnsmasq" \
  --keep-in-foreground --conf-file=/dev/null --port=0 \
  --bind-interfaces --interface="$wired_if" --enable-tftp="$wired_if" \
  --tftp-root="$tftp_root" --log-facility=-

Keep the terminal open and trigger recovery. This command disables DNS, configures no DHCP service and serves TFTP on the selected interface only. If the port is already in use, identify the existing TFTP service first. For a missing file, check the requested name and directory. After the log reports the file sent, keep power connected and wait for the model's flash and reboot indications.

Finish recovery

Press Control-C to stop dnsmasq if you ran it. Restore the Ethernet settings and renew the DHCP lease if that was the original setup. Verify the model and release at the new system's management address. If TFTP booted the system into RAM, finish the device-specific installation and check the release again after a normal reboot. Read a TFTP recovery log

Explore hardware

Devices mentioned

Comments