dhcpd
TypeScript icon, indicating that this package has built-in type declarations

1.1.10 • Public • Published

dhcpd

Introduce

NodeJS pagckage for managing DHCPD

Installation

npm i --save dhcpd

!Important

Please notice this package will compile and install isc-dhcp(ver-4.4.2) to your machine(if no dhcpd binary found), therefore, make sure your compile tools' ready.

Simple Usage

Import the package
import {Dhcpd} from 'dhcpd'

or

const {Dhcpd} = require('dhcpd);
Setup DHCP server
//CIDR
const dhcpd = new Dhcpd({
	interface: 'en9',
	cidr: '172.0.0.1/24'
})
dhcpd.start().then(() => {
	console.log('DHCPD started')
}).catch(e => {
	console.error(e)
})
Or
const dhcpd = new Dhcpd({
	interface: 'en9',
	range: [
		"192.168.3.10", "192.168.3.99"
	],
	static: [
		{
			hostname: 'host1',
			macAddress: 'xx:xx:xx:xx:xx:xx',
			ipAddress: '192.168.3.2'
		}
	],
	network: '192.168.3.0',
	netmask: '255.255.255.0',
	router: '192.168.3.1',
	dns: ["8.8.8.8", "8.8.4.4"],
	broadcast: '192.168.3.255'
})
dhcpd.start().then(() => {
	console.log('DHCPD started')
}).catch(e => {
	console.error(e)
})

API

start()

(returns a promise) start the server

stop()

(returns a promise) stop the server

getInterface()

get DHCP service binding network interface

getRouter()

get router address

getNetMask()

get network mask

getNetwork()

get network address

getDNS()

get DNS address array

getBroadcast()

get broadcast address

License

MIT

Package Sidebar

Install

npm i dhcpd

Weekly Downloads

8

Version

1.1.10

License

MIT

Unpacked Size

15.3 MB

Total Files

762

Last publish

Collaborators

  • myq1991