Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

SolinkCorp/network-config

 
 

Repository files navigation

Archived

This repo was a private fork of network-config used by fsbot, but it is no longer used as of PR #112. If you're reading this in 2025, it's probably safe to delete this repo.

network-config Deps Version Version Downloads

Network configuration for NodeJS. Only used & tested on Debian

Setup

npm install network-config

Usage

List active interfaces

var network = require('network-config');

network.interfaces(function(err, interfaces){
  /* interfaces should be something like:

  [{
    name: 'eth0',
    ip: '1.1.1.77',
    netmask: '1.1.1.0',
    mac: 'aa:aa:aa:aa:aa:aa',
    gateway: '10.10.10.1'
   },
   { ... }, { ... }]
  */
 
});

Update interface (static)

network.configure('eth0', {
    ip: 'x.x.x.x',
    netmask:'x.x.x.x',
    broadcast: 'x.x.x.x',
    gateway: 'x.x.x.x',
    restart: true // (default) restart networking service right away
}, function(err){

})

Update interface (dhcp)

network.configure('eth0', {
    dhcp: true,
    restart: false // don't restart networking service
}, function(err){
});

About

Network configuration for NodeJS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.5%
  • Shell 2.5%