Update README.md
[oweals/nmrpflash.git] / README.md
1 nmrpflash - Netgear Unbrick Utility
2 ====================================
3
4 `nmrpflash` uses Netgear's [NMRP protocol](http://www.chubb.wattle.id.au/PeterChubb/nmrp.html)
5 to flash a new firmware image to a compatible device. It has been successfully used on a Netgear
6 EX2700, DNG3700v2 and R6220, R7000, D7000, WNR3500L, R6800, but is likely to be compatible with many
7 other Netgear devices.
8
9 Prebuilt binaries for Linux, ~OS X~ macOS 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 (-i and -f and/or -c are mandatory):
17  -a <ipaddr>     IP address to assign to target device
18  -A <ipaddr>     IP address to assign to interface
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 Your Netgear router must be connected to your network using an
38 Ethernet cable. The device running `nmrpflash` must be connected
39 to the same network, using either Wi-Fi or Ethernet.
40
41 All available network interfaces can be listed using
42
43 ```
44 # nmrpflash -L
45 eth0      192.168.1.2  f2:11:a1:02:03:b1
46 ```
47
48 Once you've determined the interface to use, we can flash the image. Firmware
49 images can usually be downloaded directly from Netgear. Power on your device
50 immediately after starting `nmrpflash`.
51
52 ```
53 # nmrpflash -i eth0 -f EX2700-V1.0.1.8.img
54 Advertising NMRP server on eth0 ... /
55 Received configuration request from a4:2b:8c:00:00:01.
56 Sending configuration: ip 10.164.183.252, mask 255.255.255.0.
57 Received upload request: filename 'firmware'.
58 Uploading EX2700-V1.0.1.8.img ... OK
59 Waiting for remote to respond.
60 Remote finished. Closing connection.
61 Reboot your device now.
62 ```
63
64 ### Common issues
65
66 In any case, run `nmrpflash` with `-vvv` before filing a bug report. Also,
67 try connecting your Netgear router *directly* to the computer running
68 `nmrpflash`.
69
70 ###### "Error while loading shared libraries: ..." (Linux)
71
72 You must install your Linux distribution's `libpcap` and `libnl-3`
73 packages (exact names will vary depending on your distribution).
74
75 ###### "The program can't start because wpcap.dll is missing" (Windows)
76
77 On Windows 8.1 and older, install [WinPcap](https://www.winpcap.org/install/default.htm).
78 On Windows 10, install [Npcap](https://nmap.org/npcap/) (be sure to select "WinPcap Compatibility").
79
80 ###### "No suitable network interfaces found."
81
82 Make sure the network interface is up (wireless interfaces are not supported).
83 On Windows, try restarting the WinPcap service (commands must be run as
84 administrator):
85
86 ```
87 C:\> net stop npf
88 C:\> net start npf
89 ```
90
91 ###### "No response after 60 seconds. Bailing out."
92
93 The router did not respond. Try rebooting the device and run `nmrpflash` again.
94 You could also try running `nmrpflash` with `-m` and specify your router's
95 MAC address. It's also possible that your device does not support the NMRP protocol.
96
97 ###### "Timeout while waiting for ACK(0)/OACK."
98
99 The device did not respond to `nmrpflash`'s TFTP upload request. By default,
100 `nmrpflash` will assign `10.164.183.252` to the target device, while adding `10.164.183.253`
101 to the network interface specified by the `-i` flag. You can use `-a` to change the IP
102 address assigned to the target (e.g. if your network is `192.168.1.0/24`, specify a *free*
103 IP address, such as `-a 192.168.1.252`), and `-A` to change the IP address used for the
104 network interface.
105
106 This error message could also indicate a bug in the TFTP code; try using an external tftp
107 client (busybox in this example), by specifying the `-c` flag instead of the `-f` flag:
108
109 `# nmrpflash -i eth0 -c 'busybox tftp -p -l EX2700-V1.0.1.8.img $IP'`
110
111 The environment variable `IP` is set by `nmrpflash` (other environment variables
112 are: `MAC`, `PORT`, `NETMASK`).
113
114 ###### "Timeout while waiting for CLOSE_REQ."
115
116 After a successful file upload, `nmrpflash` waits for up to 5 minutes for an
117 answer from your device. You can increase this by specifying a longer timeout
118 using `-T` switch (argument is in seconds).
119
120 It's entirely possible that the image was flashed successfully, but the
121 operation took longer than 5 minutes.
122
123 ###### "Address X/Y cannot be used on interface Z."
124
125 `nmrpflash` refuses to use an IP address / subnet mask combination that would
126 make the remote device unreachable from the device running `nmrpflash`. For
127 example, if the IP address of your computer is 192.168.0.1/255.255.255.0, assigning
128 192.168.2.1/255.255.255.0 to the router makes no sense, because the TFTP upload will
129 fail.
130
131 ###### "IP address of X has changed. Please assign a static IP to the interface."
132
133 This can happen if the network interface in question automatically detects that
134 the network cable has been connected, and your computer tries to reconfigure that
135 interface (NetworkManager on Linux does this for example) - this can usually be
136 disabled.
137
138 An alternative would be to add `-c 'ifconfig <interface> <ip>'` to the command line,
139 for example:
140
141 `# nmrpflash -i eth0 -a 192.168.1.1 -f firmware.bin -c 'ifconfig eth0 192.168.1.2'`
142
143 This will execute the command specified by `-c` prior to starting the TFTP upload (in
144 this case setting the IP address to 192.168.1.2).
145
146 ### Building and installing
147 ###### Linux, Mac OS X, BSDs
148
149 ```
150 $ make && sudo make install
151 ```
152
153 ###### Windows
154
155 The repository includes a
156 [DevCpp](http://sourceforge.net/projects/orwelldevcpp/)
157 project file (`nmrpflash.dev`). Download the latest
158 [WinPcap Developer Pack](https://www.winpcap.org/devel.htm)
159 and extract it into the root folder of the nmrpflash sources.
160
161
162