Quick DNS Configuration Check for Linux Server Troubleshooting

Fast commands to check DNS configuration when troubleshooting connectivity issues. See resolver settings, test resolution, diagnose common problems.

Last updated: 2025-12-20

Quick DNS Configuration Check for Linux Server Troubleshooting

Server can't resolve domain names? Applications failing with "could not resolve host"? Here's how to quickly check your DNS configuration and diagnose common problems.

For continuous DNS monitoring, see Monitor DNS Information.

30-Second DNS Health Check

# 1. What DNS servers are configured?
cat /etc/resolv.conf

# 2. Can we resolve a domain?
dig google.com +short

# 3. Is DNS actually working?
nslookup google.com

# If any of these fail, you have a DNS problem

Understanding /etc/resolv.conf

# Example output:
nameserver 8.8.8.8         # Primary DNS server
nameserver 8.8.4.4         # Secondary DNS server
search example.com         # Default search domain
options timeout:2 attempts:3

Common issues:

  • No nameserver lines = no DNS configured
  • Unreachable nameservers = network or firewall issue
  • Wrong search domain = internal names don't resolve

Commands to Check DNS Configuration

Use these Linux commands to check DNS configuration:

Check DNS Configuration

# Check DNS configuration
cat /etc/resolv.conf

# DNS configuration with details
cat /etc/resolv.conf | grep -v "^#"

# DNS servers only
cat /etc/resolv.conf | grep nameserver

DNS Cache Statistics (systemd)

# DNS cache statistics (systemd)
sudo systemd-resolve --statistics

# DNS cache with details
sudo systemd-resolve --status

# DNS cache flush
sudo systemd-resolve --flush-caches

Test DNS Resolution

# Test DNS resolution
nslookup example.com

# DNS resolution with dig
dig example.com

# DNS resolution with host
host example.com

# Reverse DNS lookup
nslookup <IP_ADDRESS>

Check DNS Servers

# Check DNS servers
cat /etc/resolv.conf | grep nameserver

# DNS servers with IPs
cat /etc/resolv.conf | grep nameserver | awk '{print $2}'

