The article shows the commands sequence to boot VM in a newly created tenant network and with public IP.
The commands below show how create appropriate resources and to boot a VM on Openstack. Checked on "train" release.
Create network:
openstack network create alexg-network
Create subnet in a newly created network:
openstack subnet create alexg-subnet --network alexg-network --subnet-range 10.100.0.0/28
Create router:
openstack router create alexg-router
Set external (public) network for the router:
openstack router set <router_ID> --external-gateway <public_network_ID>
Add subnet to the router interface:
openstack router add subnet <router_ID> <subnet_ID>
Create VM:
openstack server create --image <image_ID> --flavor <flavor_ID> --network <network_ID> <server_name>
Create floating IP:
openstack floating ip create <public_network_name>
Assign floating IP to created VM:
openstack server add floating ip <vm_instance_ID> <floating_IP>
Deletion of VM and resources:
openstack server delete <instance_ID>
openstack router remove subnet <router ID> <subnet ID>
openstack router delete <router ID>
openstack subnet delete <subnet ID>
openstack network delete <network ID>