G.8 Before a VM Instance has been Booted: Port Security
# neutron port-create –-name <Port Name> –-port-security-enabled=false --fixed-ip subnet-id=$(neutron subnet-show –f value –F id <Subnet name>),ip_address=<Target IP address> $(neutron net-show –f value –F id <Network name>)
where the bolded items have the following meaning:
- <Port Name>
This is effectively a string alias for the port that is useful when trying to locate the ID for the port but the –-name <Port Name> portion of the command is completely optional.
- <Subnet name>
The name of the subnet to which the port should be added.
- <Target IP address>
The unique IP address to be associated with the port.
- <Network Name>
The name of the network with which the port should be associated.
# neutron port-create –name foo –-port-security-enabled=false --fixed-ip subnet-id=$(neutron subnet-show –f value –F id ext-subnet),ip_address=10.133.97.133 $(neutron net-show –f value –F id ext-net)
# nova boot --flavor m1.xlarge --image testVMimage --nic port-id=$(neutron port-show –f value –F id <Port Name>) testvm3
Where the flavor, image, and VM instance name values need to be replaced by
values appropriate for your VM. If the port to be associated with the VM instance is not
named, then you need to obtain the port’s ID using the neutron port-list command and
replace the $(neutron port-show –f value –F id <Port Name>)
sequence in the above command with the port’s ID value.