centos7-netconfig

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i centos7-netconfig

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

4.3 kB

Total Files

4

Last publish

Collaborators

  • fellipepaiva