Skip to content

Instantly share code, notes, and snippets.

@pjobson
Last active May 10, 2024 15:54
Show Gist options
  • Save pjobson/dd7f5e68ba42a276f119f32b67bb6ee5 to your computer and use it in GitHub Desktop.
Save pjobson/dd7f5e68ba42a276f119f32b67bb6ee5 to your computer and use it in GitHub Desktop.
Flashing Netgear X10 (R9000) with TFTP

Flashing Netgear X10 (R9000) with TFTP

This doc expects some experience with the commandline. If you need help, I do reply to these gists.

You should only have the router connected to your computer, unplug any other eithernet cables / disconnect from wifi.

This script is geared toward Ubuntu/Mint, though it can probably be adapted to any other distro fairly easily.

Set Up Static IP

  • IP Address: 192.168.1.2
  • Subnet mask: 255.255.255.0
  • Default Gateway: 192.168.1.1

Install Packages

You need tftp-hpa a slightly less crappy version of the standard tftp client and pcregrep for my script.

apt purge tftp
apt install pcregrep tftp-hpa

Set Your arp Route

On the back of the router, it shows your MAC address, note this.

Find your ethernet interface, it should be something like en#. You can use the ip a command to figure it out. Mine is en7 which will be used in the rest of this document.

I made a program to constantly try to set the arp, as it was annoying to constantly try to re-run the command.

wget https://gist.githubusercontent.com/pjobson/dd7f5e68ba42a276f119f32b67bb6ee5/raw/41b4f22ed4553735ae778a3593e2c8b846be0c29/setarp.sh
chmod +x setarp.sh

Turn off your router and have it connected via NIC to your computer.

My command for example is:

sudo ./setarp.sh 9C:3D:CF:E9:0A:08 192.168.1.1 en7

The script may throw a bunch of errors, you can ignore them.

arp: writing to routing socket: No such process
arp: 192.168.1.1: No such process
# and/or
arp: writing to routing socket: Network is unreachable

Eventually it'll set your arp route, it'll loop and constant re-add your route, this is because sometimes it'll just get dropped, because FU I guess.

When you're finished be sure to CTRL-C the script or it'll run forever.

Turn Off Router

TFTP Push Setup

Get the firmware you want to flash. Open a new terminal window or tab.

Latest firmware for the router is hosted on Netgear's site: https://www.netgear.com/support/product/R9000.aspx

wget https://www.downloads.netgear.com/files/GDC/R9000/R9000-V1.0.5.38.zip
unzip R9000-V1.0.5.38.zip

Do not press enter on the put command, yet.

sudo tftp -v -m binary 192.168.1.1 -c status -c put FILENAME.img

Flash Router

  1. Hold down the reset button on the back of router with a paper clip.
  2. Power ON the router while holding down the reset button.
  3. The power LED should come on 11 times.
  4. On the 11th time, press the enter key and release the button. If you timed it right, it should start putting the firmware.

At this point it'll appear to hang, this is perfect. Then it should show:

mode set to octet
Connected to 192.168.1.1 (192.168.1.1), port 69
putting R9000-STOCK.img to 192.168.1.1:R9000-STOCK.img [octet]
Sent 42502273 bytes in 38.6 seconds [8811695 bit/s]

Now wait for it to finalize and reboot.

Again, CTRL-C the setarp script.

You can reset your connection to DHCP now.

#!/bin/bash
MAC=$1
IP=$2
IN=$3
if [ -z "$MAC" ] || [ -z "$IP" ] || [ -z "$IN" ]; then
echo "Expects: sudo setarp.sh MAC_ADDRESS ROUTER_IP_ADDRESS INTERFACE"
echo " sudo setarp.sh aa:bb:cc:dd:ee:ff 192.168.0.0 en7"
exit
fi
GOODMAC=`echo $MAC | pcregrep '..:..:..:..:..:..'`
if [ -z "$GOODMAC" ]; then
echo "MAC Address must be colon deliminated."
echo "aa:bb:cc:dd:ee:ff"
exit
fi
while [ 0 -eq 0 ]; do
arp -i $IN -s $IP $MAC
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment