Hi all,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
1) This is within the NVR network settings (Under TCP/IP), you should be able to set the NVR's IP to one of two modes... Static (by which it will let you manually set the IP address, subnet mask, and default gateway), or DHCP (by which it will be automatically assigned by the router, although it's rarely changed unless you're on a busy network or the device is offline for a long time... those other options to set the IP will be grayed out... however the IP may still be set to whatever values are displayed and grayed out). Make sure your PC/laptop's static IP (the steps mentioned in step 1, option 2) is the exact same as the Default Gateway of the NVR... default gateway is basically the "parent" of a device for it's network route, so by you setting your PC's static IP as the default gateway the NVR/Cam will communicate to it first when making network requests.I have a few hunches of what could be the problem, but need some expert help...
1) I did not setup my NVR to a static route, it's on DHCP(?) now. If I need to change the static routing, can someone point me to the right instructions, or elaborate on what I need to do..
2) I'm running this on a work laptop, which I am not admin of, I was able to change the NIC settings, so I doubt this is a probem.
3) I'm unclear if I should run the commands.bat and have it's output file for the NVR upgrade? The camera instruction stated to do so, then the NVR instructions said to wipe the /root file and start fresh, so I took this to mean don't run commands.bat
(My answer is based on some assumptions about your network ).is having the 86 vs 1 in the 3 sequence significant?)
For the devices themselves (the NVR or the cameras) the subnet mask should be 255.255.255.0 (A quick read up on how IP spaces and subnets work can really help demystify networking if you're not familiar), the the IP address must be of the format 192.168.1.X, where X is between 2-253 (because 1 is usually the gateway, and 254 is used for routing packets here, and 255 is the broadcast that should never be applied to a device...to be safe just stay below 200).Thanks ip_poe
So I'm indeed getting stuck at step 1.
I changed the NVR from DHCP to static and setup the following addresses.
IP Address: 192.168.86.44
Default Gateway: 192.168.1.1
Subnet Mask: 255.255.0.0
I can hit the web log in via 192.168.86.44 when the NVR is plugged into my network.
However, when I unplug it and wire it directly it to my Mac or PC I can't.
I tried a variation of the IP Address with 192.168.1.44 with the default gateway and subnet the same, but neither worked (as in, I couldn't hit the web log in page).
I see, if that's the case then it seems as though @Otown issues are exclusively related to the PC/NIC settings and/or the the lack of admin rights. I did, however, attempt to run the steps on a camera at one point when it was still within the 10.1.1.X subnet (assigned by the NVR) and it failed to reach the TFTP server until I switched it to the 192.168.1.X subnetThe ip defaults to a xx.xx.1.108 and it doesn't matter if it is static or dhcp as during boot, it broadcasts this ip...
If anyone is listening it will talk to it, if not it will go to the "assigned ip" that was given to it...
Well it looks like you've manged to get past step 1I'm closer, but still no dice..
I changed to a static IP with all the changes noted earlier.. (see second pic)
I also got a pc I have admin rights to, and made the changes to the NIC card (again "option 2") and hardwired it straight to the NVR.
I can log into the web console using the static IP address I defined when hardwired to the unit.
So I'm making progress
Where I get stuck..
When running the TFTP and Console.bat,
It connects and I get 1 block served (ID_yourserialnumber.txt)
It then tries to load the custom-x.squashfs.img but says "timeout" then goes to failed.txt and says "file not found or no access".
attached is a pic of the tftp server screen.
It may be noteworthy, that when the NVR is talking to my PC it hangs on the "Lechange" start up screen but doesn't progress (the earlier image of the TFTP server also hangs at that spot..
This all looks correct, and your "root" folder looks exactly like mine. Yes I think it's just a matter of troubleshooting a minor issue.@ip_poe
In response to your suggestions:
1) I added failed.txt as suggested. Now I get "1 block served" instead of failed. (progress I guess?)
2) Attached is a pic of my root directory. (I just 'extracted' the firmware file, was I supposed to move the bin files into the "bin" directory, or delete any other files?
Note, I also updated the ID_yourserialnumberhere.txt with the 4 commands and checked for sp errors..
3) I went back and double checked the EASY unbrick thread and confirmed that I have followed all the steps for setting up my NIC. See attached pic and let me know if I missed something..
4) On this latest attempt, I let it go ~45 min + and didn't see any signs of progress beyond the attached pics or the "lechange" boot screen.
Note, I did d/l wireshark, but i'm pretty new to the product, I'll play with it to see if I can make heads or tails of all the traffic I'm seeing..
This may be a non-issue but FYI this must be a plain text non-encoded file. You cannot create it in a program (like Word) that encodes characters. I just noticed because I have all defaults on my machine and my font characters are different (I'm using Consolas regular font, screenshot below). Probably not the case, especially if you created it within notepad and just had a different font, but I've seen this "gotcha" on a few occasions .