Nerves.Networking v0.6.0 Nerves.Networking.Subsystem

Implements an ethernet subsystem based on using the ip and udhcpc CLI. Designed for embedded systems to provide simple ipv4 ethernet access.

This doesn’t rely on using udhcpc as a daemon, but instead simply invokes it to perform low level configuration, assuming the Nerves.Networking module handles daemon-level functionality like DHCP renewal, etc.

Major Limitations:

  • does not yet support ipv6
  • horrible error checking for low level commands (assumes they work)

Summary

Functions

add an address to the interface

Makes a dhcp request on the specified interface with optional hostname, and returns Dict with standardized keys for the result of the DHCP request

clear the list of addresses for the interface

Initialize the ethernet subsystem

Set the link state of an interface up or down

Return the MAC address of the specified interface

set resolver configuration

set the router (default gateway) for the inteface

Types

Functions

add_address(interface, ip, mask)

add an address to the interface

dhcp_request(interface, host, retries)

Specs

dhcp_request(interface, String.t, String.t) :: Dict.t

Makes a dhcp request on the specified interface with optional hostname, and returns Dict with standardized keys for the result of the DHCP request.

Uses udhcpc in non-daemon mode to handle dhcp.

flush_addresses(interface)

Specs

flush_addresses(interface) :: :ok

clear the list of addresses for the interface

initialize()

Specs

initialize :: :ok | {:error, reason}

Initialize the ethernet subsystem

mac_address(interface)

Specs

mac_address(interface) :: String.t

Return the MAC address of the specified interface

resolv_dns(dns)
set_resolv_conf(dns, domain \\ nil)

Specs

set_resolv_conf(String.t, String.t) :: :ok

set resolver configuration

set_router(interface, router)

Specs

set_router(interface, ip_address) :: :ok

set the router (default gateway) for the inteface