Edit: I've successfully flashed my cameras and NVR, I'll update the following steps with what I actually did and what I observed.
Notes on the differences between the two types of firmware files to apply: One is a packaged type that contains the individual lib files, this format is needed when performing initial flashes and to actually migrate over to Dahua firmware. The second is a larger .bin file (one each for the cams/nvr), which can be applied after the fact to either fix an issue or to ensure a successful flash. The latter .bin file method is done on the cams via their web interface, or on the NVR either through the web interface or via a USB drive (an option comes up to let you pick the .bin to update to).
Here's my breakdown of the steps I actually took, and I left in my initial questions/assumptions to maybe help clear up any confusion for someone new to this (Like I was). This first section describes the process to convert/flash the Cams. I'm going based off of
the main post on page one here.
1) Obtain network access to the camera as described in the post, to/from a windows machine. Run wireshark to monitor the network traffic.
Steps I took / my setup:
- Physical Connection: I used a separate machine as I would lose internet access, I used a flash drive to transfer needed files to/from this machine as needed. I used a single network cable to go from the PC to the camera, and powered the cameras using a spare 12-volt power adapter. My cameras are partially installed and easily accessible, if yours are not accessible I recommend using a POE injector and getting setup near your NVR.
- Follow step 1 here to configure the PC to communicate to the camera properly.
- I strongly recommend first accessing the NVR and taking note of all the camera's IP addresses (Registration page).
- If the camera is brand new or has not been registered to the NVR it should have the default 192.168.1.108 IP address (and will prompt to set a password, I suggest setting the same as the NVR password) and you don't need to do anything else. If it has been registered to the NVR it will be in the 10.1.1.X subnet and address, and you'll need to change it to the 192.168.1.108 IP address (or at least within the 192.168.1.X subnet I suspect, Else will fail to access the TFTPServer, FYI I tried it) and the default gateway to 192.168.1.1 , keep the same subnet mask.
- To change the cameras IP address (easy method, assuming you're ready to flash right away): access the NVR via a Internet Explorer (on a machine that still has network access) (Install/allow all plugins and prompts), go to the Registration page and find the cam to be upgraded, click the IE icon to access that camera's web interface, log in (should be NVR creds), access the network settings and change the IP to 192.168.1.108 and the default gateway to 192.168.1.1, once you hit "save" the page will go blank (since you'll no longer be communicating to the right IP), but the camera is then ready for the next steps.
- To change the cameras IP address (longer more tedious method): Follow the step 1 instructions in the post, except set your PCs IP to 10.1.1.1 and then ensure you can access the camera at its 10.1.1.X IP address (which you hopefully took note of prior), Change the camera's IP to 192.168.1.108 and subnet to 192.168.1.1 , save it, and then set your PCs IP address back to 192.168.1.1 as described in the linked post. (This is tedious, just do it the right/easy way first
).
- It will help to ensure that you're able to access the camera's login page via IE to ensure proper setup and to see where it's at in the process, and also to have wireshark running to ensure it can reach it and to see when the 192.168.254.254 destination packets are being sent (indicates successfully sending the files in subsequent steps).
- Note: You can probably bypass the needs to manually set the IP address by doing a hard reset on the camera, I'd just do that if you're stuck.
2) Download and extract the "Dahua_TFTPBackup.zip" from the post
3) Replace the contents of "commands.txt" with what @d.lux
provided in his post.
4) Run "Command.bat" to generate a "upgrade_info_7db780a713a4.txt" file from the "commands.txt" file? (Edit: Confirmed this to work as described, do not run as Administrator on this .bat, else will fail to find "root" path)
Note: the output "upgrade_info_7db780a713a4.txt" file is generated differently on different machines, I noticed on my desktop it generated the file on a single line with all the command jumbled together (I thought this was invalid but it actually turned out to be correct). Do not attempt to modify the output file and just leave it at whatever it's defaulted to, only use the version generated on the machine you're running the flash on.
5) Place the unzipped .img files from the zip obtained as part of the steps
@Levin83 mentions at the start of his post into the "root" directory of "Dahua_TFTPBackup"?
Or does it mean the literal root of "Dahua_TFTPBackup" that contains the .bat and .txt files? (Edit: No, confirmed it's the former "root" directory)
Note: The zipped package "DH_IPC-HX5X3X-Rhea_MultiLang_NP_Stream3_V2.800.0000008.0.R.190619 " is in the download center.
Note: Windows see the .img files as a "Disk Image File", in case you don't have file extensions enabled.
6) Launch "TFTPServer.bat",
I'm assuming as Administrator? Note: Do not run any of the .bat scripts as admin, with these they'll just open and close right away and are likely running in the background which will really throw you off. Just double click them and you'll be able to see the status output in the running console for each, which is really helpful.
7) Launch "Console.bat"
, I'm assuming as Administrator?
8) The camera should automatically apply the firmware update once powered on and with the
TFTP server/Console running? (Yes! it's part of the startup process) Wait until all activity is done on the TFTP output and in wireshark (see notes)
Note: Make sure both the TFTPServer and Console command windows are up, plug the camera in when ready. If not running as POE plug in the network cable first, as the firmware update process is part of the camera's startup operation.
Note: The first time I noticed that the TFTP console complained about a missing "failed.txt" file, I created that in the "root" directory (an empty file), probably not needed but it could help with the script workflow.
- If everything is running right you should start to see activity in wireshark right after plugging in the camera, and there will be output on the TFTPServer console. You should see packets in wireshark to 192.168.254.254 as the files are being uploaded to the camera.
I just let the script keep running, eventually there will be a burst of output on the "Console" script after some time, with a final command of "write: " followed by some percentage less than 100 (Mine frequently showed "write: 49%") just as the process is done and right before the camera resets.
- It took roughly 10 minutes for the above steps.
- If you're near the camera you should be able to hear it click as it resets. Attempt to access the camera at 192.168.1.108 in IE and if all is well you should see the Dahua login page instead of "LeChange". From here you'll want to kill the running scripts (Else on subsequent restart it may attempt to flash when you don't want it to)
9) Attempt to re-connect the camera to the NVR
, a hard-reset on the camera may be necessary
- If you intend on following step 10 you'll probably want do do that first as you still have access to the camera on the machine you flashed it with.
- Note: a hard reset is probably not needed unless you have a different password set on the camera vs what is set on the NVR. Mine actually re-assigned the same 10.1.1.x subnet IP and maintained it's existing registration settings (Probably tracked by the MAC anyways), just by plugging it back into the NVR.
10) Apply the same firmware update but this time via the provided "
DH_IPC-HX5X3X.bin" file within the web GUI of the camera? Just to make sure everything was applied correctly?
- I really think this is optional, but it's good to get the feel-goods and to follow best practice
Notes on subsequent cameras: They're easier after you get the first one done and learn the process, and then you'll be able to quickly do step 1, 6-9 (and 10 if you're paranoid/thorough
).
Basically similar steps to upgrade the NVR... But with these caveats:
1) Obtain network access to the NVR via the network port on the NVR? This should be on the IP address it's already set/assigned to on the network or within the NVR settings right? (edit: Yes, the same IP Address it's set to and what you access it to on your network, I'm assuming it's within the 192.168.1.X subnet as with most home networks).
- Again I did this via a direct ethernet connection from my PC to the NVR's WAN port. If your computer's IP address is still the static 192.168.1.1 from the previous step 1 you should be able to access the NVR at it's set IP address. You should probably make sure the NVR has a set static IP address and not DHCP.
2) Purge any extra files from "Dahua_TFTPBackup" so that it's at its default state.
- Note: Was suggested (and a good idea) to just maintain a separate copy for the NVR files.
3) Create the text file named "ID_YourSerialNumberHere.txt" that I'm assuming I fill in the literal serial number of my NVR into, example if the serial is 123456 the file is to be named "ID_123456.txt"? (Yes!) Make its contents the 4 lines mentioned and place this into the "root" folder?
- Yes, and should be the actual Serial Number found within the NVR info area (May be abbreviated as just SN)
4) Obtain the "DH_NVR4XXX-4KS2_MultiLang_V3.216.0000003.0.R.190521" package from the download center (see other section/
post for how/where to get this) for the NVR, extract all the files into the "root" directory.
note: I found two versions of "DH_NVR4XXX-4KS2_MultiLang_V3.216.0000003.0.R.190521" on the site, I went with the latest one.
note: the posted "
DH_NVR4XX.bin" file is the "all-in-one"/recovery firmware file that cannot be used in this step, but may come into play later.
5) Launch "TFTPServer.bat",
I'm assuming as Administrator? (edit: No, don't run any of the batch files as admin, see previous notes on step 6 above)
6) Launch "Console.bat",
I'm assuming as Administrator?
7) The NVR should automatically upgrade the firmware through the TFTP Server? (Yes, upon power up, if all is setup right)
- On the TFTPServer output you should see your "ID_YourSerialNumberHere.txt" file being sent to the NVR, followed by the 4 other files listed within the file. This should then be followed by a "success.txt" response, I actually got 4 total lines of "success.txt". After some time the NVR should reboot itself. The whole process took about 20-25 minutes until it rebooted on its own)
- You should probably have the NVR displayed on a separate monitor to see what it's doing, as soon as it reboots and you see the "Dahua" start screen instead of the "LeChange" login screen you'll probably want to kill the running Console/TFTPServer batch processes.
- I made the mistake of not killing the batch scripts and it looks like the firmware update process started again on the NVR. I panicked and killed the scripts probably at the wrong time. The NVR was then in a startup/initialization loop, it would start loading a few cameras and then just restart, so I proceeded to the step below.
8) If the flash isn't successful and is stuck in a reboot loop then put the .bin file (from step 4) into the root of a flash drive and plug it into the USB port of the NVR...
and it should automatically apply the firmware with that step alone? @Levin83 ?
- This is where the "
DH_NVR4XX.bin" file will come into use, place it on a flash drive (it doesn't need to be blank or be setup any way special, just place it someone accessible like on the root of the flash drive).
- When the NVR boots it will come up with a different small menu that asks you what you want to do (when a USB drive is plugged in), I don't remember the exact option but it was obvious, I believe it was "update" or "upgrade", there were only like 4 to choose from. From there it brings up the content of your flash drive, just select the "
DH_NVR4XX.bin" file and proceed, give it plenty of time to do its thing.
- It will reboot after some time, probably not as time-sensitive but you should just remove the flash drive after reboot.
- After this everything was stable and it brought back all the cameras and settings perfectly, all the old video content was there too.
And just to confirm, we can't just do step 10 on the cameras and step 8 on the NVR to bypass all this right?
- I highly doubt it, there are probably safeguards in place to prevent it from going back to OEM easily, but I'd be highly curious if someone were to just try