openstack从0开始创建云主机

创建网络==>根据网络创建子网。
创建路由==>将路由和子网绑定。
创建安全组==>给安全组添加规则
创建浮动ip==>绑定虚机port-id

查看域
neutron availability-zone-list

创建网络
neutron net-create test_net --availability-zone-hint 

删除网络
neutron net-delete net_id

创建子网
neutron subnet-create test_net 192.168.10.0/24 --name test_subnet

删除子网
neutron subnet-delete subnet_id

创建路由
neutron router-create test_router

路由和网络绑定
neutron router-interface-add test_router test_subnet

路由和网络解绑 
在删除网络和路由时,要先进行解绑才可删除。
neutron router-interface-delete test_router test_subnet

创建安全组
neutron security-group-create test_group

删除安全组
neutron security-group-delete group_id

安全组放通规则
neutron security-group-rule-create test_group --direction ingress --ethertype IPv4 --remote-ip-prefix 0.0.0.0/0 --protocol none

查询availability-zone
nova availability-zone-list

查询az
nova service-list

查询flavor
nova flavor list

创建虚机(net-id为neutron subnet-show test-subnet看到的network id)
nova boot vm01 --flavor <flavor-id> --nic net-id=<network_id>  --block-device source=image,id=id,dest=volume,volumetype=<volume_type>,size=<volume_size>,shutdown=remove,bootindex=0 --availability-zone <test_zone> --security-groups <group_id>

查看浮动ip列表
neutron floatingip-list

查看浮动ip的详细信息
neutron floatingip-show <floatingip_uuid>

删除浮动ip
neutron floatingip-delete <floatingip_uuid>

创建浮动IP
neutron floatingip-create <ext_net_id>

虚拟机绑定浮动IP
neutron floatingip-associate <floatingip_uuid> --port-id <vm_port_id>

查询net-id
neutron net-show net-id

查询port id
neutron port-list | grep subnet-id

解绑
neutron floatingip-disassociate <floatingip_uuid>

创建volume
cinder create --name test-data --volume-type type

删除volume
cinder delete <volume-id>

强制删除
cinder force-delete <volume-id>

挂载volume
nova volume-attach <server-id> <volume-id> 

卸载volume
nova volume-detach <server-id> <volume-id> 

修改规格
nova resize <server-id>

vnc登录
nova get-vnc-console <server-id> novnc
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值