The package can be installed by adding dhcp_server
to your list of dependencies in mix.exs
:
def deps do
[{:dhcp_server, "~> 0.7"}]
end
iex(1)> {:ok, dhcp_server} = DHCPServer.start_link("usb0", [])
{:ok, dhcp_server}
# Plug device in or something?
# Get ip address?
# Do some local work?
# Profit?
iex(2)> DHCPServer.stop(dhcp_server)
:ok
def start(_type, _args) do
dhcp_options = [
gateway: "192.168.254.1",
netmask: "255.255.255.0",
range: {"192.168.254.10", "192.168.254.99"},
domain_servers: ["192.168.254.1"]
]
children = [
{DHCPServer, ["eth0", dhcp_options]}
]
opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
end
This project is originally located here and is licensed under GPLv2. See COPYING for more details.