本文实际环境 vmware 虚拟机:
网络采用的桥接方式,和我的物理网络在一个网段
CPU开启虚拟化
虚拟机安装系统后,配置上静态IP,能连接外网就行了,最好是把内核升级到5.19以上
1、初始化准备
1)关闭防火墙
systemctl disable firewalld
systemctl stop firewalld
systemctl disable NetworkManager
systemctl stop NetworkManager
vim /etc/selinux/config
SELINUX=disabled
2)增加hosts源
vim /etc/hosts
192.168.20.205 master.openstack
3)配置国内源:我选择的是 阿里源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum clean all
yum makecache
yum update -y
4)yum install centos-release-openstack-queens.noarch -y
将源换成阿里源
baseurl=http://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-queens/
yum install -y openstack-packstack.noarch
2、提前准备过程中会出现的错误
1) 降级 leatherman
# yum list installed | grep leatherma
leatherman.x86_64 1.10.0-1.el7 @epel
yum downgrade leatherman -y
2) 应对 openstack-keystone 错误
yum -y install qpid-proton-c-0.22.0-1.el7.x86_64
3)应对错误: Error: Execution of ‘/usr/bin/yum -d 0 -e 0 -y install openstack-ceilometer-ipmi’
yum install applydeltarpm -y
yum -d 0 -e 0 -y install openstack-ceilometer-ipmi
3、开始 all-in-one 建议开始之前,做一份快照备用,因为不知道会遇到啥乱七八糟的问题
packstack --allinone --provision-demo=n --os-neutron-ovn-bridge-mappings=extnet:br-ex --os-neutron-ovn-bridge-interfaces=br-ex:eth0
4、安装完成后开始配置网桥
安装完成后的初始网卡,会多一个br-ex的网桥出来
# ip a
......
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:5a:a6:59 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.151/24 brd 192.168.0.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fe5a:a659/64 scope link
valid_lft forever preferred_lft forever
3: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 36:8c:b5:5a:43:a1 brd ff:ff:ff:ff:ff:ff
4: br-ex: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 82:c0:23:69:97:44 brd ff:ff:ff:ff:ff:ff
inet6 fe80::80c0:23ff:fe69:9744/64 scope link
valid_lft forever preferred_lft forever
根据文档Neutron with existing external network —RDO
配置 ifcfg-br-ex
[root@master network-scripts]# cat ifcfg-br-ex
DEVICE=br-ex
DEVICETYPE=ovs
TYPE=OVSBridge
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=br-ex
UUID=26863512-9ea5-470b-9fde-a3681ce4cc39
DEVICE=br-ex
ONBOOT=yes
IPADDR=192.168.20.205
NETMASK=255.255.255.0
GATEWAY=192.168.20.1
DNS1=202.103.24.68
配置ifcfg-eno16777736(根据自己的实际网卡)
[root@master network-scripts]# cat ifcfg-eno16777736
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
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=eno16777736
DEVICE=eno16777736
ONBOOT=yes
重启网卡服务:systemctl restart network
IP会桥接到br-ex上去
测试下,IP是不是通的,能不能连接外网和网关
5、页面网络配置
先登录页面地址:
http://192.168.20.205/dashboard/auth/login/?next=/dashboard/
初始账号密码在文件
6、创建外网和子网
source /root/keystonerc_admin
neutron net-create external_network --provider:network_type flat --provider:physical_network extnet --router:external
neutron subnet-create --name public_subnet --enable_dhcp=False --allocation-pool=start=192.168.20.100,end=192.168.20.250 --gateway=192.168.20.1 external_network 192.168.20.0/24
上面是用命令行创建,直接页面创建更加简洁
页面创建
创建内网和子网
创建路由----点击路由进去----添加接口
内外网关必须是UP的状态
确认 ping 路由
如果 ping 不通路由,就不要继续,先去解决网络配置或安全组设置
确认网络拓扑
确认一个没有被用过的浮动IP
下载并配置一份镜像
wget http://download.cirros-cloud.net/0.5.2/cirros-0.5.2-x86_64-disk.img
openstack image create "cirros_1" --file cirros-0.5.2-x86_64-disk.img --disk-format qcow2 --container-format bare --public
增加安全组规则
8、创建一个实例
下面就都是下一步了 直到创建实例
绑定浮动IP
9、测试
是否PING通浮动IP
机器是否运行
是否能够登陆
是否能从宿主机ssh登录