NetBurner 3.5.6
PDF Version
DNS Client

DNS Client Application

Overview

This is a DNS (Domain Name System) client example application for NetBurner embedded devices. The application demonstrates how to resolve domain names to IP addresses using both IPv4 and IPv6 protocols.

Features

  • Dual-stack DNS resolution: Supports both IPv4 and IPv6 address resolution
  • Interactive interface: Prompts user for domain names to resolve via serial terminal
  • Network interface validation: Automatically checks network configuration before attempting DNS queries
  • Comprehensive error handling: Provides detailed error messages for various DNS failure scenarios
  • Real-time network status: Displays current network interface status and configuration

Application Functions

Core DNS Functions

The application uses three main NetBurner DNS functions:

  1. GetHostByName() - General DNS resolution (returns first available IP address)
  2. GetHostByName() with IPv4 - Specific IPv4 address resolution
  3. GetHostByName() with IPv6 - Specific IPv6 address resolution (AAAA records)

Key Components

ExecuteDNSRequest(char *name)

Performs DNS lookups for a given domain name using all three resolution methods:

  • General IP resolution
  • IPv4-specific resolution
  • IPv6-specific resolution (when not compiled with IPV4ONLY flag)

CanInterfaceDoDNS(int ifNumber)

Validates that a network interface has the required configuration for DNS:

  • Active network link
  • Configured DNS server IP address
  • Configured network gateway

UserMain(void *pd)

Main application loop that:

  • Initializes the network stack
  • Waits for active network connection
  • Validates network interface capabilities
  • Provides interactive DNS lookup interface

Prerequisites

For the application to function properly, your NetBurner device must have:

  1. Active network connection - Physical link must be established
  2. Valid IP configuration - IP address, subnet mask, and gateway
  3. DNS server configuration - Either from DHCP or static configuration
  4. Internet access - Required to reach external DNS servers

Usage Instructions

Setup

  1. Connect your NetBurner device to the network
  2. Start MTTTY (NetBurner's terminal program)
  3. Connect to the debug serial port
  4. Load and run the DNS client application

Operation

  1. The application will display the network interface status
  2. If the network is properly configured, you'll be prompted to enter a domain name
  3. Type a domain name (e.g., www.netburner.com) and press Enter
  4. The application will display the resolved IP addresses for IPv4 and IPv6 (if available)

Example Domain Names to Test

The application suggests several interesting test cases:

  • google.com - Resolves both IPv4 and IPv6 addresses
  • ipv6.vm1.test-ipv6.com - IPv6-only resolution
  • www.netburner.com - NetBurner's website (recommended test)

Error Handling

The application provides specific error messages for common DNS failures:

  • DNS_TIMEOUT - DNS server did not respond within 5 seconds
  • DNS_NOSUCHNAME - Domain name does not exist
  • Other DNS errors - Displays error code for debugging

Network Interface Diagnostics

The application performs comprehensive network diagnostics:

Interface[eth0]:
Link UP
Has a DNS address (8.8.8.8)
Has a Gateway address (192.168.1.1)
This interface is capable of doing DNS!

If any component is missing, it will be flagged as a problem.

Compilation Options

  • IPV4ONLY - Define this flag to disable IPv6 functionality and compile for IPv4-only environments

Technical Details

  • DNS timeout: 5 seconds per query
  • Buffer size: 128 characters for domain name input
  • Network wait: Up to 10 seconds for network interface activation
  • System diagnostics: Enabled for debugging (should be disabled in production)

Troubleshooting

Common Issues

  1. Found no interface capable of doing DNS
    • Check physical network connection
    • Verify IP configuration (DHCP or static)
    • Ensure DNS server is configured
    • Confirm gateway is set
  2. DNS_TIMEOUT errors
    • Check internet connectivity
    • Verify DNS server is reachable
    • Check firewall settings
  3. DNS_NOSUCHNAME errors
    • Verify domain name spelling
    • Try a known good domain like google.com

Network Configuration

Ensure your NetBurner device has proper network configuration:

  • Valid IP address
  • Correct subnet mask
  • Proper gateway configuration
  • DNS server IP address (often provided by DHCP)

Application Flow

  1. Initialize network stack
  2. Enable system diagnostics
  3. Wait for active network (up to 10 seconds)
  4. Check each network interface for DNS capability
  5. If capable interface found, enter interactive mode
  6. Accept domain names from user and perform DNS lookups
  7. Display results and repeat

This application serves as both a functional DNS client and a diagnostic tool for network connectivity issues on NetBurner embedded devices.