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:
- GetHostByName() - General DNS resolution (returns first available IP address)
- GetHostByName() with IPv4 - Specific IPv4 address resolution
- 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:
- Active network connection - Physical link must be established
- Valid IP configuration - IP address, subnet mask, and gateway
- DNS server configuration - Either from DHCP or static configuration
- Internet access - Required to reach external DNS servers
Usage Instructions
Setup
- Connect your NetBurner device to the network
- Start MTTTY (NetBurner's terminal program)
- Connect to the debug serial port
- Load and run the DNS client application
Operation
- The application will display the network interface status
- If the network is properly configured, you'll be prompted to enter a domain name
- Type a domain name (e.g.,
www.netburner.com
) and press Enter
- 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
- 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
- DNS_TIMEOUT errors
- Check internet connectivity
- Verify DNS server is reachable
- Check firewall settings
- 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
- Initialize network stack
- Enable system diagnostics
- Wait for active network (up to 10 seconds)
- Check each network interface for DNS capability
- If capable interface found, enter interactive mode
- Accept domain names from user and perform DNS lookups
- 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.