Skip to content

TascSystems/network-config

 
 

Repository files navigation

network-config Deps Version Version

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'    
}, function(err){

})

Update interface (dhcp) (coming soon)

network.configure('eth0', {
    dhcp: true
}, function(err){
});

About

Network configuration for NodeJS

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 95.8%
  • Shell 4.2%