参考网址:
现在装完一切正常,就是不能重启,一旦重启VM,会导致给br-ex设置的IP地址丢失,正在想办法解决。
在虚拟机安装完成后,可以使用快照保存,下次使用时恢复即可。物理机没有办法。
网络环境
vmware workstation,安装ubuntu 14.04 虚拟机,记住,最小化安装,仅仅安装ssh server服务就可以。
虚拟机使用NAT网络,虚拟机默认通过dhcp获得的IP地址是
192.168.27.128/24
auto eth0iface eth0 inet static address 192.168.27.128 netmask 255.255.255.0 network 192.168.27.0 broadcast 192.168.27.255 gateway 192.168.27.2 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 114.114.114.114 dns-search test.com
vmware workstation默认设置分配的IP地址池是128开始分配。所以我的
Floating Ip是:192.168.27.102到192.168.27.110
网关是:192.168.27.2
查看网关命令:route -n
看图,就应该很清楚
设置ubuntu源
对于ubuntu的系统,默认安全会从国外的源安装,导致速度比较慢。
sudo gedit /etc/apt/sources.list deb http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiversedeb http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiversedeb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiversedeb http://cn.archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiversedeb http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
允许update
sudo apt-get update
记得同步一下时间
sudo ntpdate ntp.sjtu.edu.cn
安装
sudo apt-get install git
下载devstack
cd /homegit clone http://git.trystack.cn/openstack-dev/devstack.git
目前Devstack脚本已经不支持直接使用root身份运行,你需要创建stack用户运行
cd /home/devstack/tools/./create-stack-user.sh
sudo passwd stack
修改devstack目录权限,让stack用户可以运行
chown -R stack:stack /home/devstackchmod 777 /dev/pts/0
可以考虑在虚拟机里增加一块磁盘专门给cinder使用,这个需要在运行脚本前创建好。(可选)
pvcreate /dev/sdbvgcreate stack-volumes-default /dev/sdb
切换的stack用户下
su stackcd /home/devstack
进入devstack目录下,创建local.conf文件
[[local|localrc]]# Define images to be automatically downloaded during the DevStack built process.IMAGE_URLS="http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img"#change github to trystackGIT_BASE=${GIT_BASE:-http://git.trystack.cn}NOVNC_REPO=${NOVNC_REPO:-http://git.trystack.cn/kanaka/noVNC.git}# CredentialsDATABASE_PASSWORD=passADMIN_PASSWORD=passSERVICE_PASSWORD=passSERVICE_TOKEN=passRABBIT_PASSWORD=pass#FLAT_INTERFACE=eth0HOST_IP=192.168.27.128SERVICE_HOST=192.168.27.128MYSQL_HOST=192.168.27.128RABBIT_HOST=192.168.27.128GLANCE_HOSTPORT=192.168.27.128:9292## Neutron optionsQ_USE_SECGROUP=TrueFLOATING_RANGE="192.168.27.0/24"FIXED_RANGE="10.0.0.0/24"Q_FLOATING_ALLOCATION_POOL=start=192.168.27.102,end=192.168.27.110PUBLIC_NETWORK_GATEWAY="192.168.27.2"Q_L3_ENABLED=TruePUBLIC_INTERFACE=eth0Q_USE_PROVIDERNET_FOR_PUBLIC=TrueOVS_PHYSICAL_BRIDGE=br-exPUBLIC_BRIDGE=br-exOVS_BRIDGE_MAPPINGS=public:br-ex# Work offline#OFFLINE=True# Reclone each timeRECLONE=yes# Branches Now the devstack have bug in keystone and neutron for liberty. so we need use master#KEYSTONE_BRANCH=stable/liberty#NOVA_BRANCH=stable/liberty#NEUTRON_BRANCH=stable/liberty#SWIFT_BRANCH=stable/liberty#GLANCE_BRANCH=stable/liberty#CINDER_BRANCH=stable/liberty#HEAT_BRANCH=stable/liberty#TROVE_BRANCH=stable/liberty#HORIZON_BRANCH=stable/liberty#SAHARA_BRANCH=stable/liberty#CEILOMETER_BRANCH=stable/liberty# Logging# -------# By default ``stack.sh`` output only goes to the terminal where it runs. It can# be configured to additionally log to a file by setting ``LOGFILE`` to the full# path of the destination log file. A timestamp will be appended to the given name.LOGFILE=/opt/stack/logs/stack.sh.logVERBOSE=TrueLOG_COLOR=TrueSCREEN_LOGDIR=/opt/stack/logs# the number of days by setting ``LOGDAYS``.LOGDAYS=1# Database Backend MySQLenable_service mysql# RPC Backend RabbitMQenable_service rabbit# Enable Keystone - OpenStack Identity Serviceenable_service key# Horizon - OpenStack Dashboard Serviceenable_service horizon# Enable Swift - Object Storage Service without replication.enable_service s-proxy s-object s-container s-accountSWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5SWIFT_REPLICAS=1# Enable Glance - OpenStack Image serviceenable_service g-api g-reg# Enable Cinder - Block Storage service for OpenStack#VOLUME_GROUP="cinder-volumes"enable_service cinder c-api c-vol c-sch c-bak# Enable Heat (orchestration) Service#enable_service heat h-api h-api-cfn h-api-cw h-eng# Enable Trove (database) Serviceenable_service trove tr-api tr-tmgr tr-cond# Enable Sahara (data_processing) Service#enable_service sahara# Enable Tempest - The OpenStack Integration Test Suiteenable_service tempest# Enabling Neutron (network) Servicedisable_service n-netenable_service q-svcenable_service q-agtenable_service q-dhcpenable_service q-l3enable_service q-metaenable_service q-meteringenable_service neutron## Neutron - Load Balancing#enable_service q-lbaas## Neutron - Firewall as a Service#enable_service q-fwaas## Neutron - VPN as a Service#enable_service q-vpn# VLAN configuration.Q_PLUGIN=ml2ENABLE_TENANT_VLANS=True# GRE tunnel configuration#Q_PLUGIN=ml2#ENABLE_TENANT_TUNNELS=True# VXLAN tunnel configuration#Q_PLUGIN=ml2#Q_ML2_TENANT_NETWORK_TYPE=vxlan# Enable Ceilometer - Metering Service (metering + alarming)enable_service ceilometer-acompute ceilometer-acentral ceilometer-collector ceilometer-apienable_service ceilometer-alarm-notify ceilometer-alarm-evalenable_service ceilometer-anotification## Enable NoVNCenable_service n-novnc[[post-config|$NOVA_CONF]][DEFAULT]# Ceilometer notification driverinstance_usage_audit=Trueinstance_usage_audit_period=hournotify_on_state_change=vm_and_task_statenotification_driver=nova.openstack.common.notifier.rpc_notifiernotification_driver=ceilometer.compute.nova_notifier
运行
./stack.sh
看看结果
测试
用admin登录Dashbord,为了测试,我们创建一个project:test,给project创建一个用户
使用该该账户重新登录Dashboard
大概的步骤
- 创建lan,分配内网IP地址段,记得设置dns
- 创建router,连接外网,同时连接lan
- 创建test安全组,允许tcp,udp,icmp全部访问
- 上传秘钥,或者创建秘钥
- 创建虚拟机,分配floating IP,验证网络所有功能
我是用vmware workstation做实验,我在我的笔记本上,可以直接ssh到虚拟机上,那么基本所有的问题都解决,最好是使用秘钥的方式,这样基本各种功能都测试了一遍。
参考文章
关于如何重启服务等相关问题