one_dhcpd v0.2.1 OneDHCPD
The One Address DHCP Server!
This is a simple DHCP server for supplying IP addresses on point-to-point
Ethernet links. To use it, specify a static IPv4 address on the Ethernet
interface and then start the server up. OneDHCPD can supply an IPv4 address
for you by calling OneDHCPD.default_ip_address/1
that should minimize IP
conflicts with the user's network and other OneDHCPD servers. This is the
recommended approach.
Here's an example of using OneDHCPD with Nerves.Network:
iex> Nerves.Network.setup("usb0",
ipv4_address_method: :static,
ipv4_address: OneDHCPD.default_ip_address("usb0"),
ipv4_subnet_mask: OneDHCPD.default_subnet_mask())
:ok
iex> OneDHCPD.start_server("usb0")
{:ok, #PID<0, 220.0}
Link to this section Summary
Functions
Return the default server IP address that would be used for the specified interface
Return the subnet mask that goes along with default_ip_address/1
Start a DHCP server running on the specified interface. If one is already
running, {:error, {:already_started, pid}}
is returned
Stop a DHCP server
Link to this section Functions
default_ip_address(ifname)
default_ip_address(String.t()) :: :inet.ip4_address()
default_ip_address(String.t()) :: :inet.ip4_address()
Return the default server IP address that would be used for the specified interface.
default_subnet_mask()
default_subnet_mask() :: :inet.ip4_address()
default_subnet_mask() :: :inet.ip4_address()
Return the subnet mask that goes along with default_ip_address/1.
start_server(ifname, options \\ [])
start_server(String.t(), keyword()) :: DynamicSupervisor.on_start_child()
start_server(String.t(), keyword()) :: DynamicSupervisor.on_start_child()
Start a DHCP server running on the specified interface. If one is already
running, {:error, {:already_started, pid}}
is returned.
The server takes the following options:
:port
- the UDP port number to use (specify if debugging):subnet
- a /30 IP subnet to use
stop_server(ifname)
stop_server(String.t()) :: :ok | {:error, :not_found}
stop_server(String.t()) :: :ok | {:error, :not_found}
Stop a DHCP server.