参考文档:
1. 网络结构
# | network | ip |
---|---|---|
1 | Management network | 10.0.0.0/24 |
2 | Provider network | 192.168.144.0/22 |
2. 网络配置
节点 | hostname | eno1 | eno2 |
---|---|---|---|
控制节点 | controller | 192.168.144.101/22 | 10.0.0.101/24 |
网络节点 | network | 192.168.144.102/22 | 10.0.0.102/24 |
计算节点 | compute01 | 192.168.144.103/22 | 10.0.0.103/24 |
3. 操作系统和内核
[root@compute01 compute]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@compute01 compute]# uname -r
3.10.0-327.el7.x86_64
4. 每个节点都要进行的操作
4.1 设置hostname,设置/etc/hosts ,关闭防火墙,关闭selinux
- 设置/etc/hosts
[root@compute01 compute]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.0.101 controller
10.0.0.102 network
10.0.0.103 compute01
- 设置hostname
[root@localhost ~]# hostnamectl set-hostname controller
[root@localhost ~]# hostname
controller
- 关闭selinux
[root@compute01 compute]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@compute01 compute]# setenforce 0
[root@compute01 compute]# getenforce
Permissive
- 关闭防火墙
[root@compute01 compute]# systemctl stop firewalld.service
[root@compute01 compute]# systemctl status firewalld.service
鈼firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sat 2017-09-02 04:31:34 EDT; 18h ago
Main PID: 744 (code=exited, status=0/SUCCESS)
Sep 02 01:39:17 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Sep 02 01:39:20 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Sep 02 04:31:33 compute01 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Sep 02 04:31:34 compute01 systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@compute01 compute]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
4.2 配置YUM本地源
- 删除官方源
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-* /opt/
- 添加本地源
[root@compute01 compute]# cat /etc/yum.repos.d/mitaka.repo
[base]
name=base
baseurl=ftp://192.168.116.21/repos/base/Packages/
enabled=1
gpgcheck=0
[openstack]
name=OpenStack Ocata Repository
baseurl=ftp://192.168.116.21/repos/mitaka/centos-openstack-mitaka/
enabled=1
gpgcheck=0
[extras]
baseurl=ftp://192.168.116.21/repos/ocata/extras-ocata/
enabled=1
gpgcheck=0
name=extras
[update]
baseurl=ftp://192.168.116.21/repos/ocata/updates-ocata/
enabled=1
gpgcheck=0
name=update
- 检查本地源是否可用
[root@localhost ~]# yum repolist
Loaded plugins: fastestmirror
base | 2.9 kB 00:00:00
extras | 2.9 kB 00:00:00
openstack | 2.9 kB 00:00:00
update | 2.9 kB 00:00:00
(1/4): extras/primary_db | 135 kB 00:00:00
(2/4): openstack/primary_db | 759 kB 00:00:00
(3/4): update/primary_db | 3.6 MB 00:00:00
(4/4): base/primary_db | 5.6 MB 00:00:01
Determining fastest mirrors
repo id repo name status
base base 9,363
extras extras 311
openstack OpenStack Ocata Repository 1,675
update update 1,111
repolist: 12,460
以下步骤可通过脚本执行。
脚本说明:
凡是需要在执行前进行修改的脚本,可以通过查看脚本,找到
###############
# change here #
###############
cp -f conf/openstack.cnf /etc/my.cnf.d/openstack.cnf
# | script name | comment | 改 |
---|---|---|---|
1 | ~/controller/1_pre.sh | 包括步骤4.3、4.4、 5。需要人工设置数据库初始化参数 | yes |
2 | ~/controller/2_keystone.sh | 包括步骤6 | no |
3 | ~/controller/3_glance.sh | 包括步骤7 | no |
4 | ~/controller/4_nova.sh | 包括步骤8.1,最后并没有启动服务,是因为我已经将neutron的相关配置提前写在conf/nova.conf里面 | yes |
5 | ~/controller/5_neutron.sh | 包括步骤9.1。在这一步启动4_nova.sh里面安装的nova五个服务 | no |
6 | ~/network/neutron.sh | 包括步骤9.2 | yes |
7 | ~/compute/main.sh | 包括步骤8.2 | yes |
8 | ~/compute/compute_neutron.sh | 包括步骤9.3 | yes |
修改紧跟着的配置文件即可。
# | script name | comment | 改 |
---|---|---|---|
1 | ~/controller/1_pre.sh | 包括步骤4.3、4.4、 5。需要人工设置数据库初始化参数 | yes |
2 | ~/controller/2_keystone.sh | 包括步骤6 | no |
3 | ~/controller/3_glance.sh | 包括步骤7 | no |
4 | ~/controller/4_nova.sh | 包括步骤8.1,最后并没有启动服务,是因为我已经将neutron的相关配置提前写在conf/nova.conf里面 | yes |
5 | ~/controller/5_neutron.sh | 包括步骤9.1。在这一步启动4_nova.sh里面安装的nova五个服务 | no |
6 | ~/network/neutron.sh | 包括步骤9.2 | yes |
7 | ~/compute/main.sh | 包括步骤8.2 | yes |
8 | ~/compute/compute_neutron.sh | 包括步骤9.3 | yes |
4.3 安装python-openstackclient,openstack-selinux
#yum install python-openstackclient openstack-selinux -y
4.4 配置时间服务器
#yum install chrony -y
4.4.1 控制节点作为标准时间
allow 10.0.0.0/24
启动服务
systemctl enable chronyd.service
systemctl start chronyd.service
4.4.2 余下节点参照控制节点时间
server controller iburst
启动服务
systemctl enable chronyd.service
systemctl start chronyd.service
5. 部署控制节点的基础服务
需要安装mariadb数据,rabbitmq,memcache三个服务,参照官方文档。本实例配套配置文件可下载。
6. 部署keystone服务
7. 部署glance服务
8. 部署nova服务
8.1 控制节点
8.2 计算节点
9. 部署网络服务
9.1 控制节点
-
创建数据库相关操作
-
创建keystone用户和角色
-
创建实体服务和endpoint
-
安装软件
yum install openstack-neutron openstack-neutron-ml2 python-neutronclient -y
-
修改配置文件
/etc/neutron/neutron.conf
/etc/neutron/plugins/ml2/ml2_conf.ini
/etc/nova/nova.conf 添加neutron 相关配置
-
创建配置文件链接
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
-
同步数据库
su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
-
重启nova服务
systemctl restart openstack-nova-api.service
-
重启neutron服务
systemctl enable neutron-server.service
systemctl start neutron-server.service
9.2 网络节点
-
系统内核修改
编辑/etc/sysctl.conf,添加下面三行
net.ipv4.ip_forward=1
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
#sysctl -p
-
安装软件包
#yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch -y
-
修改配置文件
/etc/neutron/neutron.conf
/etc/neutron/plugins/ml2/openvswitch_agent.ini
/etc/neutron/l3_agent.ini
/etc/neutron/dhcp_agent.ini
/etc/neutron/metadata_agent.ini
-
启动服务
#systemctl start neutron-openvswitch-agent.service neutron-l3-agent.service \
neutron-dhcp-agent.service neutron-metadata-agent.service
#systemctl enable neutron-openvswitch-agent.service neutron-l3-agent.service \
neutron-dhcp-agent.service neutron-metadata-agent.service
-
建网桥
删除eno2的IP
[root@network ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno2
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno2
UUID=aa20f98f-c98c-4348-b464-eff24d1a7677
DEVICE=eno2
ONBOOT=yes
#IPADDR=10.0.0.102
#NETMASK=255.255.255.0
添加br-ex网桥的配置文件
[root@network ~]# cat /etc/sysconfig/network-scripts/ifcfg-br-ex
DEVICE=br-ex
TYPE=Ethernet
ONBOOT="yes"
BOOTPROTO="none"
#HWADDR=bc:ee:7b:78:7b:a7
IPADDR=10.0.0.102
NETMASK=255.255.255.0
DNS1=114.114.114.114
NM_CONTROLLED=no
新建网桥并且将接口eno2接入网桥br-ex
#ovs-vsctl add-br br-ex
#ovs-vsctl add-port br-ex eno2
#systemctl restart network.service
9.3 计算节点
-
配置内核
不通过反向路由回溯进行源地址验证
编辑 /etc/sysctl.conf
#net.ipv4.conf.all.rp_filter=0
#net.ipv4.conf.default.rp_filter=0
#sysctl -p
-
安装软件包
#yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch -y
-
修改配置文件
/etc/neutron/neutron.conf
/etc/neutron/plugins/ml2/openvswitch_agent.ini
/etc/nova/nova.conf 添加neutron相关配置
-
启动服务
#systemctl enable neutron-openvswitch-agent.service
#systemctl start neutron-openvswitch-agent.service
#systemctl restart openstack-nova-compute.service