Created
December 11, 2018 14:57
-
-
Save boina-n/eaa9d811ccba177735bd3972ccdcb61a to your computer and use it in GitHub Desktop.
How to attach ports to a machine on openstack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
primary_subnet=PRD_APPLIS | |
secondary_subnet=ADM_APPLIS | |
primary_network=port_opsman01_I_PRD_APPLIS | |
secondary_network=port_opsman01_I_ADM_APPLIS | |
virtmachine=opsman01 | |
#show a Default port | |
neutron port-show $primary_network | |
#show a Second port | |
neutron port-show $secondary_network | |
#Create ports | |
neutron port-create --name $primary_network --fixed-ip subnet_id=$primary_subnet,ip_address=10.110.148.10 $primary_subnet | |
neutron port-create --name $secondary_network --fixed-ip subnet_id=$secondary_subnet,ip_address=10.233.122.10 $secondary_subnet | |
# Get the network IDs | |
default_network_id=$(neutron port-show $primary_network -f json | jq '.id' |tr -d '"') | |
second_network_id=$(neutron port-show $secondary_network -f json | jq '.id' |tr -d '"') | |
# Attach ports to the VM | |
nova interface-attach --port-id=$default_network_id $virtmachine | |
nova interface-attach --port-id=$second_network_id $virtmachine | |
# start the vm | |
nova start $virtmachine | |
# You also probably need to set the openstack security group to the vm. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment