开启掘金成长之旅!这是我参与「掘金日新计划 · 2 月更文挑战」的第 5 天,点击查看活动详情
前言
搭建openstack环境,本次使用三台物理机,一台交换机进行组网,在完成前期插线后,安装centos7.9操作系统,之后进行环境组网搭建,如下:
修改主机名称
38节点
hostnamectl set-hostname controller01
39节点
hostnamectl set-hostname compute01
40节点
hostnamectl set-hostname computer02
查看网络规划
网卡bond
- 多张物理网卡绑定成为一个逻辑卡,使用同一个IP工作,增加带宽的同时能够提高设备冗余
- bond0: 负载平衡模式,采用轮询的模式,顺序的往每一个bond的网卡上发送数据包,提供负载均衡和容错的能力,其中MAC地址为某一张网卡的地址。如果bond0的两张或者多张网卡连接到同一个交换机,则需要配置聚合模式
- bond1: 主备策略,同一时间内只有一个网卡在使用,当本张网卡失效的时候,才会激活另一张网卡,该模式下,物理网卡的MAC和虚拟网卡的mac地址相同。
- bond2: 使用XOR Hash的模式进行负载分担,具有容错功能。
band0配置
BONDING_OPTS="mode=1 miimon=100"
TYPE=Ethernet
BONDING_MASTER=yes
BOOTPROTO=none
NAME=bond0
DEVICE=bond0
ONBOOT=yes
MTU=1500
band1配置
BONDING_OPTS="mode=1 miimon=100"
TYPE=Ethernet
BONDING_MASTER=yes
BOOTPROTO=none
NAME=bond1
DEVICE=bond1
ONBOOT=yes
MTU=9000
band2配置
BONDING_OPTS="mode=1 miimon=100"
TYPE=Ethernet
BONDING_MASTER=yes
BOOTPROTO=none
NAME=bond2
DEVICE=bond2
ONBOOT=yes
MTU=9000
查看半卡情况
lspic | greo net
检查网卡绑定bond情况
cat ifcfg-eno1
TYPE=Ethernet
NAME=eno1
DEVICE=eno1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
MTU=1500
cat ifcfg-enp59s0f0
TYPE=Ethernet
NAME=enp59s0f0
DEVICE=enp59s0f0
ONBOOT=yes
MASTER=bond1
SLAVE=yes
MTU=9000
检查CPU虚拟化是否开启
grep -E "vmx|svm" /proc/cpuinfo
安全设置
关闭防火墙 38 39 40 节点
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
关闭selinux
cat /etc/selinux/config
setenforce 0
添加host
vi /etc/hosts
- 确保网络可达
外网访问
配置DNS、路由等,确保能够访问外网
ping www.baidu.com
配置yum源
cd /etc/yum.repos.d
mkdir reposBak
cp *.repo reposBak/
- 确认正确备份
vi CentOS-Base.repo
重写如下:
[centos-base]
name=centos-base
baseurl=https://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=0
enabled=1
[centos-extras]
name=centos-extras
baseurl=https://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=0
enabled=1
[openstack]
name=openstack-rocky
baseurl=https://mirrors.163.com/centos/$releasever/cloud/$basearch/openstack-rocky/
gpgcheck=0
enabled=1
[virt]
name=virt
baseurl=http://mirrors.163.com/centos/$releasever/virt/$basearch/kvm-common/
gpgcheck=0
enabled=1
yum clean all
yum makecache
- 确保yum源配置正确
配置时间服务
controller01
yum install chrony
vi /etc/chrony.comf
allow all
local stratum 10
systemctl restart chronyd
systemctl enable chronyd
compute01
vi /etc/chrony.conf
# 添加
server 10.8.4.38 iburst
systemctl restart chronyd
systemctl enable chronyd
compute02
vi /etc/chrony.conf
# 添加
server 10.8.4.38 iburst
systemctl restart chronyd
systemctl enable chronyd
时间服务测试
chronyc sources
# 手动时钟同步
chronyc -a makestep