NetBurner 3.5.6
PDF Version
Show Network Interfaces

Show Network Interfaces Application

Overview

This application demonstrates how to display IPv4 and IPv6 network interface information on embedded devices using the NetBurner NNDK (NetBurner Network Development Kit). The application provides both serial port output and web-based interface for viewing network configuration details.

Features

  • Dual Interface Display: Shows network information via both serial port and web interface
  • IPv4 Support: Displays IP address, subnet mask, DNS servers, gateway, and AutoIP configuration
  • IPv6 Support: Shows IPv6 addresses from various sources (Link Local, Router, DHCP, Static)
  • Link Status Monitoring: Reports Ethernet link status, speed, and duplex mode
  • Interactive Web Interface: Provides clickable links to test connectivity using different IP addresses
  • DHCP Lease Information: Shows lease timing details for DHCP-assigned addresses
  • WiFi Support: Optional WiFi functionality (configurable via compile-time flag)
Note
IPv6 routable addresses can take from a few seconds up to 30 seconds to appear. The amount of time is dependent on the particular IPv6 router response times.

Architecture

Core Files

  • **main.cpp**: Application entry point and main loop
  • **ip_util.h**: Header file declaring utility functions
  • **ip_util.cpp**: Implementation of network information display functions

Key Functions

Serial Port Functions

  • showIpAddressesSerial(): Displays comprehensive network information to serial console
  • showLinkStatus(): Shows Ethernet link status and connection details

Web Interface Functions

  • showIpAddressesWeb(): Generates HTML page with network information and interactive links

Utility Functions

  • getTimeStringFromSeconds(): Converts seconds to HH:MM:SS format
  • getLeaseTimeInfo(): Creates formatted DHCP lease time information
  • SourceName(): Returns human-readable names for IPv6 address sources

Configuration Options

Compile-Time Flags

// Enable WiFi support
#define USE_WIFI (1)
// Enable static IPv6 address testing
#define STATIC_IP6_TEST (1)
// Enable IPv6 support (typically defined globally)
#ifdef IPV6

Network Information Displayed

IPv4 Details

  • IP Address
  • Subnet Mask
  • Primary and Secondary DNS Servers
  • Default Gateway
  • AutoIP Address (if applicable)

IPv6 Details

  • All assigned IPv6 addresses with their sources:
    • Link Local: Automatically generated local addresses
    • Router: Addresses assigned via Router Advertisement
    • DHCP: Addresses from DHCPv6 server
    • Static: Manually configured addresses
  • DNS Server information with source attribution
  • DHCP lease timing (current time, renew time, rebind time)

Physical Interface Details

  • Interface number and name
  • MAC address
  • Link status (UP/DOWN)
  • Connection speed (10/100/1000 Mbps)
  • Duplex mode (Half/Full)

Usage

Serial Interface

  1. Connect to device via serial port
  2. Press any key when prompted
  3. View comprehensive network information in text format
  4. Repeat as needed to monitor changes

Web Interface

  1. Connect device to network
  2. Open web browser and navigate to device's IP address
  3. View formatted network information with interactive elements
  4. Click on IP address links to test connectivity

Web Interface Features

The web interface provides:

  • Formatted Tables: Clean presentation of network data
  • Interactive Links: Click any IP address to test connectivity
  • Real-time Information: Current network status and configuration
  • Multiple Protocol Support: Both IPv4 and IPv6 links where available

Technical Notes

IPv6 Address Assignment Timing

IPv6 routable addresses may take several seconds to appear after network connection, depending on:

  • Router response times
  • Network configuration
  • DHCP server response

DHCP Lease Management

The application tracks and displays:

  • Current system uptime
  • DHCP lease renewal time
  • DHCP lease rebind time

Memory and Performance

  • Uses efficient string formatting with fdprintf() for web output
  • Implements proper memory management for network interface iteration
  • Handles multiple network interfaces dynamically

Dependencies

  • NetBurner NNDK framework
  • Standard C/C++ libraries
  • Network interface management libraries
  • Optional: WiFi driver libraries (if WiFi support enabled)

Compilation

Ensure the following preprocessor directives are properly configured:

  • IPv6 support flag for IPv6 functionality
  • WiFi flags for wireless support
  • Static IP testing flags for development

Example Output

Serial Console

Interface 1, Ethernet 0, MAC: 00:03:F4:XX:XX:XX
IPv4 Addresses:
IP: 192.168.1.100
Mask: 255.255.255.0
DNS: 192.168.1.1
Gateway: 192.168.1.1
IPv6 Addresses:
Link Local: fe80::203:f4ff:fexx:xxxx/64
Router : 2001:db8::203:f4ff:fexx:xxxx/64
Link Status: UP, 100MB, Full Duplex

Web Interface

The web interface presents the same information in a formatted HTML table with clickable links for easy connectivity testing.

Use Cases

  • Network Diagnostics: Verify network configuration and connectivity
  • Development and Testing: Monitor network status during development
  • System Administration: Remote network interface management
  • Educational: Demonstrate IPv4/IPv6 coexistence and configuration

This application serves as both a practical network diagnostic tool and a reference implementation for network interface management in embedded systems.