NetBurner 3.5.6
PDF Version
PPP

PPP Server Application

Overview

This NetBurner embedded application demonstrates how to create and manage Point-to-Point Protocol (PPP) server instances. The PPP protocol enables network connectivity over serial connections, supporting both direct serial connections and modem-based connections for TCP/IP networking.

Features

  • Dual PPP Server Support: Creates two independent PPP server instances (PPP1 and PPP2)
  • Flexible Connection Types: Supports both direct serial and modem-based PPP connections
  • Authentication System: Includes customizable username/password authentication
  • Network Integration: Full TCP/IP stack integration with HTTP server support
  • Interactive Command Interface: Runtime control and monitoring via serial console
  • Network Diagnostics: Built-in ping functionality and connection status monitoring
  • IPv4/IPv6 Support: Comprehensive IP address management and display utilities

Hardware Requirements

  • NetBurner embedded device with serial port support
  • Serial cable or modem connection
  • Host computer with PPP client capabilities

Connection Types

Direct Connection

  • Uses only a serial cable connection between PC and NetBurner device
  • Immediately begins PPP negotiations with the host/client
  • No modem initialization required
  • Ideal for direct PC-to-NetBurner communication

Modem Connection

  • Uses a modem between the PC and NetBurner device
  • Sends AT commands for modem initialization before PPP negotiation
  • Supports dial-up and answer modes
  • Handles carrier detection and modem state management

Configuration

Default Settings

  • Serial Port: Port 1 (configurable via SERIALPORT_TO_USE)
  • Baud Rate: 19,200 bps (configurable via BAUD_TO_USE)
  • NetBurner IP: 192.1.1.1
  • Gateway IP: 192.1.1.2
  • DNS Server: 8.8.8.8

Network Configuration Example

pppServerObj.ip4.addr = AsciiToIp4("192.1.1.1");
pppServerObj.ip4.gate = AsciiToIp4("192.1.1.2");
pppServerObj.OfferedDNSAddress = AsciiToIp4("8.8.8.8");
I4Record ip4
IPv4 configuration for "this" interface, see config_netobj.h for details.
Definition netinterface.h:247
IPADDR4 AsciiToIp4(const char *p)
Convert an ASCII IPv4 string to an IP address.

Authentication

The application includes a sample authentication function test_Auth() that currently accepts any username/password combination. For production use, replace this with proper credential validation:

int test_Auth(const char *name, const char *pass)
{
printf("Auth %s:%s\r\n", name, pass);
return 1; // Always returns success - modify for real authentication
}

Interactive Commands

Once the PPP connection is established, the application provides an interactive menu accessible via serial console:

  • C - Show network counters and statistics
  • H - Force hangup/disconnect the PPP session
  • P - Ping the remote host to test connectivity
  • S - Show detailed PPP connection status
  • X - Exit the application
  • ? - Display help menu
  • F - Show interface information (debug builds)
  • L - Set log level (debug builds)

PPP State Machine

The application monitors and displays various PPP connection states:

State Description
eClosed Connection closed
eInitializingModem Initializing modem (modem connections only)
eDialing Dialing remote number
eWait4Ring Waiting for incoming call
eAnswering Answering incoming call
eWaitForTrain Waiting for carrier signal
eLCPNegotiate Link Control Protocol negotiation
ePAPAuthenticate Password Authentication Protocol
eNCPNegotiate Network Control Protocol negotiation
eOpen Connection established and active
eClosing Connection closing

Error Handling

The application includes error handling for common PPP issues:

Error Code Description
ERR_PPP_ALREADY_OPEN PPP interface already active
ERR_PPP_NO_DIALTONE No dial tone detected
ERR_PPP_NO_ANSWER No answer from remote
ERR_PPP_BUSY Remote line busy
ERR_PPP_FAIL General PPP failure
ERR_PPP_PASSFAIL Authentication failure
ERR_PPP_LOSTCARRIER Lost carrier signal
ERR_PPP_NO_MODEM Modem not responding
ERR_PPP_LCP_FAILED LCP negotiation failed

IP Address Utilities

The application includes IP address management utilities:

IPv4 Features

  • Display IP, subnet mask, gateway, and DNS server information
  • Interface MAC address display
  • Link status monitoring (speed and duplex)
  • Web-based interface display with clickable links

IPv6 Features (when enabled)

  • Multiple address assignment support (Link Local, Router, DHCP, Static)
  • DHCP lease time information with renewal/rebind timers
  • DNS server information display
  • Prefix length and source identification

Web Interface

The application includes a built-in HTTP server that provides:

  • Web-based display of all network interface information
  • Clickable links to test IPv4 and IPv6 connectivity
  • Real-time interface status and configuration display
  • DHCP lease time information for IPv6 addresses

File Structure

project/
main.cpp # Main application logic and PPP server management
ip_util.cpp # IP address utility functions
ip_util.h # IP utility function declarations

Build Requirements

  • NetBurner development environment
  • Serial communication support libraries
  • TCP/IP stack libraries
  • HTTP server support

Usage Instructions

  1. Initial Setup
    • Connect NetBurner device to host via serial cable or modem
    • Configure serial port settings (default: Port 1, 19200 baud)
    • Build and deploy application to NetBurner device
  2. Starting PPP Connection
    • Application automatically initializes network stack
    • Starts HTTP server on port 80
    • Waits for network initialization
    • Opens serial port and starts PPP server
  3. Host Configuration
    • Configure PPP client on host computer
    • Set up serial connection with matching baud rate
    • Initiate PPP connection from host
  4. Testing Connection
    • Use interactive menu commands to monitor connection
    • Test connectivity with built-in ping function
    • Access web interface at configured IP address

Testing PPP Connections

Recommended testing approach:

  1. Create a PPP interface on a host computer
  2. Connect via serial cable to the NetBurner device
  3. Configure host PPP client with appropriate settings
  4. Establish direct PPP connection
  5. Use interactive commands to monitor connection status
  6. Verify network connectivity using built-in ping function
  7. Test web interface accessibility

Development Notes

Production Considerations

  • Replace sample authentication function with secure credential checking
  • Disable system diagnostics in production builds
  • Configure appropriate IP addresses for your network topology
  • Implement connection retry logic for unreliable connections
  • Monitor and log PPP events for troubleshooting

Debug Features

  • System diagnostics enabled for debugging
  • Comprehensive logging and error reporting
  • Interactive command interface for real-time monitoring

Network Integration

  • Full TCP/IP stack support
  • HTTP server integration
  • Multi-interface support with status monitoring

Troubleshooting

Common Issues

  1. Connection Fails: Check serial cable connections and baud rate settings
  2. Authentication Errors: Verify username/password if custom authentication is implemented
  3. No Network Access: Confirm IP address configuration and routing
  4. Modem Issues: Check AT command compatibility and modem initialization

Debug Commands

  • Use 'S' command to check PPP state
  • Use 'C' command to view network counters
  • Use 'P' command to test connectivity
  • Check web interface for detailed network information