1.0.2 • Published 3 years ago

dnsmasq-dhcp v1.0.2

Weekly downloads
-
License
BSD
Repository
github
Last release
3 years ago

dnsmasq-dhcp

A library to start and stop a lightweight DHCP server based on dnsmasq. This library does not use any config files, it only passes command line arguments. So you can start as many instances of dnsmasq as you have interfaces.

Installation

npm i dnsmasq-dhcp

Usage

const DHCP = require('dnsmasq-dhcp');

let dhcpServer = new DHCP(options);

dhcpServer.start(result => {
  console.log(`Server started successfully: ${result} pid: ${dhcpServer.pid}`);
}).catch(err => {
  console.error(`Server failed to start: "${err.result.stderr}", errorCode=${err.result.code}`);
});

Options

OptionTypeDescriptiondefaultrequired
interfaceStringNetwork Interface DHCP listens onN/Ayes
beginIPStringFirst IP in DHCP blockN/Ayes
endIPStringLast IP in DHCP blockN/Ayes
netmaskStringNetwork mask255.255.255.0default
leaseLengthStringLength that IPs are leased24hdefault
portIntegerPort that dnsmasq listens on for DNS queries5353default
authoritativeBooleanDHCP server is authoritative on this networktruedefault
listenAddressStringIP Address that DHCP server is listening on127.0.0.1default
domainStringDomain for DHCP serverN/Ano
pidFileStringPath to pid file output by dnsmasq/tmp/{uuid}.piddefault
hostsSpecArrayAn array of host spec definitions for static assignments[]default

Host spec definition

FieldTypeDescriptionrequired
macAddrStringMAC address of client device for static assignmentyes
ipStringIP address to be statically assigned to client deviceyes
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago