OpenStack创建网络

openstack network create

选项参数/Default
--share 在项目之间共享网络Share the network between projects
--projectadmin,demo,service项目Owner's project (name or ID)
--external 设置为外部网络Set this network as an external network (external-netextension required)
--provider-network-typeLocal,Flat,VLAN,GRE,VXLAN,Geneve供应商网络类型The physical mechanism by which the virtual network is implemented. For example: flat, geneve, gre, local,vlan, vxlan.
--provider-physical-networkprovider物理网络Name of the physical network over which the virtual network is implemented
--provider-segment100VLAN&VXLAN网络隧道IDVLAN ID for VLAN networks or Tunnel ID for GENEVE/GRE/VXLAN networks
name 创建的网络名称<name>在命令结尾添加

openstack subnet create

选项参数/Default
--projectadmin,demo,service项目
--network 归属到网络(你创建网络)
--gateway192.168.100.1网关ip
--subnet-range192.168.100.0/24网络地址
name 创建的子网名称,<name>在命令结尾添加

题目:创建云主机网络 extnet,子网 extsubnet,虚拟机网段为 192.168.100.0/24,网关为 192.168.100.1,段 ID 默认写 100,网络使用 vlan 模式。

配置

openstack network create
--share 
--project admin 
--external 
--provider-physical-network provider 
--provider-network-type vlan 
--provider-segment 100 
extnet
----------------
openstack subnet create 
--project admin 
--network extnet 
--gateway 192.168.100.1 
--subnet-range 192.168.100.0/24 
extsubnet

答案

[root@controller ~]# openstack network create --share --project admin --external --provider-physical-network provider --provider-network-type vlan --provider-segment 100 extnet
[root@controller ~]# openstack subnet create --project admin --network extnet --gateway 192.168.100.1 --subnet-range 192.168.100.0/24 extsubnet

OpenStack创建虚拟机

openstack server create

选项参数/Default
--image镜像名镜像Create server boot disk from this image (name or ID)
--flavor主机类型名主机类型Create server with this flavor (name or ID)
--security-group安全组id安全组Security group to assign to this server (name or ID) (repeat option to set multiple groups)
--network内网id内网

题目

在搭建的 OpenStack 平台上,基于“cirros”镜像、1vCPU/1G /10G 的 flavor、extsubnet的网络,创建一台虚拟机 VM1,启动 VM1。

配置

openstack server create 
--flavor Fmin 
--image cirros 
--nic net-id=55893a71-e02d-497d-8427-de4190ed1da7 
--security-group 88745360-dc94-46a3-aa6e-ba5abc7f815b 
VM1

答案

[root@controller ~]# openstack server create --flavor Fmin --image cirros --nic net-id=55893a71-e02d-497d-8427-de4190ed1da7 --security-group 88745360-dc94-46a3-aa6e-ba5abc7f815b VM1
最后修改:2021 年 10 月 13 日
如果觉得我的文章对你有用,请随意赞赏