Skip to content

Instantly share code, notes, and snippets.

@jistr
Created November 24, 2015 16:23
Show Gist options
  • Save jistr/47ad5f86da7a9fdd4887 to your computer and use it in GitHub Desktop.
Save jistr/47ad5f86da7a9fdd4887 to your computer and use it in GitHub Desktop.
source overcloudrc
neutron net-create default
neutron subnet-create --name default --gateway 172.20.0.1 default 172.20.0.0/24
neutron net-create nova --router:external --provider:network_type vlan --provider:physical_network datacentre --provider:segmentation_id 10
neutron subnet-create --name nova --enable_dhcp=False --allocation-pool=start=172.16.10.100,end=172.16.10.250 --gateway=172.16.10.251 nova 172.16.10.0/24
neutron subnet-update --dns-nameserver 10.34.32.1 nova
neutron security-group-rule-create default --ethertype IPv4 --direction ingress
neutron router-create default_router
neutron router-gateway-set default_router nova
default_subnet_id=$(neutron subnet-list | grep '| default ' | awk '{ print $2; }')
neutron router-interface-add default_router $default_subnet_id
# verify that the default_router owns the gateway IP of the default subnet
neutron router-port-list default_router | grep 172.20.0.1
glance image-create --name fedora21 --disk-format qcow2 --container-format bare --is-public True --location 'http://download.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/Images/x86_64/Fedora-Cloud-Base-20141203-21.x86_64.qcow2'
nova flavor-create m1.notsotiny auto 512 3 1
nova keypair-add undercloud --pub-key ~/.ssh/id_rsa.pub
default_net_id=$(neutron net-list | grep '| default ' | awk '{ print $2; }')
nova boot testvm --flavor m1.notsotiny --image fedora21 --key-name undercloud --security-groups default --nic net-id=$default_net_id
neutron floatingip-create nova
floating_ip_id=$(neutron floatingip-list | grep 172.16.10.101 | awk '{ print $2; }')
testvm_ip=$(nova show testvm | grep 'default network' | awk '{ print $5; }')
testvm_port_id=$(neutron port-list | grep "$testvm_ip" | awk '{ print $2; }')
neutron floatingip-associate $floating_ip_id $testvm_port_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment