参考连接:使用RDO Packstack在CentOS 8上安装OpenStack Victoria
Last login: Wed Nov 11 13:46:10 2020
[root@localhost ~]# hostnamectl set-hostname "openstack.example.com"
[root@localhost ~]# exec bash
[root@openstack ~]# hostnamectl
Static hostname: openstack.example.com
Icon name: computer-vm
Chassis: vm
Machine ID: bf6e29e6a6de4e1b905b39e6ce142867
Boot ID: 0e5bce586aad4838a23b2d2d5a977702
Virtualization: vmware
Operating System: CentOS Linux 8 (Core)
CPE OS Name: cpe:/o:centos:centos:8
Kernel: Linux 4.18.0-193.el8.x86_64
Architecture: x86-64
[root@openstack ~]#
在/etc/hosts配置文件中添加主机映射关系
[root@openstack ~]# echo -e "192.168.1.126\topenstack.example.com" >> /etc/hosts
[root@openstack ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.126 openstack.example.com
[root@openstack ~]#
[root@openstack ~]# systemctl stop NetworkManager
[root@openstack ~]# systemctl disable NetworkManager
Removed /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
安装network-scripts
[root@openstack ~]# dnf install -y network-scripts
Last metadata expiration check: 0:02:13 ago on Wed 11 Nov 2020 01:56:08 PM CST.
Dependencies resolved.
============================================================================================================================== Package Architecture Version Repository Size
==============================================================================================================================Installing:
network-scripts x86_64 10.00.6-1.el8_2.2 BaseOS 195 k
Upgrading:
initscripts x86_64 10.00.6-1.el8_2.2 BaseOS 338 k
Installing weak dependencies:
network-scripts-team x86_64 1.29-1.el8_2.2 BaseOS 27 k
Transaction Summary
==============================================================================================================================Install 2 Packages
Upgrade 1 Package
Total download size: 560 k
Downloading Packages:
(1/3): network-scripts-10.00.6-1.el8_2.2.x86_64.rpm 1.6 MB/s | 195 kB 00:00
(2/3): network-scripts-team-1.29-1.el8_2.2.x86_64.rpm 215 kB/s | 27 kB 00:00
(3/3): initscripts-10.00.6-1.el8_2.2.x86_64.rpm 2.1 MB/s | 338 kB 00:00
------------------------------------------------------------------------------------------------------------------------------Total 749 kB/s | 560 kB 00:00
warning: /var/cache/dnf/BaseOS-929b586ef1f72f69/packages/network-scripts-10.00.6-1.el8_2.2.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
CentOS-8 - Base 1.6 MB/s | 1.6 kB 00:00
Importing GPG key 0x8483C65D:
Userid : "CentOS (CentOS Official Signing Key) "
Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: initscripts-10.00.6-1.el8_2.2.x86_64 1/1
Upgrading : initscripts-10.00.6-1.el8_2.2.x86_64 1/4
Running scriptlet: initscripts-10.00.6-1.el8_2.2.x86_64 1/4
Installing : network-scripts-10.00.6-1.el8_2.2.x86_64 2/4
Running scriptlet: network-scripts-10.00.6-1.el8_2.2.x86_64 2/4
Installing : network-scripts-team-1.29-1.el8_2.2.x86_64 3/4
Running scriptlet: initscripts-10.00.6-1.el8.x86_64 4/4
Cleanup : initscripts-10.00.6-1.el8.x86_64 4/4
Running scriptlet: initscripts-10.00.6-1.el8.x86_64 4/4
Verifying : network-scripts-10.00.6-1.el8_2.2.x86_64 1/4
Verifying : network-scripts-team-1.29-1.el8_2.2.x86_64 2/4
Verifying : initscripts-10.00.6-1.el8_2.2.x86_64 3/4
Verifying : initscripts-10.00.6-1.el8.x86_64 4/4
Upgraded:
initscripts-10.00.6-1.el8_2.2.x86_64
Installed:
network-scripts-10.00.6-1.el8_2.2.x86_64 network-scripts-team-1.29-1.el8_2.2.x86_64
Complete!
[root@openstack ~]#
[root@openstack ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens32
[root@openstack ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
NAME=ens32
DEVICE=ens32
ONBOOT=yes
IPADDR=192.168.1.100
PREFIX=24
GATEWAY=192.168.1.1
DNS=192.168.1.1
[root@openstack ~]#
[root@openstack ~]# systemctl restart network
[root@openstack ~]# systemctl enable network
network.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable network
[root@openstack ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:d4:a5:69 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global ens32
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fed4:a569/64 scope link
valid_lft forever preferred_lft forever
[root@openstack ~]# ip a s ens32
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:d4:a5:69 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global ens32
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fed4:a569/64 scope link
valid_lft forever preferred_lft forever
[root@openstack ~]# dnf config-manager --enable PowerTools
[root@openstack ~]# dnf install -y centos-release-openstack-ussuri
Last metadata expiration check: 0:08:40 ago on Wed 11 Nov 2020 02:07:30 PM CST.
No match for argument: centos-release-openstack-victoria
Error: Unable to find a match: centos-release-openstack-victoria
[root@openstack ~]# dnf install -y centos-release-openstack-ussuri
Last metadata expiration check: 0:11:10 ago on Wed 11 Nov 2020 02:07:30 PM CST.
Dependencies resolved.
============================================================================================================================== Package Architecture Version Repository Size
==============================================================================================================================Installing:
centos-release-openstack-ussuri noarch 1-3.el8 extras 11 k
Installing dependencies:
centos-release-ceph-nautilus noarch 1.2-2.el8 extras 8.8 k
centos-release-messaging noarch 1-2.el8 extras 9.4 k
centos-release-rabbitmq-38 noarch 1-2.el8 extras 8.3 k
centos-release-storage-common noarch 2-2.el8 extras 9.4 k
Transaction Summary
==============================================================================================================================Install 5 Packages
Total download size: 47 k
Installed size: 12 k
Downloading Packages:
(1/5): centos-release-openstack-ussuri-1-3.el8.noarch.rpm 313 kB/s | 11 kB 00:00
(2/5): centos-release-messaging-1-2.el8.noarch.rpm 195 kB/s | 9.4 kB 00:00
(3/5): centos-release-ceph-nautilus-1.2-2.el8.noarch.rpm 177 kB/s | 8.8 kB 00:00
(4/5): centos-release-rabbitmq-38-1-2.el8.noarch.rpm 592 kB/s | 8.3 kB 00:00
(5/5): centos-release-storage-common-2-2.el8.noarch.rpm 2.1 MB/s | 9.4 kB 00:00
------------------------------------------------------------------------------------------------------------------------------Total 93 kB/s | 47 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : centos-release-storage-common-2-2.el8.noarch 1/5
Installing : centos-release-ceph-nautilus-1.2-2.el8.noarch 2/5
Running scriptlet: centos-release-ceph-nautilus-1.2-2.el8.noarch 2/5
Installing : centos-release-messaging-1-2.el8.noarch 3/5
Installing : centos-release-rabbitmq-38-1-2.el8.noarch 4/5
Installing : centos-release-openstack-ussuri-1-3.el8.noarch 5/5
Verifying : centos-release-ceph-nautilus-1.2-2.el8.noarch 1/5
Verifying : centos-release-messaging-1-2.el8.noarch 2/5
Verifying : centos-release-openstack-ussuri-1-3.el8.noarch 3/5
Verifying : centos-release-rabbitmq-38-1-2.el8.noarch 4/5
Verifying : centos-release-storage-common-2-2.el8.noarch 5/5
Installed:
centos-release-ceph-nautilus-1.2-2.el8.noarch centos-release-messaging-1-2.el8.noarch
centos-release-openstack-ussuri-1-3.el8.noarch centos-release-rabbitmq-38-1-2.el8.noarch
centos-release-storage-common-2-2.el8.noarch
Complete!
[root@openstack ~]#
[root@openstack ~]# systemctl stop firewalld
[root@openstack ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@openstack ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@openstack ~]#
[root@openstack ~]#
[root@openstack ~]# setenforce 0
[root@openstack ~]# getenforce
Permissive
[root@openstack ~]#
[root@openstack ~]# dnf update -y
[root@openstack ~]# reboot
[root@openstack ~]# dnf install -y openstack-packstack
......
Installed:
augeas-libs-1.12.0-5.el8.x86_64
boost-atomic-1.66.0-7.el8.x86_64
boost-chrono-1.66.0-7.el8.x86_64
boost-date-time-1.66.0-7.el8.x86_64
boost-filesystem-1.66.0-7.el8.x86_64
boost-locale-1.66.0-7.el8.x86_64
boost-log-1.66.0-7.el8.x86_64
boost-program-options-1.66.0-7.el8.x86_64
boost-regex-1.66.0-7.el8.x86_64
boost-system-1.66.0-7.el8.x86_64
boost-thread-1.66.0-7.el8.x86_64
cpp-hocon-0.2.1-1.el8.x86_64
facter-1:3.14.2-2.el8.x86_64
git-core-2.18.4-2.el8_2.x86_64
hiera-3.6.0-1.el8.noarch
leatherman-1.6.1-2.el8.x86_64
libicu-60.3-2.el8_1.x86_64
libselinux-ruby-2.9-3.el8.x86_64
lsof-4.91-2.el8.x86_64
openstack-packstack-1:16.0.2-1.el8.noarch
openstack-packstack-puppet-1:16.0.2-1.el8.noarch
puppet-6.14.0-2.el8.noarch
puppet-aodh-16.3.0-1.el8.noarch
puppet-apache-5.4.0-1.420605fgit.el8.noarch
puppet-archive-4.4.0-1.474ea01git.el8.noarch
puppet-ceilometer-16.3.0-1.el8.noarch
puppet-certmonger-2.4.0-1.a198870git.el8.noarch
puppet-cinder-16.3.0-1.el8.noarch
puppet-concat-6.2.0-1.596d8ccgit.el8.noarch
puppet-corosync-6.0.2-0.1.0rc0.2a27f93git.el8.noarch
puppet-firewall-2.3.0-1.233f841git.el8.noarch
puppet-glance-16.3.0-1.el8.noarch
puppet-gnocchi-16.3.0-1.el8.noarch
puppet-headless-6.14.0-2.el8.noarch
puppet-heat-16.3.0-1.el8.noarch
puppet-horizon-16.3.0-1.el8.noarch
puppet-inifile-4.2.0-1.el8.noarch
puppet-ironic-16.3.0-2.el8.noarch
puppet-keystone-16.3.0-1.el8.noarch
puppet-magnum-16.3.0-1.el8.noarch
puppet-manila-16.3.0-1.el8.noarch
puppet-memcached-3.4.0-2.1f307b8git.el8.noarch
puppet-mysql-10.4.0-1.fff2c82git.el8.noarch
puppet-neutron-16.3.0-1.el8.noarch
puppet-nova-16.4.0-0.1.0d7f13fgit.el8.noarch
puppet-nssdb-1.0.1-1.2ed2a2dgit.el8.noarch
puppet-openstack_extras-16.3.0-1.el8.noarch
puppet-openstacklib-16.3.0-1.el8.noarch
puppet-oslo-16.3.0-1.el8.noarch
puppet-ovn-16.3.0-1.el8.noarch
puppet-panko-16.3.0-1.el8.noarch
puppet-placement-3.3.0-1.el8.noarch
puppet-rabbitmq-10.0.2-0.1.0rc0.eafe833git.el8.noarch
puppet-redis-5.0.1-0.1.0rc0.8e48eeegit.el8.noarch
puppet-remote-10.0.0-1.7420908git.el8.noarch
puppet-rsync-1.1.1-2.db5f8b5git.el8.noarch
puppet-sahara-16.3.0-1.el8.noarch
puppet-ssh-6.1.0-1.29a9ae7git.el8.noarch
puppet-staging-1.0.4-1.b466d93git.el8.noarch
puppet-stdlib-6.3.0-1.93eee77git.el8.noarch
puppet-swift-16.3.0-1.el8.noarch
puppet-sysctl-0.0.12-2.a3d160dgit.el8.noarch
puppet-systemd-2.9.0-1.1e15600git.el8.noarch
puppet-tempest-16.3.0-1.el8.noarch
puppet-trove-16.3.0-1.el8.noarch
puppet-vcsrepo-3.1.0-1.d285592git.el8.noarch
puppet-vswitch-12.3.0-1.el8.noarch
puppet-xinetd-3.3.0-2.8d460c4git.el8.noarch
python3-docutils-0.14-12.module_el8.1.0+245+c39af44f.noarch
python3-netaddr-0.7.19-8.el8.noarch
python3-pbr-5.4.3-2.el8.noarch
python3-pip-9.0.3-16.el8.noarch
python3-pyyaml-5.3-2.el8.x86_64
python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64
ruby-2.5.5-105.module_el8.1.0+214+9be47fd7.x86_64
ruby-augeas-0.5.0-23.el8.x86_64
ruby-facter-1:3.14.2-2.el8.x86_64
ruby-irb-2.5.5-105.module_el8.1.0+214+9be47fd7.noarch
ruby-libs-2.5.5-105.module_el8.1.0+214+9be47fd7.x86_64
rubygem-bigdecimal-1.3.4-105.module_el8.1.0+214+9be47fd7.x86_64
rubygem-cane-3.0.0-1.el8.noarch
rubygem-concurrent-ruby-1.1.5-2.el8.noarch
rubygem-deep_merge-1.2.1-4.el8.noarch
rubygem-did_you_mean-1.2.0-105.module_el8.1.0+214+9be47fd7.noarch
rubygem-diff-lcs-1.3-4.el8.noarch
rubygem-docile-1.1.5-10.el8.noarch
rubygem-fast_gettext-1.2.0-9.el8.noarch
rubygem-hocon-1.3.0-1.el8.noarch
rubygem-io-console-0.4.6-105.module_el8.1.0+214+9be47fd7.x86_64
rubygem-json-2.1.0-105.module_el8.1.0+214+9be47fd7.x86_64
rubygem-multi_json-1.13.1-4.el8.noarch
rubygem-openssl-2.1.2-105.module_el8.1.0+214+9be47fd7.x86_64
rubygem-parallel-1.12.1-5.el8.noarch
rubygem-pathspec-0.2.1-5.el8.noarch
rubygem-psych-3.0.2-105.module_el8.1.0+214+9be47fd7.x86_64
rubygem-puppet-resource_api-1.8.12-1.el8.noarch
rubygem-rake-12.3.0-105.module_el8.1.0+214+9be47fd7.noarch
rubygem-rdoc-6.0.1-105.module_el8.1.0+214+9be47fd7.noarch
rubygem-redcarpet-3.3.2-16.1.el8.x86_64
rubygem-rgen-0.8.4-2.el8.noarch
rubygem-rspec-3.7.0-2.el8.noarch
rubygem-rspec-core-3.7.1-5.el8.noarch
rubygem-rspec-expectations-3.7.0-4.el8.noarch
rubygem-rspec-fire-1.3.0-1.el8.noarch
rubygem-rspec-mocks-3.7.0-4.el8.noarch
rubygem-rspec-support-3.7.1-2.el8.noarch
rubygem-ruby-shadow-2.5.0-12.el8.x86_64
rubygem-semantic_puppet-1.0.2-1.el8.noarch
rubygem-simplecov-0.13.0-7.el8.1.noarch
rubygem-simplecov-html-0.10.0-8.el8.noarch
rubygem-yard-0.9.12-8.el8.noarch
rubygems-2.7.6.2-105.module_el8.1.0+214+9be47fd7.noarch
yaml-cpp-0.6.3-1.el8.x86_64
Complete!
[root@openstack ~]#
[root@openstack ~]# packstack --gen-answer-file /root/openstack-answer.txt
Packstack changed given value to required value /root/.ssh/id_rsa.pub
Additional information:
* Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS or FWaaS services. Geneve will be used as the encapsulation method for tenant networks
[root@openstack ~]# ll
total 56
-rw-------. 1 root root 1471 Nov 11 11:11 anaconda-ks.cfg
-rw------- 1 root root 51567 Nov 11 14:29 openstack-answer.txt
[root@openstack ~]# vi openstack-answer.txt
[root@openstack ~]# vi /root/openstack-answer.txt
..............
CONFIG_HEAT_INSTALL=y
CONFIG_PROVISION_DEMO=n
CONFIG_KEYSTONE_ADMIN_PW=P@ssw0rd
CONFIG_NEUTRON_OVN_BRIDGE_IFACES=br-ex:enp0s3
.............
[root@openstack ~]# packstack --answer-file /root/openstack-answer.txt
[root@openstack ~]# ip a s ens32
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master ovs-system state UP group default qlen 1000
link/ether 00:0c:29:d4:a5:69 brd ff:ff:ff:ff:ff:ff
inet6 fe80::20c:29ff:fed4:a569/64 scope link
valid_lft forever preferred_lft forever
[root@openstack ~]# ip a s br-ex
6: br-ex: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 00:0c:29:d4:a5:69 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global br-ex
valid_lft forever preferred_lft forever
inet6 fe80::85c:abff:fe6a:584e/64 scope link
valid_lft forever preferred_lft forever
[root@openstack ~]# ovs-vsctl show
b5fa808b-f92d-461f-b319-3285e134096b
Manager "ptcp:6640:127.0.0.1"
is_connected: true
Bridge br-int
fail_mode: secure
Port br-int
Interface br-int
type: internal
Bridge br-ex
fail_mode: standalone
Port br-ex
Interface br-ex
type: internal
Port "ens32"
Interface "ens32"
ovs_version: "2.12.0"
[root@openstack ~]#
[root@openstack ~]# cat keystonerc_admin
unset OS_SERVICE_TOKEN
export OS_USERNAME=admin
export OS_PASSWORD='P@ssw0rd'
export OS_REGION_NAME=RegionOne
export OS_AUTH_URL=http://192.168.1.100:5000/v3
export PS1='[\u@\h \W(keystone_admin)]\$ '
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3
[root@openstack ~]#
在openstack中启动实例之前,首先必须创建网络,路由器和上传镜像。因此,让我们首先使用以下neutron命令在管理租户中创建外部网络。
[root@openstack ~]# source keystonerc_admin
[root@openstack ~(keystone_admin)]# neutron net-create external_network --provider:network_type flat --provider:physical_network extnet --router:external
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new network:
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2020-11-11T08:21:32Z |
| description | |
| id | 4a1d7ce1-c992-49ec-925b-f6de4ff57631 |
| ipv4_address_scope | |
| ipv6_address_scope | |
| is_default | False |
| mtu | 1500 |
| name | external_network |
| port_security_enabled | True |
| project_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| provider:network_type | flat |
| provider:physical_network | extnet |
| provider:segmentation_id | |
| qos_policy_id | |
| revision_number | 1 |
| router:external | True |
| shared | False |
| status | ACTIVE |
| subnets | |
| tags | |
| tenant_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| updated_at | 2020-11-11T08:21:32Z |
+---------------------------+--------------------------------------+
[root@openstack ~(keystone_admin)]#
通过运行以下neutron命令,将您的flat网络的子网添加到外部网络
[root@openstack ~(keystone_admin)]# neutron subnet-create --name public_subnet --enable_dhcp=True --allocation-pool=start=192.168.1.210,end=192.168.1.230 --gateway=192.168.1.1 external_network 192.168.1.0/24
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new subnet:
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| allocation_pools | {
"start": "192.168.1.210", "end": "192.168.1.230"} |
| cidr | 192.168.1.0/24 |
| created_at | 2020-11-11T08:22:29Z |
| description | |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 192.168.1.1 |
| host_routes | |
| id | 3cb4d034-5be7-40ef-99fc-69714dc2a108 |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | public_subnet |
| network_id | 4a1d7ce1-c992-49ec-925b-f6de4ff57631 |
| project_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| revision_number | 0 |
| service_types | |
| subnetpool_id | |
| tags | |
| tenant_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| updated_at | 2020-11-11T08:22:29Z |
+-------------------+----------------------------------------------------+
[root@openstack ~(keystone_admin)]#
通过执行以下neutron命令创建路由器,并使用外部网络设置其网关
[root@openstack ~(keystone_admin)]# neutron router-create dev-router
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new router:
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2020-11-11T08:23:51Z |
| description | |
| external_gateway_info | |
| id | de9e9bfe-5376-4d5f-9c4c-93c2913a9be4 |
| name | dev-router |
| project_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| revision_number | 1 |
| routes | |
| status | ACTIVE |
| tags | |
| tenant_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| updated_at | 2020-11-11T08:23:51Z |
+-------------------------+--------------------------------------+
[root@openstack ~(keystone_admin)]# neutron router-gateway-set dev-router external_network
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Set gateway for router dev-router
[root@openstack ~(keystone_admin)]#
创建私有网络并将一个子网附加到该私有网络,运行以下neutron命令。
[root@openstack ~(keystone_admin)]# neutron net-create pvt_net
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new network:
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2020-11-11T08:24:45Z |
| description | |
| id | 346f678f-b422-4490-aa84-d7f0a0077a85 |
| ipv4_address_scope | |
| ipv6_address_scope | |
| is_default | False |
| mtu | 1442 |
| name | pvt_net |
| port_security_enabled | True |
| project_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| provider:network_type | geneve |
| provider:physical_network | |
| provider:segmentation_id | 10 |
| qos_policy_id | |
| revision_number | 1 |
| router:external | False |
| shared | False |
| status | ACTIVE |
| subnets | |
| tags | |
| tenant_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| updated_at | 2020-11-11T08:24:45Z |
+---------------------------+--------------------------------------+
[root@openstack ~(keystone_admin)]# neutron subnet-create --name pvt_subnet pvt_net 10.20.1.0/24
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new subnet:
+-------------------+----------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------+
| allocation_pools | {
"start": "10.20.1.2", "end": "10.20.1.254"} |
| cidr | 10.20.1.0/24 |
| created_at | 2020-11-11T08:24:56Z |
| description | |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 10.20.1.1 |
| host_routes | |
| id | db78ad37-2f10-4e7f-8e58-27042a6f52b1 |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | pvt_subnet |
| network_id | 346f678f-b422-4490-aa84-d7f0a0077a85 |
| project_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| revision_number | 0 |
| service_types | |
| subnetpool_id | |
| tags | |
| tenant_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| updated_at | 2020-11-11T08:24:56Z |
+-------------------+----------------------------------------------+
[root@openstack ~(keystone_admin)]#
使用以下neutron命令将pvt_net接口添加到路由器“ dev_router ”。
[root@openstack ~(keystone_admin)]# neutron router-interface-add dev-router pvt_subnet
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Added interface 3a56da05-5020-4c1a-a572-f8c4bb2dbd21 to router dev-router.
[root@openstack ~(keystone_admin)]#
下载Cirros 镜像,然后上传到OpenStack中
[root@openstack ~]# source keystonerc_admin
[root@openstack ~(keystone_admin)]# wget http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img
[root@openstack ~(keystone_admin)]# openstack image create --disk-format qcow2 --container-format bare --public --file cirros-0.5.1-x86_64-disk.img cirros
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum | 1d3062cd89af34e419f7100277f38b2b |
| container_format | bare |
| created_at | 2020-11-11T08:20:01Z |
| disk_format | qcow2 |
| file | /v2/images/87d7f055-9699-4761-be83-d6f574c42488/file |
| id | 87d7f055-9699-4761-be83-d6f574c42488 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | 7f6b46bbf1e04095b9c4fda1aa04eb43 |
| properties | os_hash_algo='sha512', os_hash_value='553d220ed58cfee7dafe003c446a9f197ab5edf8ffc09396c74187cf83873c877e7ae041cb80f3b91489acf687183adcd689b53b38e3ddd22e627e7f98a09c46', os_hidden='False', owner_specified.openstack.md5='1d3062cd89af34e419f7100277f38b2b', owner_specified.openstack.object='images/cirros', owner_specified.openstack.sha256='c4110030e2edf06db87f5b6e4efc27300977683d53f040996d15dcc0ad49bb5a', self='/v2/images/87d7f055-9699-4761-be83-d6f574c42488' |
| protected | False |
| schema | /v2/schemas/image |
| size | 16338944 |
| status | active |
| tags | |
| updated_at | 2020-11-11T08:20:02Z |
| visibility | public |
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@openstack ~(keystone_admin)]#
创建虚拟机之前的最后一步,更新默认安全组,添加icmp和ssh入口规则,在网络选项卡下单击“安全组”,单击“管理规则”,然后单击“添加规则”。