创建第一台虚拟机
source /etc/keystone/admin-openrc
创建网络
openstack network create --share --external
--provider-physical-network provider
--provider-network-type flat flat
创建子网
openstack subnet create --network flat
--allocation-pool start=192.168.56.100,end=192.168.56.200
--dns-nameserver 114.114.114.114 --gateway 192.168.56.2
--subnet-range 192.168.56.0/24 flat
DHCP会使用第一个地址192.168.56.100 方法: ip netns li 会出现命令空间 比如qdhcp-46e702c9-8df5-4343-a943-9bdc3ae8761c 查看ip qdhcp-46e702c9-8df5-4343-a943-9bdc3ae8761c 查看 ip netns exec qdhcp-46e702c9-8df5-4343-a943-9bdc3ae8761c ifconfig 就会出现DHCP的地址
openstack subnet list
创建一个key source /etc/keystone/demo-openrc ssh-keygen -q -N "" openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey openstack keypair list
openstack security group rule create --proto icmp default openstack security group rule create --proto tcp --dst-port 22 default
查看虚拟机类型 source /etc/keystone/demo-openrc
openstack flavor create --ram 512 --disk 1 --vcpus 1 --public m1.tiny
openstack flavor list
openstack image list
openstack network list
openstack server create --flavor m1.nano --image cirros
--nic net-id=46e702c9-8df5-4343-a943-9bdc3ae8761c --security-group default
--key-name lmkkey test1
openstack server list
获取链接
openstack console url show test1
一定要用谷歌浏览器访问,360出错
ssh cirros@192.168.56.100