Skip to content

Instantly share code, notes, and snippets.

@uksysadmin
Created October 30, 2014 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uksysadmin/95266128a14b2b7b4867 to your computer and use it in GitHub Desktop.
Save uksysadmin/95266128a14b2b7b4867 to your computer and use it in GitHub Desktop.
cloud-init multi-nic
1. Create a file called 'multi-nic':
#!/bin/bash
echo "Running cloud-init script" > /tmp/cloud-init.log
/sbin/ifconfig -a | /usr/bin/awk '/eth.*Ethernet/ {print $1}' | while read E; do /usr/bin/sudo /sbin/dhclient $E; done
2. When booting an image:
nova boot --image ubuntu-trusty --flavor 2 --key-name mykey --nic net-id=network1 --nic net-id=network2 --user-data ./multi-nic myinstance1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment