Skip to content

Instantly share code, notes, and snippets.

@uksysadmin
uksysadmin / router.sh
Created April 3, 2017 07:53
router.sh
#!/bin/sh
# The interface that has outbound connectivity to the Internet
GATEWAY_INTERFACE=p2p1
# What network interfaces do you want to allow routing out via this router
INTERNAL_INTERFACES="p4p1.254
p4p1.239
p4p1.236"
@uksysadmin
uksysadmin / gist:95266128a14b2b7b4867
Created October 30, 2014 08:05
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

Keybase proof

I hereby claim:

  • I am uksysadmin on github.
  • I am kevinjackson (https://keybase.io/kevinjackson) on keybase.
  • I have a public key whose fingerprint is 10E6 5AA4 2242 99B7 8F6E F1F7 0B76 3680 5120 522E

To claim this, I am signing this object:

@uksysadmin
uksysadmin / gist:44a31ba70af075d52065
Created June 23, 2014 20:27
Awful bash-fu keystone user/tenant list
function ksuserlist() {
if [ -z "$1" ]
then
P="\ "
else
P=$1
fi
keystone user-list | awk '/(True|False)/ { print $4 }' | while read U; do user=$(echo $U); keystone user-get $U | echo $user $(awk '/tenantId/ { print $4 }') | egrep "$P"; done
}