Support reading from stdin using "-f -"
[oweals/nmrpflash.git] / README.md
1 nmrpflash - Netgear Unbrick Utility
2 ====================================
3
4 This program uses Netgear's [NMRP protocol]
5 (http://www.chubb.wattle.id.au/PeterChubb/nmrp.html)
6 to flash a new firmware image to a compatible device. This utility has been
7 tested with a Netgear EX2700, but is likely to work on many others as well.
8
9 Prebuilt binaries for Linux, OS X and Windows are available
10 [here](https://github.com/jclehner/nmrpflash/releases)
11 ([WinPcap](https://www.winpcap.org/install/default.htm) is required on Windows).
12
13 ````
14 Usage: nmrpflash [OPTIONS...]
15
16 Options (-a, -i and -f are mandatory):
17  -a <ipaddr>     IP address to assign to target device
18  -f <firmware>   Firmware file
19  -i <interface>  Network interface directly connected to device
20  -m <mac>        MAC address of target device (xx:xx:xx:xx:xx:xx)
21  -M <netmask>    Subnet mask to assign to target device
22  -t <timeout>    Timeout (in milliseconds) for regular messages
23  -T <timeout>    Time to wait after successfull TFTP upload
24  -p <port>       Port to use for TFTP upload
25  -U              Test TFTP upload
26  -v              Be verbose
27  -V              Print version and exit
28  -L              List network interfaces
29  -h              Show this screen
30 ````
31
32 ### Using nmrpflash
33
34 Connect your Netgear router to your computer using a network cable.
35 Assign a static IP address to the network adapter that's plugged into
36 the Netgear router.
37
38 For this example, we'll assume that your network interface is `eth0`.
39 First, we have to assign a static IP address to our network interface.
40 In this example, we'll use `192.168.1.2`. All available network interfaces
41 can be listed using
42
43 ````
44 $ nmrpflash -L
45 eth0      192.168.1.2  f2:11:a1:02:03:b1
46 ````
47
48 A firmware image file can usually be downloaded directly from 
49 Netgear's FTP servers: for the Netgear EX2700 for example, download
50 ftp://updates1.netgear.com/ex2700/ww/fileinfo.txt. At the top there 
51 should be an entry like this:
52
53 ```
54 [Major1]
55 file=EX2700-V1.0.1.8.img
56 ...
57 ```
58
59 The download link for the latest firmware image for this device is thus:
60 ftp://updates1.netgear.com/ex2700/ww/EX2700-V1.0.1.8.img. Substitute 
61 `ex2700` for your device (`wndr4300`, `wndr3700`, `r6100`, etc.).
62
63 Now we can start `nmrpflash`. The argument for the `-a` option needs
64 to be a *free* IP address from the same subnet as the one used by your
65 network interface. We'll use `192.168.1.254`. Power on your device immediately 
66 after starting `nmrpflash`.
67
68 ````
69 $ nmrpflash -i eth0 -a 192.168.1.254 -f EX2700-V1.0.1.8.img
70 Advertising NMRP server on eth0 ... /
71 Received configuration request from a4:2b:8c:00:00:01.
72 Sending configuration: ip 192.168.1.254, mask 255.255.255.0.
73 Uploading EX2700-V1.0.1.8.img ... OK
74 Waiting for remote to respond.
75 Remote finished. Closing connection.
76 ````
77
78 ### Common issues
79 ###### "No suitable network interfaces found."
80
81 If you're *not* on Windows, rerun `nmrpflash -L` using `sudo`. In any case,
82 use `-vvvL` to see more detailed messages, and file a bug report if applicable.
83
84 ###### "No response after 60 seconds. Bailing out."
85
86 The router did not respond. Try running `nmrpflash` with `-m` and specify
87 your router's MAC address. It's also entirely possible that your device does
88 not support the NMRP protocol.
89
90 ###### "Timeout while waiting for 0x04."
91
92 After a successful file upload, `nmrpflash` waits for up to 120 seconds for an
93 answer from your device. You can increase this by specifying a longer timeout
94 using `-T` switch (argument is in seconds).
95
96 It's entirely possible that the image was flashed successfully, but the
97 operation took longer than 120 seconds.
98
99 ### Building and installing
100 ###### Linux, Mac OS X, BSDs
101
102 ````
103 $ make && sudo make install
104 ````
105
106 ###### Windows
107
108 The repository includes a
109 [DevCpp](http://sourceforge.net/projects/orwelldevcpp/)
110 project file (`nmrpflash.dev`). Download the latest
111 [WinPcap Developer Pack](https://www.winpcap.org/devel.htm)
112 and extract it into the root folder of the nmrpflash sources.
113