npm.io
1.0.1 • Published 8 years ago

centos7-netconfig

Licence
MIT
Version
1.0.1
Deps
0
Size
4 kB
Vulns
0
Weekly
0

Centos7 netconfig

Example:


let {
  isIP,
  listEths,
  updateEth
} = require('centos7-netconfig')

listEths()
.map(eth => readEth(eth))
/*
List like
[
  {
    "eth": "eth0",
    "isDhcp": false,
    "address": "186.232.183.4",
    "netmask": "26",
    "gateway": "186.232.183.1",
    "dns": "8.8.8.8"
  }
]
*/

listEths()
/*
[ 'eth0', ... ]
without local
*/
.map(eth => updateEth(eth, {
  address:   '10.2.20.12',
  netmask:   '255.255.255.0', /* or */ netmask: 24,
  gateway:   '10.2.20.254',
  dns:       '1.1.1.1',
  isDhcp:    false,
  isRestart: true /* default is false to restart interface */
}))

/* bonus 😉 */
isIP('10.2.20.12')

License

MIT

Keywords