Installing OpenWrt with TFTP from a Linux computer

This guide is targeted towards relative beginners that have a Linux device.

This simple guide for flashing via TFTP requires you have the following tools:

Computer: Most Linux desktop or laptop computers with an ethernet port (or can use a USB to Ethernet adapter)
Router: Any router or device which can be installed using TFTP ( TFTP Installation Setup)
Knowledge: Minimal knowledge of how to open and run commands in a terminal

You will also want to collect the following information:

* What is your distribution based on?

  • X/L/K/Ubuntu, ElementaryOS, Kali, Finnix: Debian (you use the `apt` and `apt-get` command to install packages)
  • Fedora/CentOS/Red Hat: Red Hat (you use the `yum` command to install packages)
  • Manjaro, Arch: Arch Linux (you use the `pacman` command to install commands)

* What is your ethernet port's device name?

  • Run `ip link` in a terminal, looking for devices beginning with `e`.

There are three basic steps:

- Network Setup

- tftpd setup

- Triggering TFTP on the router

You will want to install the following package:

- `network-manager`: to make consistently configuring your network easier. (This integrates with the network configuration present on most desktop devices)

From your TFTP installation guide, find which address the router expects to request an image from - for example, - then use the `nmtui` command to configure it:

Edit a connection → Add → Ethernet: - Profile name 'Static Address for TFTP' - Device '(the name of the ethernet port you found earlier, e.g. enp0s25)' - IPv4 CONFIGURATION:

  1. Manual
  2. Show:
    1. Addresses '' (the /24 is a subnet mask - can only talk to everyone who has the same first 24 bits in the address field)

- … now go all the way down and hit '<OK>'

If you would like to test this earlier, try hooking up your laptop or computer via ethernet cable to a router or switch, and selecting the 'Static Address for TFTP' connection; then run `ip address` in a terminal to verify that your address automatically comes up correctly.

You will want to install the following package:

- `tftpd-hpa`: to provide a service which automatically responds to TFTP requests for files

Once this is installed, a directory named `/var/lib/tftpboot/` should be created. This is where you will place files for `tftpd-hpa` to serve up. (If it's not created: try `dpkg -L` on Ubuntu or similar to find where it was created.

Copy the files you intend to send to the router under `/var/lib/tftpboot/`. You may need to use sudo to do this.

Start `tftpd-hpa` by running the following command:

`sudo systemctl start tftpd-hpa`

You should get no output.

Hint: if this fails to start, you likely have another process which is listening on port 69, thereby blocking `tftpd-hpa` from doing so. To check, run:

`sudo netstat -tupena | grep :69`

  hurricos@myhost:~$ sudo netstat -tupena | grep :69
  udp        0      0    *                           0          1786355    11349/inetd      
  udp6       0      0 :::69                   :::*                                0          1786356    11349/inetd     

You will want to stop the process (in this case, `inetd`) which is using this port. In this case, you could use `sudo systemctl stop inetd`.

Now, you will plug your router to-be-flashed into your laptop, and follow your guide in order to trigger the router to request TFTP. In the cases where you are using a serial cable to control your router, you are usually using the uBoot console to tell the router to boot from the network – for example, on the Meraki MR16.

If you are not able to get the router to boot, there are a few things you can check:

- Are you actually receiving a TFTP/BOOTP packet from the router?

  1. You can check this by running `sudo tcpdump -i <ethernet device> port 69`

- Are your files named correctly?

  1. TFTP requests will be responded to with files named exactly as they are found under `/var/lib/tftpboot/`.
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2020/11/01 17:18
  • by bikepunk