Ensure that NMRP packets are at least 64 bytes
[oweals/nmrpflash.git] / README.md
index 0d9a2167dd727298e810887b797b313b701154c1..22177942d5cf5594aa265e97123a055918c6e921 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,7 +4,8 @@ nmrpflash - Netgear Unbrick Utility
 This program uses Netgear's [NMRP protocol]
 (http://www.chubb.wattle.id.au/PeterChubb/nmrp.html)
 to flash a new firmware image to a compatible device. This utility has been
-tested with a Netgear EX2700, but is likely to work on many others as well.
+successfully used on a Netgear EX2700 and DNG3700v2, but is likely to work
+with many other Netgear routers as well.
 
 Prebuilt binaries for Linux, OS X and Windows are available
 [here](https://github.com/jclehner/nmrpflash/releases)
@@ -13,8 +14,9 @@ Prebuilt binaries for Linux, OS X and Windows are available
 ```
 Usage: nmrpflash [OPTIONS...]
 
-Options (-a, -i and -f and/or -c are mandatory):
+Options (-i and -f and/or -c are mandatory):
  -a <ipaddr>     IP address to assign to target device
+ -A <ipaddr>     IP address to assign to interface
  -c <command>    Command to run before (or instead of) TFTP upload
  -f <firmware>   Firmware file
  -F <filename>   Remote filename to use during TFTP upload
@@ -33,32 +35,27 @@ Options (-a, -i and -f and/or -c are mandatory):
 
 ### Using nmrpflash
 
-Connect your Netgear router to your computer using a network cable.
-Assign a static IP address to the network adapter that's plugged into
-the Netgear router.
+Your Netgear router must be connected to your network using an
+Ethernet cable. The device running `nmrpflash` must be connected
+to the same network, using either Wi-Fi or Ethernet.
 
-For this example, we'll assume that your network interface is `eth0`.
-First, we have to assign a static IP address to our network interface.
-In this example, we'll use `192.168.1.2`. All available network interfaces
-can be listed using
+All available network interfaces can be listed using
 
 ```
-$ nmrpflash -L
+# nmrpflash -L
 eth0      192.168.1.2  f2:11:a1:02:03:b1
 ```
 
-Now we can `nmrpflash`. The argument for the `-a` option needs
-to be a *free* IP address from the same subnet as the one used by your
-network interface. We'll use `192.168.1.254`. Firmware images can usually 
-be downloaded directly from netgear. For details on how to do this, see
-[here](#obtaining-firmware-images). Power on your device immediately 
+Once you've determined the interface to use, we can flash the image. Firmware
+images can usually be downloaded directly from Netgear. For details on how to
+do this, see [here](#obtaining-firmware-images). Power on your device immediately
 after starting `nmrpflash`.
 
 ```
-$ nmrpflash -i eth0 -a 192.168.1.254 -f EX2700-V1.0.1.8.img
+# nmrpflash -i eth0 -f EX2700-V1.0.1.8.img
 Advertising NMRP server on eth0 ... /
 Received configuration request from a4:2b:8c:00:00:01.
-Sending configuration: ip 192.168.1.254, mask 255.255.255.0.
+Sending configuration: ip 10.164.183.252, mask 255.255.255.0.
 Received upload request: filename 'firmware'.
 Uploading EX2700-V1.0.1.8.img ... OK
 Waiting for remote to respond.
@@ -67,10 +64,31 @@ Reboot your device now.
 ```
 
 ### Common issues
+
+In any case, run `nmrpflash` with `-vvv` before filing a bug report. Also,
+try connecting your Netgear router *directly* to the computer running
+`nmrpflash`.
+
+###### "Error while loading shared libraries: libpcap.so.0.8" (Linux)
+
+You must install your Linux distribution's `libpcap` package. In
+openSUSE or Ubuntu for example, install `libpcap0.8`. Other distros
+will have a similarily named package.
+
+###### "The program can't start because wpcap.dll is missing" (Windows)
+
+Install [WinPcap](https://www.winpcap.org/install/default.htm).
+
 ###### "No suitable network interfaces found."
 
-If you're *not* on Windows, rerun `nmrpflash -L` using `sudo`. In any case,
-use `-vvvL` to see more detailed messages, and file a bug report if applicable.
+Make sure the network interface is up (wireless interfaces are not supported).
+On Windows, try restarting the WinPcap service (commands must be run as
+administrator):
+
+```
+C:\> net stop npf
+C:\> net start npf
+```
 
 ###### "No response after 60 seconds. Bailing out."
 
@@ -80,31 +98,29 @@ MAC address. It's also possible that your device does not support the NMRP proto
 
 ###### "Timeout while waiting for initial reply."
 
-The device did not respond to `nmrpflash`'s TFTP upload request. This could indicate a bug
-in the TFTP code; try using an external tftp client (busybox in this example), by specifying
-the `-c` flag instead of the `-f` flag:
-
-`$ nmrpflash -i eth0 -a 192.168.1.254 -c "busybox tftp -p -l EX2700-V1.0.1.8.img 192.168.1.254"`
-
-If the upload still fails, and you're on Windows, try executing the following command before
-running `nmrpflash`:
+The device did not respond to `nmrpflash`'s TFTP upload request. By default,
+`nmrpflash` will assign `10.164.183.252` to the target device, while adding `10.164.183.253`
+to the network interface specified by the `-i` flag. You can use `-a` to change the IP
+address assigned to the target (e.g. if your network is `192.168.1.0/24`, specify a *free*
+IP address, such as `-a 192.168.1.252`), and `-A` to change the IP address used for the
+network interface.
 
-`C:\> netsh interface ip add neighbors <interface> <ip> <mac>`
+This error message could also indicate a bug in the TFTP code; try using an external tftp
+client (busybox in this example), by specifying the `-c` flag instead of the `-f` flag:
 
-where `<interface>` is the pretty interface name (e.g. "Local Area Connection"; as displayed by
-`nmrpflash -L`), `<ip>` is the same IP address you'd use for `nmrpflash`'s `-a` flag, and `<mac>`
-is the target device's mac address.
+`# nmrpflash -i eth0 -c 'busybox tftp -p -l EX2700-V1.0.1.8.img $IP'`
 
-Cheers to @ntadmin for this info!
+The environment variable `IP` is set by `nmrpflash` (other environment variables
+are: `MAC`, `PORT`, `NETMASK`).
 
 ###### "Timeout while waiting for CLOSE_REQ."
 
-After a successful file upload, `nmrpflash` waits for up to 120 seconds for an
+After a successful file upload, `nmrpflash` waits for up to 5 minutes for an
 answer from your device. You can increase this by specifying a longer timeout
 using `-T` switch (argument is in seconds).
 
 It's entirely possible that the image was flashed successfully, but the
-operation took longer than 120 seconds.
+operation took longer than 5 minutes.
 
 ###### "Address X/Y cannot be used on interface Z."
 
@@ -124,7 +140,7 @@ disabled.
 An alternative would be to add `-c 'ifconfig <interface> <ip>'` to the command line,
 for example:
 
-`nmrpflash -i eth0 -a 192.168.1.1 -f firmware.bin -c 'ifconfig eth0 192.168.1.2'`
+`nmrpflash -i eth0 -a 192.168.1.1 -f firmware.bin -c 'ifconfig eth0 192.168.1.2'`
 
 This will execute the command specified by `-c` prior to starting the TFTP upload (in
 this case setting the IP address to 192.168.1.2).