$ cat post/sudo-bang-bang-run-/-the-network-split-in-the-night-/-the-log-is-silent.md

sudo bang bang run / the network split in the night / the log is silent


Debugging the Great DNS Fiasco


December 1, 2003. The days are getting shorter and colder, but my inbox is as warm with alerts as it ever was. Today, I woke up to a particularly obnoxious error: “504 Gateway Timeout” on our main application server. Let me tell you, this wasn’t your ordinary timeout; it felt like the DNS gods were personally tormenting us.

Our application, part of that burgeoning web 2.0 scene where everyone was shouting about AJAX and RSS feeds, had suddenly stopped working for a critical client. The logs showed nothing but “timed out” messages, which is never good when you’re dealing with real users.

I grabbed my trusty Python script to check the DNS resolution, and sure enough, it was failing miserably on that particular server. I had just started using nslookup in a bash script for quick checks, and it wasn’t lying—it looked like our nameservers were pointing to some non-existent IP addresses.

After an hour of staring at my terminal, I realized we needed a bigger hammer: the dig command from BIND tools. dig +trace, baby! The output showed that our nameservers were having issues resolving certain domains, and it seemed like one of our upstream DNS servers was flaky. This is where things got interesting.

I fired off an email to our ISP, explaining the issue in detail (I never did get used to the formalism required for tech support emails). Their response was a mix of surprise and confusion; they assured me they were looking into it but didn’t seem too worried. In hindsight, I should have been more persistent.

While waiting on them, I dug deeper. I wrote a small Python script to automate the dig process and save output for analysis later. The script looked like this:

import subprocess

def query_dns(domain):
    try:
        result = subprocess.run(['dig', '+trace', domain], capture_output=True, text=True)
        return result.stdout
    except Exception as e:
        print(f"An error occurred: {e}")

for domain in ['example.com', 'anotherdomain.org']:
    print(query_dns(domain))

Running this script across our critical domains revealed a pattern: some were fine, but certain ones, including the one failing, had issues with multiple upstream servers. It was clear that we needed to switch DNS providers if this was going to be a long-term solution.

By mid-afternoon, I managed to get in touch with another ISP and set up our nameservers there. The process wasn’t as straightforward as it should have been, but eventually, we switched over. The dig command now returned the correct IP addresses for all domains.

A few days later, the application was back online, and users were none the wiser. We had dodged a bullet, but the experience left me feeling like I needed to be more proactive in monitoring DNS health. At least now, I had learned that dig +trace is your best friend when troubleshooting DNS issues.

This incident also highlighted how the sysadmin role was evolving—more scripting, more automation. The days of manual DNS checks were numbered. Python scripts and tools like dig would become standard in my toolkit for such tasks.

So here’s to the early days of web 2.0, where we faced new challenges but also had fun learning along the way. If only our nameservers could be as flexible and adaptable as our applications.


[This blog post is a reflection on the experiences of a systems engineer in 2003 dealing with DNS issues, using specific tools like nslookup and dig, and highlighting how Python scripting became an essential part of the sysadmin’s toolkit. The tone is personal, reflecting on the challenges faced and the lessons learned.]