您的位置:首页 > 理论基础 > 计算机网络

[部署篇9]VMWare搭建Openstack——Flat网络设置和horzion安装

2015-04-11 17:10 513 查看
一、在计算节点和网络节点上做如下配置

注意:如果是单独的计算节点,也需要进行如下配置
0. 计算节点和网络节点的有两个网卡,分别为eth0、eth1

1. 执行如下命令
sudo ovs-vsctl add-br br-eth1
sudo ovs-vsctl add-port br-eth1 eth1

2. 编辑/etc/neutron/plugins/ml2/ml2_conf.ini文件,
[ sudo vi /etc/neutron/plugins/ml2/ml2_conf.ini ]

更新设置如下:

[ml2_type_flat]
flat_networks = physnet1

[ml2_type_vlan]
network_vlan_ranges = physnet1:1000:2999

# add at the last line
[ovs]
bridge_mappings = physnet1:br-eth1
sm@computer:~$ sudo more /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
# (ListOpt) List of network type driver entrypoints to be loaded from
# the neutron.ml2.type_drivers namespace.
#
type_drivers = flat,vlan,gre
# Example: type_drivers = flat,vlan,gre,vxlan

# (ListOpt) Ordered list of network_types to allocate as tenant
# networks. The default value 'local' is useful for single-box testing
# but provides no connectivity between hosts.
#
tenant_network_types = vlan,gre
# Example: tenant_network_types = vlan,gre,vxlan

# (ListOpt) Ordered list of networking mechanism driver entrypoints
# to be loaded from the neutron.ml2.mechanism_drivers namespace.
mechanism_drivers = openvswitch
# Example: mechanism_drivers = openvswitch,mlnx
# Example: mechanism_drivers = arista
# Example: mechanism_drivers = cisco,logger
# Example: mechanism_drivers = openvswitch,brocade
# Example: mechanism_drivers = linuxbridge,brocade

[ml2_type_flat]
# (ListOpt) List of physical_network names with which flat networks
# can be created. Use * to allow flat networks with arbitrary
# physical_network names.
#
flat_networks = physnet1
# Example:flat_networks = physnet1,physnet2
# Example:flat_networks = *

[ml2_type_vlan]
# (ListOpt) List of <physical_network>[:<vlan_min>:<vlan_max>] tuples
# specifying physical_network names usable for VLAN provider and
# tenant networks, as well as ranges of VLAN tags on each
# physical_network available for allocation as tenant networks.
#
network_vlan_ranges = physnet1:1000:2999
# Example: network_vlan_ranges = physnet1:1000:2999,physnet2

[ml2_type_gre]
# (ListOpt) Comma-separated list of <tun_min>:<tun_max> tuples enumerating range
s of GRE tunnel IDs that are available for tenant network allocation
# tunnel_id_ranges =

[ml2_type_vxlan]
# (ListOpt) Comma-separated list of <vni_min>:<vni_max> tuples enumerating
# ranges of VXLAN VNI IDs that are available for tenant network allocation.
#
# vni_ranges =

# (StrOpt) Multicast group for the VXLAN interface. When configured, will
# enable sending all broadcast traffic to this multicast group. When left
# unconfigured, will disable multicast VXLAN mode.
#
# vxlan_group =
# Example: vxlan_group = 239.1.1.1

[securitygroup]
# Controls if neutron security group is enabled or not.
# It should be false when you use nova security group.
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewal
lDriver

[ovs]
bridge_mappings = physnet1:br-eth1


3. 重启服务
sudo service neutron-plugin-openvswitch-agent restart
sm@computer:~$ sudo service neutron-plugin-openvswitch-agent restart
neutron-plugin-openvswitch-agent stop/waiting
neutron-plugin-openvswitch-agent start/running, process 34667


二、在控制节点上创建虚拟网络
1. 执行如下命令,创建网络
tenantID=`keystone tenant-list | grep service | awk '{print $2}'`
neutron net-create --tenant-id $tenantID sharednet1 --shared --provider:network_type flat --provider:physical_network physnet1
neutron subnet-create --tenant-id $tenantID --gateway 192.168.3.1 --dns-nameserver 192.168.3.1 --allocation-pool start=192.168.3.20,end=192.168.3.200 sharednet1 192.168.102.0/24
注意:用户可以根据自己的情况自行设定是否需要dns,但是建议一定要给予一个连续的网段,例如192.168.3.20——192.168.3.200

neutron net-list
sm@controller:~$ neutron net-list
+--------------------------------------+------------+-----------------------------------------------------+
| id                                   | name       | subnets                                             |
+--------------------------------------+------------+-----------------------------------------------------+
| 1dfa9da1-43fd-4128-b9a0-2ca76a664933 | sharednet1 | db1aad02-3890-44d4-93c4-c933c2c818a5 192.168.3.0/24 |
+--------------------------------------+------------+-----------------------------------------------------+


2. 执行如下命令,添加规则
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
nova secgroup-list-rules default

三、在控制节点安装Horizon

1. 安装仪表盘服务包
sudo apt-get install apache2 memcached libapache2-mod-wsgi openstack-dashboard


2. 编辑/etc/openstack-dashboard/local_settings.py文件
[ sudo vi /etc/openstack-dashboard/local_settings.py ]

更新设置如下:

CACHES = {
'default': {
'BACKEND' : 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION' : '127.0.0.1:11211'
}
}

ALLOWED_HOSTS = [*]
OPENSTACK_HOST = "192.168.3.180"


3. 重启服务
sudo service apache2 restart
sm@controller:~$ sudo service apache2 restart
 * Restarting web server apache2                                                                                                                  AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.3.180. Set the 'ServerName' directive globally to suppress this message
                                                                                                                                           [ OK ]


sudo service memcached restart
sm@controller:~$ sudo service memcached restart
Restarting memcached: memcached.


4.进入horizon界面,管理相关的云环境



用户名:admin
密码:admin4smtest
其实就是keystone创建的admin用户和密码。

至此,一个简单的OpenStack环境已经大家完毕!

我们并没有安装相关的块存储(cinder)、对象存储(swift),感兴趣的可以自行研究。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: