1.0.1 • Published 6 years ago

centos7-netconfig v1.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

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