VLAN Example Application
Overview
This NetBurner application demonstrates the creation and management of multiple VLAN (Virtual Local Area Network) interfaces on a single Ethernet port. The application creates three different VLAN interfaces with different configurations and provides both web-based and serial console interfaces for monitoring network status.
To build this example MULTIHOME must be enabled in predef.h. Rather than change the file in \nburn\nbrtos\include, use the override feature and add predef.h to your project.
- Ethernet 0, DHCP, VLAN ID 1
- Ethernet 0, DHCP, VLAN ID 2
- Ethernet 0, Static IP, VLAN ID 10
The serial port interface provides an interactive menu to display interface and VLAN information, as well as other system parameters.
Features
- Multiple VLAN Interface Creation: Creates 3 VLAN interfaces on Ethernet 0
- Mixed Configuration Support: Supports both DHCP and static IP configurations
- Interactive Serial Menu: Command-line interface for network diagnostics
- Web Interface: HTTP server displaying network interface information
- IPv4 and IPv6 Support: Comprehensive IP address management and display
- Real-time Network Monitoring: Link status, ARP tables, and interface statistics
VLAN Configuration
The application automatically creates the following VLAN interfaces:
- VLAN ID 1: Ethernet 0 with DHCP configuration
- VLAN ID 2: Ethernet 0 with DHCP configuration
- VLAN ID 10: Ethernet 0 with static IP (198.18.1.20/16)
Prerequisites
- MULTIHOME Support: Must be enabled in
predef.h
- NetBurner Platform: Compatible NetBurner hardware platform
- Network Infrastructure: VLAN-capable switch or router
Enabling MULTIHOME
To enable MULTIHOME support:
- Create a local
predef.h file in your project directory
- Add
#define MULTIHOME to enable multiple interface support
- Include any other required preprocessor definitions
This approach uses the NetBurner override feature instead of modifying the system files directly.
Serial Console Commands
The application provides an interactive serial console with the following commands:
| Command | Description |
A | Show ARP table |
C | Show network counters |
E | Dump Ethernet information |
I | Show all network interfaces and IP addresses |
W | Display system tick count and uptime |
? | Show help menu |
1-9 <vlan_id> | Set VLAN tag on interface (1-9) |
Example Usage
I # Show all interfaces
1 100 # Set interface 1 to VLAN 100
W # Show system uptime
Address Resolution Protocol packet structure.
Definition arp.h:1035
Network Interface Information
The application displays comprehensive network information including:
IPv4 Information
- IP Address
- Subnet Mask
- DNS Servers (Primary and Secondary)
- Gateway Address
- Auto-IP Address
IPv6 Information (if enabled)
- Link-local addresses
- Router-assigned addresses
- DHCP-assigned addresses
- Static addresses
- DNS servers with source information
- DHCP lease timing information
Physical Interface Details
- MAC Address
- Link Status (UP/DOWN)
- Link Speed (MB)
- Duplex Mode (Full/Half)
Web Interface
The application includes an HTTP server that provides:
- Network Interface Overview: All active interfaces and their configurations
- Clickable IP Links: Direct links to access the device via different IP addresses
- Real-time Status: Current network configuration and lease information
- IPv6 Support: Complete IPv6 address information with source tracking
Access the web interface by navigating to any of the device's IP addresses in a web browser.
File Structure
project/
main.cpp # Main application logic and VLAN setup
ip_util.cpp # IP address utility functions
ip_util.h # Header file for IP utilities
index.html # Web interface homepage
predef.h # Project-specific preprocessor definitions
Key Functions
VLAN Management
AddVlanInterface(): Creates new VLAN interface
SetVlan(): Configures VLAN tag on existing interface
Network Information Display
showIpAddressesSerial(): Displays interface info on serial console
showIpAddressesWeb(): Generates web page with interface information
showLinkStatus(): Shows physical link status
Utility Functions
getTimeStringFromSeconds(): Converts seconds to HH:MM:SS format
getLeaseTimeInfo(): Formats DHCP lease timing information
SourceName(): Returns human-readable IPv6 address source names
Building and Deployment
- Setup Project: Create new NetBurner project
- Enable MULTIHOME: Add
predef.h with #define MULTIHOME
- Add Source Files: Include all
.cpp and .h files
- Build: Compile using NetBurner development tools
- Deploy: Flash to NetBurner hardware
Network Setup Requirements
- VLAN-Capable Switch: Network infrastructure must support VLAN tagging
- Proper VLAN Configuration: Switch ports must be configured for appropriate VLAN IDs
- IP Address Management: Ensure IP ranges don't conflict across VLANs
Troubleshooting
Common Issues
- MULTIHOME Not Enabled: Verify
predef.h contains #define MULTIHOME
- Link Status Down: Check physical connections and cable
- DHCP Not Working: Verify DHCP server availability on VLANs
- Web Interface Inaccessible: Check IP address configuration and routing
Debug Commands
Use the serial console commands to diagnose issues:
E - Check Ethernet hardware status
I - Verify interface configuration
C - Review network counters for errors
A - Check ARP table for connectivity
Platform Compatibility
This application is designed for NetBurner embedded platforms with Ethernet capability. It supports both single and dual Ethernet configurations (commented code shows dual-port setup for platforms like the 54417).
IPv6 Support
IPv6 functionality is conditionally compiled based on the IPV6 preprocessor definition. When enabled, the application provides:
- Multiple IPv6 address assignment methods
- DHCP v6 lease management
- Router advertisement processing
- Comprehensive IPv6 status reporting