Bump version
[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 successfully used on a Netgear EX2700 and DNG3700v2, but is likely to work
8 with many other Netgear routers as well.
9
10 Prebuilt binaries for Linux, OS X and Windows are available
11 [here](https://github.com/jclehner/nmrpflash/releases)
12 ([WinPcap](https://www.winpcap.org/install/default.htm) is required on Windows).
13
14 ```
15 Usage: nmrpflash [OPTIONS...]
16
17 Options (-a, -i and -f and/or -c are mandatory):
18  -a <ipaddr>     IP address to assign to target device
19  -c <command>    Command to run before (or instead of) TFTP upload
20  -f <firmware>   Firmware file
21  -F <filename>   Remote filename to use during TFTP upload
22  -i <interface>  Network interface directly connected to device
23  -m <mac>        MAC address of target device (xx:xx:xx:xx:xx:xx)
24  -M <netmask>    Subnet mask to assign to target device
25  -t <timeout>    Timeout (in milliseconds) for regular messages
26  -T <timeout>    Time (seconds) to wait after successfull TFTP upload
27  -p <port>       Port to use for TFTP upload
28  -R <region>     Set device region (NA, WW, GR, PR, RU, BZ, IN, KO, JP)
29  -v              Be verbose
30  -V              Print version and exit
31  -L              List network interfaces
32  -h              Show this screen
33 ```
34
35 ### Using nmrpflash
36
37 Connect your Netgear router to your computer using a network cable.
38 Assign a static IP address to the network adapter that's plugged into
39 the Netgear router.
40
41 For this example, we'll assume that your network interface is `eth0`.
42 First, we have to assign a static IP address to our network interface.
43 In this example, we'll use `192.168.1.2`. All available network interfaces
44 can be listed using
45
46 ```
47 # nmrpflash -L
48 eth0      192.168.1.2  f2:11:a1:02:03:b1
49 ```
50
51 Now we can flash the image. The argument for the `-a` option needs
52 to be a *free* IP address from the same subnet as the one used by your
53 network interface; we'll use `192.168.1.254`. Firmware images can usually 
54 be downloaded directly from Netgear. For details on how to do this, see
55 [here](#obtaining-firmware-images). Power on your device immediately 
56 after starting `nmrpflash`.
57
58 ```
59 # nmrpflash -i eth0 -a 192.168.1.254 -f EX2700-V1.0.1.8.img
60 Advertising NMRP server on eth0 ... /
61 Received configuration request from a4:2b:8c:00:00:01.
62 Sending configuration: ip 192.168.1.254, mask 255.255.255.0.
63 Received upload request: filename 'firmware'.
64 Uploading EX2700-V1.0.1.8.img ... OK
65 Waiting for remote to respond.
66 Remote finished. Closing connection.
67 Reboot your device now.
68 ```
69
70 ### Common issues
71
72 In any case, run `nmrpflash` with `-vvv` before filing a bug report.
73
74 ###### "Error while loading shared libraries: libpcap.so.0.8" (Linux)
75
76 You must install your Linux distribution's `libpcap` package. In
77 openSUSE or Ubuntu for example, install `libpcap0.8`. Other distros
78 will have a similarily named package.
79
80 ###### "The program can't start because wpcap.dll is missing" (Windows)
81
82 Install [WinPcap](https://www.winpcap.org/install/default.htm).
83
84 ###### "No suitable network interfaces found."
85
86 Make sure the network interface is up (wireless interfaces are not supported).
87 On Windows, try restarting the WinPcap service (commands must be run as
88 administrator):
89
90 ```
91 C:\> net stop npf
92 C:\> net start npf
93 ```
94
95 ###### "No response after 60 seconds. Bailing out."
96
97 The router did not respond. Try rebooting the device and run `nmrpflash` again.
98 You could also try running `nmrpflash` with `-m` and specify your router's
99 MAC address. It's also possible that your device does not support the NMRP protocol.
100
101 ###### "Timeout while waiting for initial reply."
102
103 The device did not respond to `nmrpflash`'s TFTP upload request. This could indicate a bug
104 in the TFTP code; try using an external tftp client (busybox in this example), by specifying
105 the `-c` flag instead of the `-f` flag:
106
107 `# nmrpflash -i eth0 -a 192.168.1.254 -c "busybox tftp -p -l EX2700-V1.0.1.8.img 192.168.1.254"`
108
109 ###### "Timeout while waiting for CLOSE_REQ."
110
111 After a successful file upload, `nmrpflash` waits for up to 5 minutes for an
112 answer from your device. You can increase this by specifying a longer timeout
113 using `-T` switch (argument is in seconds).
114
115 It's entirely possible that the image was flashed successfully, but the
116 operation took longer than 5 minutes.
117
118 ###### "Address X/Y cannot be used on interface Z."
119
120 `nmrpflash` refuses to use an IP address / subnet mask combination that would
121 make the remote device unreachable from the device running `nmrpflash`. For
122 example, if the IP address of your computer is 192.168.0.1/255.255.255.0, assigning
123 192.168.2.1/255.255.255.0 to the router makes no sense, because the TFTP upload will
124 fail.
125
126 ###### "IP address of X has changed. Please assign a static IP to the interface."
127
128 This can happen if the network interface in question automatically detects that
129 the network cable has been connected, and your computer tries to reconfigure that
130 interface (NetworkManager on Linux does this for example) - this can usually be
131 disabled.
132
133 An alternative would be to add `-c 'ifconfig <interface> <ip>'` to the command line,
134 for example:
135
136 `# nmrpflash -i eth0 -a 192.168.1.1 -f firmware.bin -c 'ifconfig eth0 192.168.1.2'`
137
138 This will execute the command specified by `-c` prior to starting the TFTP upload (in
139 this case setting the IP address to 192.168.1.2).
140
141 ### Building and installing
142 ###### Linux, Mac OS X, BSDs
143
144 ```
145 $ make && sudo make install
146 ```
147
148 ###### Windows
149
150 The repository includes a
151 [DevCpp](http://sourceforge.net/projects/orwelldevcpp/)
152 project file (`nmrpflash.dev`). Download the latest
153 [WinPcap Developer Pack](https://www.winpcap.org/devel.htm)
154 and extract it into the root folder of the nmrpflash sources.
155
156 ### Obtaining firmware images
157
158 Firmware images can be downloaded directly from Netgear's FTP servers. 
159 For the Netgear EX2700 for example, download 
160 ftp://updates1.netgear.com/ex2700/ww/fileinfo.txt. At the top there 
161 should be an entry like this:
162
163 ```
164 [Major1]
165 file=EX2700-V1.0.1.8.img
166 ...
167 ```
168
169 The download link for the latest firmware image for this device is thus:
170 ftp://updates1.netgear.com/ex2700/ww/EX2700-V1.0.1.8.img. Substitute 
171 `ex2700` for your device (`wndr4300`, `wndr3700`, `r6100`, etc.). If
172 neccessary, substitute `ww` (world-wide) for a specific region.
173