Skip to main content
Version: v3.9.0

Network

The network interface manager detects the host IP and primary interface used for agent identity and networking features. It runs an initial detection at start and refreshes periodically.

Code: internal/network/

Purpose​

  • Select IOFog/Edgelet network interface per config rules
  • Track current IP address and hostname
  • Provide gateway IP helpers for DNS resolver scopes
  • Periodic refresh (60s while IP unset, 30 minutes when IP is known)

Dependencies​

Depends onReason
configInterface selection preferences
Used byReason
supervisorStarted before Field Agent
dnsresolverGatewayIPForScope() for listener bind addresses
processmanagerNetwork setup for workloads
runtimeapiStatus/info enrichment

Lifecycle​

Start​

  1. Sync tier. Up to 5 UpdateNetworkInterface() attempts with 200ms spacing (≤~3s blocking)
  2. On IP found: start periodic refresh goroutine; return nil
  3. On sync failure: log WARN, leave empty IP, return nil (degraded continue. Supervisor and Field Agent proceed)
  4. Async recovery. When sync tier leaves IP empty, a background goroutine runs up to 10 more attempts (15 total) with exponential backoff (30s base, double each loop, 8 min cap)
  5. Periodic refresh. 60s while IP empty; 30 min when IP is set; errors are logged and the same goroutine continues (no respawn)

Stop​

Cancel context (stops periodic update and async recovery).

Key APIs​

FunctionRole
GetCurrentIPAddress()Agent IP for status
GetNetworkInterfaceInfo()Interface + address struct
GatewayIPForScopeUsed by embedded DNS

Configuration​

Interface selection driven by config fields (controller-facing IP discovery). See internal/config for NetworkInterface related settings in default profiles.

External APIs​

No dedicated EdgeletAPI routes; IP/interface appear in system status/info payloads.

Observability​

  • Log module: "Network Interface Manager"
  • Errors on failed interface update logged at start

Failure modes​

SymptomTypical cause
Empty IP at boot (unable to retrieve ip address)No usable IPv4 during sync tier; agent continues in degraded mode and retries async + periodic
IP appears after boot delayFar-edge link or DHCP late; async recovery or 60s periodic picks up address
Wrong agent IP on controllerInterface selection mismatch on multi-homed host
DNS bind failuresGateway IP not available for scope

Code map​

FileRole
manager.goDetection, periodic update, gateway helpers

Related: DNS resolver, Status reporter.

Group 3See anything wrong with the document? Help us improve it!