title: How to set network interface as static or DHCP programmatically (script, node or c)?
body: <p>I am developing an embedded system accessed through a node server running express.js. One of the functions that I'm trying to provide our users is the ability to configure the network interfaces via a web UI/REST call, without the need to drop down to a SSH session.</p>
  
  <p>Here's my question: Is there a programmatic way of setting an interface as DHCP or static? Short of editing /etc/network/interfaces, I haven't been able to google or stackoverflow search a programmatic method. Can anyone recommend a direction and/or best practices for doing this?</p>
  
  <p>p.s., I should mention that as part of my change, I would have the necessary configuration parameters (e.g., address, netmask, gateway) and, of course, I would preface any changes with ifconfig  down.</p>