cloudbase/cloudbase-init — pull request #13 by boris-deschenes (2013-07-25 14:40:07+00:00)
Title: support for dual NIC

We operate a public cloud here at iweb.com (based on openstack), we use cloudinit for linux and now for windows with this awesome cloudbase-init project.

We spawn all VMs with 2 NICs (a WAN network and a LAN network). So what I did is modified the windows networkconfig plugin so that it operates like it did before if you have onlyone NIC, but will go on and configure a second NIC if it's found.

1. If a NIC is specified in the config it will only configure this one
2. If no NIC are specified in the config, it will get a list of available network adapters
3. if the network adapter list contains one NIC, it will be configured (just like before)
4. if the network adapter list contains a second NIC, this one will also get configured (and static route added)

The second NIC defined in the debian_network_config must be defined with these 5 lines:

iface eth1 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
up route add -net xxx.xxx.xx.xxx netmask xxx.xxx.xxx.xxx gw xxx.xxx.xxx.xxx

the route defined in the last line will also get configured in the system as a static route

I tested this with 1 NIC and 2 NICs and it works fine