Search
  • Shannon

Did You Forget to Update DNS on Unifi? I did!

I recently updated my domain controllers to Windows Server 2022. The reasons behind why I still run traditional infrastructure are vast, but for now, know that updating/maintenance is part of what I do to maintain this environment. With Windows Server 2016 reaching end of mainstream support back in January of this year, it naturally made sense to update the domain controllers I run within my home lab.


The problem? I forgot to update DNS on my Unifi networking gear before decommissioning my old DNS servers AND I statically assign IPs to each device (plus DNS). Isn't it always DNS? It's ALWAYS DNS!



















After the great DNS decom of 2022, all of a sudden, I started seeing this from my Unifi controller (note I fixed it with my downstairs-media-hub switch before writing this post):

Given Ubiquiti's previous hurdles with stability and their Unifi Dream Machine/Dream Machine Pro line, I went down an investigative rabbit hole. I then discovered there were no known stability issues with the firmware version I'm on, so then I sat and thought about what changed. Doh! DNS! I didn't update it in time! The problem? Sure, I'd see the switches as "Adopting", but I could never officially control them from the web GUI, so I couldn't update DNS that way. This meant I had to do some digging online on where to update the DNS servers on the switches themselves.


I eventually landed on using WinSCP as a quick way to get into the file system. I've gotten much better with files and using the Linux command line, but I wanted to fix this issue quickly to get ahead of any issues. I had heard reports from my better half that there were some streaming issues experienced the day prior, but I had back-to-back calls for work, so I didn't notice. Whoops. Time to fix and fix quickly vs. letting these lingering issues last. Additionally, WinSCP operates like Windows Explorer. I couldn't initially find the right files, so leaning on WinSCP to find those files helped me with the location. Yes - I'll get better with Linux in due time. Promise.


Just like with most router/switch software, there are persistent files and files and non-persistent files. In sifting online, I originally found out that you should edit the resolv.conf file that lives in /etc. While this helps "adopt" the switch, it's considered a non-persistent file. There's a section of the file that talks about nameservers and you can input IP addresses of your nameservers in that file. Don't forget to hit save.





Eventually the switches will show up as adopted and you could easily configure the DNS from the web GUI. Configuring it in the web GUI after taking control of the switch using the resolv.conf file will make the changes persistent. FYI. Let's think about possible ramifications here though, given that resolv.conf is not a persistent file. Upon reboot of a switch (let's say you applied a new firmware update in the future after editing nameservers in the resolv.conf file), your switch would be stuck in the same state of "Adopting" without giving you control of the individual device in the web GUI. Now, that's IF you didn't use the web GUI to update DNS after regaining control.


So, what's the persistent file then? After digging, I figured out where the file is and what to update. The file is system.cfg and lives in the /tmp/ directory. Why "/tmp/" and not somewhere else like "/etc/" is beyond me. I don't call the shots; I just hope my blog post helps if you find yourself in a situation like me (and it's why I used WinSCP vs. the command line).

When you open up the file, browse down to the resolv.host section of the file and you'll see resolv.nameserver.1.ip and resolv.namserver.2.ip. Switch the name servers from the existing servers (my existing servers were the servers ending in 192 and 193) to the new servers (my new servers were the servers ending in 194 and 196).

Existing setup:





New setup:





Now that I've edited the system.cfg file for all my Unifi devices, the changes will remain throughout each reboot from here on out (or at least until I change my DNS again - I hope I don't forget this task in the future). Hopefully this post helped you out with what to do if you're in a similar situation or how to avoid a similar situation. Cheers!

189 views0 comments

Recent Posts

See All