# Test DNS server connectivity
for dns in $(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'); do echo "Testing $dns"; dig @$dns example.com +short; done

Alternative Commands

# DNS configuration with search domains
cat /etc/resolv.conf | grep -E "nameserver|search"

# DNS configuration from NetworkManager
nmcli dev show | grep DNS

# DNS resolution test with timeout
timeout 5 nslookup example.com

# DNS resolution performance
time dig example.com

How to Set Up in Zuzia.app

Set up automated monitoring of DNS configuration in Zuzia.app:

Step 1: Add Scheduled Task

  1. Add Scheduled Task

    • Navigate to Zuzia.app dashboard
    • Click "Add Scheduled Task"
    • Choose "Command" task type
  2. Configure Command

    • Use command: cat /etc/resolv.conf
    • Set execution frequency (e.g., every hour)
    • Configure task name and description

Step 2: Configure Alerts

  1. Set Alert Conditions

    • Configure alerts when DNS servers change
    • Set up alerts for DNS configuration changes
    • Configure alerts for DNS resolution failures
  2. Choose Notification Channels

    • Configure email notifications
    • Set up webhook integrations
    • Configure SMS notifications (if available)

Step 3: Monitor Results

  1. Review DNS Configuration Data

    • Check dashboard for DNS server settings
    • Review DNS configuration
    • Identify configuration changes
  2. Track DNS Trends

    • Monitor DNS configuration over time
    • Identify DNS server changes
    • Detect DNS issues

Use Cases for DNS Configuration Monitoring

This monitoring helps you:

Monitor DNS Server Settings

  • Settings monitoring: Monitor DNS server settings continuously
  • Settings tracking: Track DNS server changes
  • Settings verification: Verify DNS server settings
  • Settings management: Manage DNS server settings effectively

Detect Configuration Changes

  • Change detection: Detect DNS configuration changes automatically
  • Change alerts: Alert on DNS configuration changes
  • Change tracking: Track configuration changes over time
  • Change analysis: Analyze configuration change patterns

Troubleshoot DNS Issues

  • Issue troubleshooting: Troubleshoot DNS issues using configuration data
  • Root cause analysis: Identify root causes through DNS monitoring
  • Problem resolution: Resolve problems based on DNS configuration
  • Issue tracking: Track DNS issues through monitoring

Maintain Network Connectivity

  • Connectivity maintenance: Maintain network connectivity through DNS monitoring
  • Connectivity verification: Verify network connectivity regularly
  • Connectivity optimization: Optimize network connectivity
  • Connectivity troubleshooting: Troubleshoot connectivity issues

Audit DNS Configuration

  • Configuration auditing: Audit DNS configuration regularly
  • Configuration tracking: Track configuration changes over time
  • Configuration documentation: Document DNS configuration
  • Configuration compliance: Ensure compliance with network policies

Verify DNS Setup

  • Setup verification: Verify DNS setup through monitoring
  • Setup validation: Validate DNS configuration
  • Setup optimization: Optimize DNS setup
  • Setup documentation: Document DNS setup

Advanced Options

Enhance DNS configuration monitoring with advanced options:

Compare DNS Configs Over Time

  • Historical comparison: Compare DNS configurations over time
  • Change detection: Detect DNS configuration changes automatically
  • Trend analysis: Analyze DNS configuration trends
  • Pattern detection: Detect patterns in DNS changes

Monitor DNS Resolution Performance

  • Performance monitoring: Monitor DNS resolution performance
  • Performance analysis: Analyze resolution times
  • Performance optimization: Optimize DNS resolution
  • Performance tracking: Track resolution performance over time

Track DNS Server Availability

  • Availability tracking: Track DNS server availability
  • Availability monitoring: Monitor DNS server health
  • Availability alerts: Alert on DNS server failures
  • Availability optimization: Optimize DNS server selection

Integrate with DNS Management

  • Management integration: Integrate with DNS management tools
  • Automated management: Automate DNS management
  • DNS optimization: Optimize DNS configuration
  • DNS security: Enhance DNS security

Troubleshooting DNS Issues

When monitoring shows DNS configuration changes:

Identify DNS Problems

  1. Review DNS Configuration

    • Review current DNS configuration
    • Identify DNS server changes
    • Check DNS resolution
  2. Investigate DNS Issues

    • Investigate why DNS configuration changed
    • Check DNS server connectivity
    • Verify DNS resolution

Take Action

  1. Resolve DNS Issues

    • Resolve DNS configuration issues
    • Restore correct DNS servers if needed
    • Update DNS configuration
  2. Strengthen DNS Security

    • Strengthen DNS security
    • Implement DNS monitoring
    • Review DNS policies

Best Practices for DNS Configuration Monitoring

Follow these best practices:

  • Monitor regularly: Monitor DNS configuration regularly
  • Set up alerts: Set up alerts for DNS changes
  • Review changes: Review DNS changes promptly
  • Test resolution: Test DNS resolution regularly
  • Document configuration: Document DNS configuration
  • Respond quickly: Respond to DNS issues quickly

FAQ: Common Questions About DNS Configuration Monitoring

How often should I check DNS configuration?

We recommend checking DNS configuration every hour or every few hours. DNS configuration changes are typically infrequent but important to detect quickly. More frequent checks provide better visibility but increase system load. Adjust frequency based on your network requirements and change frequency.

Can I test DNS resolution?

Yes, you can add DNS resolution tests using commands like nslookup or dig, though this requires additional monitoring setup. Test DNS resolution to verify connectivity and detect resolution issues. Regular resolution tests help maintain network connectivity.

What if DNS configuration changes?

You'll receive notifications when DNS configuration changes are detected. You can then verify whether changes are authorized or indicate a network issue. Review change details, check DNS server connectivity, verify change authorization, and take appropriate action. Quick response helps prevent connectivity issues.

Can I monitor DNS cache?

Yes, if using systemd-resolved, you can use systemd-resolve --statistics to see DNS cache statistics, though this requires root access. Monitor DNS cache to understand resolution performance and detect cache issues. Cache monitoring helps optimize DNS resolution.

How do I detect DNS resolution problems?

Detect DNS resolution problems by testing DNS resolution regularly, monitoring resolution times, checking DNS server connectivity, reviewing DNS logs, and using automated resolution tests. Resolution problems may indicate DNS server issues or network problems.

Can I track DNS changes over time?

Yes, Zuzia.app stores historical data, allowing you to track DNS changes over time. Review historical data to identify changes, compare current vs. historical DNS configs, detect unauthorized changes, and maintain audit trails. Historical data helps understand DNS evolution and detect issues.

How does AI help with DNS monitoring?

If you have Zuzia.app's full package, AI analysis can detect DNS patterns automatically, identify unusual changes, predict potential connectivity issues, suggest DNS improvements, and provide insights for improving network management. AI helps you understand DNS patterns and prevent issues proactively.

What if I have multiple DNS servers?

If you have multiple DNS servers, monitor all DNS servers, test resolution with each server, compare server performance, and configure failover appropriately. Multiple DNS servers provide redundancy and improve reliability. Monitor all servers to maintain DNS availability.

How do I prevent unauthorized DNS changes?

Prevent unauthorized DNS changes by restricting DNS configuration access, monitoring DNS changes continuously, enforcing network policies, reviewing DNS permissions regularly, and using automated monitoring. Multiple layers of security help prevent unauthorized changes.

Can I export DNS configuration data?

Yes, Zuzia.app allows you to export monitoring data. Export data for analysis, reporting, compliance, or network investigation. Use exported data to analyze DNS patterns, create network reports, and investigate DNS issues.

Note: The content above is part of our brainstorming and planning process. Not all described features are yet available in the current version of Zuzia.

If you'd like to achieve what's described in this article, please contact us – we'd be happy to work on it and tailor the solution to your needs.

In the meantime, we invite you to try out Zuzia's current features – server monitoring, SSL checks, task management, and many more.

We use cookies to ensure the proper functioning of our website.