网络服务(Neutron)部署

网络服务(Neutron)部署

Neutron负责虚拟网络设备的创建、管理。包含网桥、网络、端口等。

1、网络初始环境准备

1.1设置外网网卡为混杂模式
需要将网卡设置为混杂模式,网卡能将通过自己接口的所有数据都捕获。
为了实现虚拟网络的数据转发,Neutron需要将外网网卡设置为混杂模式。
# 设置控制节点
[root@controller ~]# ifconfig ens33 promisc
[root@controller ~]# ifconfig
ens33: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500
        inet 192.168.88.128  netmask 255.255.255.0  broadcast 192.168.88.255
        inet6 fe80::1ceb:b516:386f:4519  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:41:87:4e  txqueuelen 1000  (Ethernet)
        RX packets 401  bytes 35533 (34.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 583  bytes 48510 (47.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 10  bytes 576 (576.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 576 (576.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
# 设置计算节点
[root@compute ~]# ifconfig ens33 promisc
[root@compute ~]#  ifconfig
ens33: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500
        inet 192.168.88.129  netmask 255.255.255.0  broadcast 192.168.88.255
        inet6 fe80::a362:d39f:9b5:5a16  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:fd:15:82  txqueuelen 1000  (Ethernet)
        RX packets 721  bytes 63899 (62.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 529  bytes 45943 (44.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 10  bytes 576 (576.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 576 (576.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

网卡信息中出现“PROMISC”字样,则表示成功设置为混杂模式,凡是通过该网卡的数据均可被该网卡接收。

再设置开机后混杂模式自动生效

# 控制节点执行
[root@controller ~]# echo 'ifconfig ens33 promisc' >> /etc/profile
[root@controller ~]# tail -1 /etc/profile
ifconfig ens33 promisc
# 计算节点执行
[root@compute ~]# echo 'ifconfig ens33 promisc' >> /etc/profile
[root@compute ~]# tail -1 /etc/profile
ifconfig ens33 promisc
1.2加载桥接模式防火墙模块

网络过滤器(Netfilter)是Linux内核中的一个软件框架,用于管理网络数据包,能网络地址转换,还能修改数据包、数据包过滤等。

# 1.修改系统参数配置文件
# 控制节点修改
[root@controller ~]# echo 'net.bridge.bridge-nf-call-iptables = 1
> net.bridge.bridge-nf-call-ip6tables = 1' >> /etc/sysctl.conf

[root@controller ~]# tail -n 2 /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
# 计算节点修改
[root@compute ~]# echo 'net.bridge.bridge-nf-call-iptables = 1
> > net.bridge.bridge-nf-call-ip6tables = 1' >> /etc/sysctl.conf

[root@compute ~]# tail -n 2 /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
# 2.分别加载br_netfilter模块
[root@controller ~]#  modprobe br_netfilter
[root@compute ~]#  modprobe br_netfilter
# 3.分别检查模块加载
[root@controller ~]# sysctl -p
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1

[root@compute ~]# modprobe br_netfilter
[root@compute ~]# sysctl -p
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1

2、控制节点Neutron服务安装配置

2.1安装Neutron软件包

openstack-neutron:neutron-server模块的包。

openstack-neutron-ml2 :ML2插件的包。

openstack-neutron-linuxbridge:网桥和网络提供者相关的软件包。

# 安装相关软件包
# 阿里云上有包dnsmasq-utils-2.76-17.el7_9.3.x86_64.rpm缺失
[root@controller ~]# yum install -y wget
[root@controller ~]# wget http://mirror.centos.org/centos/7/updates/x86_64/Packages/dnsmasq-utils-2.76-17.el7_9.3.x86_64.rpm
--2023-04-24 10:07:21--  http://mirror.centos.org/centos/7/updates/x86_64/Packages/dnsmasq-utils-2.76-17.el7_9.3.x86_64.rpm
Resolving mirror.centos.org (mirror.centos.org)... 147.75.93.85, 2406:da18:39f:a01:ad53:d67:8e75:43ef
Connecting to mirror.centos.org (mirror.centos.org)|147.75.93.85|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 32040 (31K) [application/x-rpm]
Saving to: ‘dnsmasq-utils-2.76-17.el7_9.3.x86_64.rpm’

100%[================================================>] 32,040       208KB/s   in 0.2s   

2023-04-24 10:07:21 (208 KB/s) - ‘dnsmasq-utils-2.76-17.el7_9.3.x86_64.rpm’ saved [32040/32040]

[root@controller ~]# ls
admin-login      cirros-0.4.0-x86_64-disk.img
anaconda-ks.cfg  dnsmasq-utils-2.76-17.el7_9.3.x86_64.rpm
[root@controller ~]# rpm -ivh dnsmasq-utils-2.76-17.el7_9.3.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:dnsmasq-utils-2.76-17.el7_9.3    ################################# [100%]
[root@controller ~]# 
[root@controller ~]# 
[root@controller ~]# 
[root@controller ~]# 
[root@controller ~]# 
[root@controller ~]# yum install -y openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package openstack-neutron.noarch 1:15.3.4-1.el7 will be installed
--> Processing Dependency: openstack-neutron-common = 1:15.3.4-1.el7 for package: 
    ......
  python2-weakrefmethod.noarch 0:1.0.2-3.el7                                              
  radvd.x86_64 0:2.17-3.el7                                                               
  zeromq.x86_64 0:4.0.5-4.el7                                                             

Complete!
# 检查用户信息和用户组信息
[root@controller ~]# cat /etc/passwd | grep neutron
neutron:x:990:987:OpenStack Neutron Daemons:/var/lib/neutron:/sbin/nologin
[root@controller ~]# cat /etc/group | grep neutron
neutron:x:987:
2.2创建Neutron数据库并授权

支持Neutron组件的数据库只有一个,一般命名为neutron

# 1.登录并创建数据库
[root@controller ~]# mysql -u root -pqwerty
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database neutron;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| neutron            |
| nova               |
| nova_api           |
| nova_cell0         |
| performance_schema |
| placement          |
+--------------------+
10 rows in set (0.011 sec)
# 2.为数据库授权本地和远程管理权限
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> quit
Bye
2.3修改Neutron服务相关配置文件
配置Neutron组件信息
修改“[DEFAULT]”与“[keystone_authtoken]”部分,实现与Keystone交互
修改[database]部分,实现与数据库连接
修改“[DEFAULT]”部分,实现与消息队列交互及核心插件等
修改“[oslo_concurrency]”,配置锁路径
# 备份配置文件
[root@controller ~]# cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
# 去掉配置文件注释和空行
[root@controller ~]# grep -Ev '^$|#' /etc/neutron/neutron.conf.bak > /etc/neutron/neutron.conf
# 编辑配置文件
[root@controller ~]# vi /etc/neutron/neutron.conf

[DEFAULT]
core_plugin = ml2
service_plugins = router
[keystone_authtoken]
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = project
username = neutron
password = 000000

[oslo_concurrency]
lock_path = /var/lib/nova/tmp

[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[privsep]
[ssl]
[nova]
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = project
username = nova
password = 000000
region_name = RegionOne
server_proxyclient_address = 192.168.88.128

2.修改二层模块插件(ML2 Plugin)的配置文件,二层模块插件(ML2 Plugin)是Neutron的核心插件.

# 备份配置文件
[root@controller ~]# cp /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini.bak
# 去掉配置文件注释和空行
[root@controller ~]# grep -Ev '^$|#' /etc/neutron/plugins/ml2/ml2_conf.ini.bak > /etc/neutron/plugins/ml2/ml2_conf.ini
# 编辑配置文件
[root@controller ~]# vi /etc/neutron/plugins/ml2/ml2_conf.ini

[DEFAULT]

[ml2]
type_drivers = flat,local,vlan,gre,vxlan,geneve
tenant_network_types = local,flat
mechanism_drivers = linuxbridge
extension_drivers = port_security

[ml2_type_flat]
flat_networks = provider

[securitygroup]
enable_ipset = true
# 设置映射启用ML2插件
[root@controller ~]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
[root@controller ~]# ll /etc/neutron/
total 76
drwxr-xr-x 11 root root      260 Apr 24 10:07 conf.d
-rw-r-----  1 root neutron  6524 May 11  2021 dhcp_agent.ini
drwxr-xr-x  2 root root        6 May 11  2021 kill_scripts
-rw-r-----  1 root neutron  6524 May 11  2021 l3_agent.ini
-rw-r-----  1 root neutron 11011 May 11  2021 metadata_agent.ini
-rw-r-----  1 root neutron   967 Apr 24 10:16 neutron.conf
-rw-r-----  1 root root    39708 Apr 24 10:13 neutron.conf.bak
lrwxrwxrwx  1 root root       37 Apr 24 10:18 plugin.ini -> /etc/neutron/plugins/ml2/ml2_conf.ini
drwxr-xr-x  3 root root       17 Apr 24 10:07 plugins
-rw-r--r--  1 root root     1298 May 10  2021 rootwrap.conf

3.修改网桥代理的配置文件要在ML2的配置文件中设置机制驱动(mechanism_drivers)的值为 linuxbridge

# 1.备份配置文件
[root@controller ~]# cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak

# 2.删除注释和空行
[root@controller ~]# grep -Ev '^$|#' /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak > /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[root@controller ~]# cat /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[DEFAULT]
# 3.编辑配置文件
[root@controller ~]# vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[DEFAULT]
[linux_bridge]
physical_interface_mappings = provider:ens33

[vxlan]
enable_vxlan = false

[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

4.修改DHCP代理配置文件dhcp-agent 为云主机提供了自动分配IP地址的服务。

# 1.备份和去除空行和注释配置文件
[root@controller ~]# cp /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.bak
[root@controller ~]# grep -Ev '^$|#' /etc/neutron/dhcp_agent.ini.bak > /etc/neutron/dhcp_agent.ini
[root@controller ~]# cat /etc/neutron/dhcp_agent.ini
[DEFAULT]
# 2.编辑配置文件
[root@controller ~]# vi /etc/neutron/dhcp_agent.ini

[DEFAULT]
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true

5.修改元数据代理的配置文件,云主机运行在计算节点,运行过程中需要和控制节点 nova-api 模块交互,交互需要使用 neutron-metadata-agent

# 1.备份和去除空行注释配置文件
[root@controller ~]# cp /etc/neutron/metadata_agent.ini /etc/neutron/metadata_agent.ini.bak
[root@controller ~]# grep -Ev '^$|#' /etc/neutron/metadata_agent.ini.bak  > /etc/neutron/metadata_agent.ini
[root@controller ~]# cat /etc/neutron/metadata_agent.ini
[DEFAULT]
[cache]
# 2.编辑配置文件
[root@controller ~]# vi /etc/neutron/metadata_agent.ini

[DEFAULT]
nova_metadata_host = controller
metadata_proxy_shared_secret = METADATA_SECRET

[cache]

6.修改nova配置文件
Nova处于云平台的核心位置,需要在Nova配置文件中指明如何和Neutron进行交互。

# 注意文件目录
[root@controller ~]# echo '
> [neutron]
> auth_url = http://controller:5000
> auth_type = password
> project_domain_name = Default
> user_domain_name = Default
> region_name = RegionOne
> project_name = project
> username = neutron
> password = 000000
> service_metadata_proxy = true
> metadata_proxy_shared_secret = METADATA_SECRET
> ' >> /etc/nova/nova.conf
2.4初始化数据库

Neutron数据库同步,将安装文件中的数据库的表信息填充到数据库中

# 数据库同步
[root@controller neutron]# 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
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
/usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1280, u"Name 'alembic_version_pkc' ignored for PRIMARY key.")
  result = self._query(query)
  Running upgrade for neutron ...
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> kilo
INFO  [alembic.runtime.migration] Running upgrade kilo -> 354db87e3225
INFO  [alembic.runtime.migration] Running upgrade 354db87e3225 -> 599c6a226151
INFO  [alembic.runtime.migration] Running upgrade 599c6a226151 -> 52c5312f6baf
INFO  [alembic.runtime.migration] Running upgrade 52c5312f6baf -> 313373c0ffee
INFO  [alembic.runtime.migration] Running upgrade 313373c0ffee -> 8675309a5c4f
INFO  [alembic.runtime.migration] Running upgrade 8675309a5c4f -> 45f955889773
INFO  [alembic.runtime.migration] Running upgrade 45f955889773 -> 26c371498592
INFO  [alembic.runtime.migration] Running upgrade 26c371498592 -> 1c844d1677f7
INFO  [alembic.runtime.migration] Running upgrade 1c844d1677f7 -> 1b4c6e320f79
INFO  [alembic.runtime.migration] Running upgrade 1b4c6e320f79 -> 48153cb5f051
INFO  [alembic.runtime.migration] Running upgrade 48153cb5f051 -> 9859ac9c136
INFO  [alembic.runtime.migration] Running upgrade 9859ac9c136 -> 34af2b5c5a59
INFO  [alembic.runtime.migration] Running upgrade 34af2b5c5a59 -> 59cb5b6cf4d
INFO  [alembic.runtime.migration] Running upgrade 59cb5b6cf4d -> 13cfb89f881a
INFO  [alembic.runtime.migration] Running upgrade 13cfb89f881a -> 32e5974ada25
INFO  [alembic.runtime.migration] Running upgrade 32e5974ada25 -> ec7fcfbf72ee
INFO  [alembic.runtime.migration] Running upgrade ec7fcfbf72ee -> dce3ec7a25c9
INFO  [alembic.runtime.migration] Running upgrade dce3ec7a25c9 -> c3a73f615e4
INFO  [alembic.runtime.migration] Running upgrade c3a73f615e4 -> 659bf3d90664
INFO  [alembic.runtime.migration] Running upgrade 659bf3d90664 -> 1df244e556f5
INFO  [alembic.runtime.migration] Running upgrade 1df244e556f5 -> 19f26505c74f
INFO  [alembic.runtime.migration] Running upgrade 19f26505c74f -> 15be73214821
INFO  [alembic.runtime.migration] Running upgrade 15be73214821 -> b4caf27aae4
INFO  [alembic.runtime.migration] Running upgrade b4caf27aae4 -> 15e43b934f81
INFO  [alembic.runtime.migration] Running upgrade 15e43b934f81 -> 31ed664953e6
INFO  [alembic.runtime.migration] Running upgrade 31ed664953e6 -> 2f9e956e7532
INFO  [alembic.runtime.migration] Running upgrade 2f9e956e7532 -> 3894bccad37f
INFO  [alembic.runtime.migration] Running upgrade 3894bccad37f -> 0e66c5227a8a
INFO  [alembic.runtime.migration] Running upgrade 0e66c5227a8a -> 45f8dd33480b
INFO  [alembic.runtime.migration] Running upgrade 45f8dd33480b -> 5abc0278ca73
INFO  [alembic.runtime.migration] Running upgrade 5abc0278ca73 -> d3435b514502
INFO  [alembic.runtime.migration] Running upgrade d3435b514502 -> 30107ab6a3ee
INFO  [alembic.runtime.migration] Running upgrade 30107ab6a3ee -> c415aab1c048
INFO  [alembic.runtime.migration] Running upgrade c415aab1c048 -> a963b38d82f4
INFO  [alembic.runtime.migration] Running upgrade kilo -> 30018084ec99
INFO  [alembic.runtime.migration] Running upgrade 30018084ec99 -> 4ffceebfada
INFO  [alembic.runtime.migration] Running upgrade 4ffceebfada -> 5498d17be016
INFO  [alembic.runtime.migration] Running upgrade 5498d17be016 -> 2a16083502f3
INFO  [alembic.runtime.migration] Running upgrade 2a16083502f3 -> 2e5352a0ad4d
INFO  [alembic.runtime.migration] Running upgrade 2e5352a0ad4d -> 11926bcfe72d
INFO  [alembic.runtime.migration] Running upgrade 11926bcfe72d -> 4af11ca47297
INFO  [alembic.runtime.migration] Running upgrade 4af11ca47297 -> 1b294093239c
INFO  [alembic.runtime.migration] Running upgrade 1b294093239c -> 8a6d8bdae39
INFO  [alembic.runtime.migration] Running upgrade 8a6d8bdae39 -> 2b4c2465d44b
INFO  [alembic.runtime.migration] Running upgrade 2b4c2465d44b -> e3278ee65050
INFO  [alembic.runtime.migration] Running upgrade e3278ee65050 -> c6c112992c9
INFO  [alembic.runtime.migration] Running upgrade c6c112992c9 -> 5ffceebfada
INFO  [alembic.runtime.migration] Running upgrade 5ffceebfada -> 4ffceebfcdc
INFO  [alembic.runtime.migration] Running upgrade 4ffceebfcdc -> 7bbb25278f53
INFO  [alembic.runtime.migration] Running upgrade 7bbb25278f53 -> 89ab9a816d70
INFO  [alembic.runtime.migration] Running upgrade a963b38d82f4 -> 3d0e74aa7d37
INFO  [alembic.runtime.migration] Running upgrade 3d0e74aa7d37 -> 030a959ceafa
INFO  [alembic.runtime.migration] Running upgrade 030a959ceafa -> a5648cfeeadf
INFO  [alembic.runtime.migration] Running upgrade a5648cfeeadf -> 0f5bef0f87d4
INFO  [alembic.runtime.migration] Running upgrade 0f5bef0f87d4 -> 67daae611b6e
INFO  [alembic.runtime.migration] Running upgrade 89ab9a816d70 -> c879c5e1ee90
INFO  [alembic.runtime.migration] Running upgrade c879c5e1ee90 -> 8fd3918ef6f4
INFO  [alembic.runtime.migration] Running upgrade 8fd3918ef6f4 -> 4bcd4df1f426
INFO  [alembic.runtime.migration] Running upgrade 4bcd4df1f426 -> b67e765a3524
INFO  [alembic.runtime.migration] Running upgrade 67daae611b6e -> 6b461a21bcfc
INFO  [alembic.runtime.migration] Running upgrade 6b461a21bcfc -> 5cd92597d11d
INFO  [alembic.runtime.migration] Running upgrade 5cd92597d11d -> 929c968efe70
INFO  [alembic.runtime.migration] Running upgrade 929c968efe70 -> a9c43481023c
INFO  [alembic.runtime.migration] Running upgrade a9c43481023c -> 804a3c76314c
INFO  [alembic.runtime.migration] Running upgrade 804a3c76314c -> 2b42d90729da
INFO  [alembic.runtime.migration] Running upgrade 2b42d90729da -> 62c781cb6192
INFO  [alembic.runtime.migration] Running upgrade 62c781cb6192 -> c8c222d42aa9
INFO  [alembic.runtime.migration] Running upgrade c8c222d42aa9 -> 349b6fd605a6
INFO  [alembic.runtime.migration] Running upgrade 349b6fd605a6 -> 7d32f979895f
INFO  [alembic.runtime.migration] Running upgrade 7d32f979895f -> 594422d373ee
INFO  [alembic.runtime.migration] Running upgrade 594422d373ee -> 61663558142c
INFO  [alembic.runtime.migration] Running upgrade 61663558142c -> 867d39095bf4, port forwarding
INFO  [alembic.runtime.migration] Running upgrade 867d39095bf4 -> d72db3e25539, modify uniq port forwarding
INFO  [alembic.runtime.migration] Running upgrade d72db3e25539 -> cada2437bf41
INFO  [alembic.runtime.migration] Running upgrade cada2437bf41 -> 195176fb410d, router gateway IP QoS
INFO  [alembic.runtime.migration] Running upgrade 195176fb410d -> fb0167bd9639
INFO  [alembic.runtime.migration] Running upgrade fb0167bd9639 -> 0ff9e3881597
INFO  [alembic.runtime.migration] Running upgrade 0ff9e3881597 -> 9bfad3f1e780
INFO  [alembic.runtime.migration] Running upgrade 9bfad3f1e780 -> 63fd95af7dcd
INFO  [alembic.runtime.migration] Running upgrade 63fd95af7dcd -> c613d0b82681
INFO  [alembic.runtime.migration] Running upgrade b67e765a3524 -> a84ccf28f06a
INFO  [alembic.runtime.migration] Running upgrade a84ccf28f06a -> 7d9d8eeec6ad
INFO  [alembic.runtime.migration] Running upgrade 7d9d8eeec6ad -> a8b517cff8ab
INFO  [alembic.runtime.migration] Running upgrade a8b517cff8ab -> 3b935b28e7a0
INFO  [alembic.runtime.migration] Running upgrade 3b935b28e7a0 -> b12a3ef66e62
INFO  [alembic.runtime.migration] Running upgrade b12a3ef66e62 -> 97c25b0d2353
INFO  [alembic.runtime.migration] Running upgrade 97c25b0d2353 -> 2e0d7a8a1586
INFO  [alembic.runtime.migration] Running upgrade 2e0d7a8a1586 -> 5c85685d616d
  OK
# 数据库验证
[root@controller neutron]# mysql -uroot -pqwerty
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 26
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use neutron;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [neutron]> show tables;
+-----------------------------------------+
| Tables_in_neutron                       |
+-----------------------------------------+
| address_scopes                          |
| agents                                  |
| alembic_version                         |
| allowedaddresspairs                     |
| arista_provisioned_nets                 |
| arista_provisioned_tenants              |
| arista_provisioned_vms                  |
| auto_allocated_topologies               |
| bgp_peers                               |
| bgp_speaker_dragent_bindings            |
| bgp_speaker_network_bindings            |
| bgp_speaker_peer_bindings               |
| bgp_speakers                            |
| brocadenetworks                         |
| brocadeports                            |
| cisco_csr_identifier_map                |
| cisco_hosting_devices                   |
| cisco_ml2_apic_contracts                |
| cisco_ml2_apic_host_links               |
| cisco_ml2_apic_names                    |
| cisco_ml2_n1kv_network_bindings         |
| cisco_ml2_n1kv_network_profiles         |
| cisco_ml2_n1kv_policy_profiles          |
| cisco_ml2_n1kv_port_bindings            |
| cisco_ml2_n1kv_profile_bindings         |
| cisco_ml2_n1kv_vlan_allocations         |
| cisco_ml2_n1kv_vxlan_allocations        |
| cisco_ml2_nexus_nve                     |
| cisco_ml2_nexusport_bindings            |
| cisco_port_mappings                     |
| cisco_router_mappings                   |
| conntrack_helpers                       |
| consistencyhashes                       |
| default_security_group                  |
| dnsnameservers                          |
| dvr_host_macs                           |
| externalnetworks                        |
| extradhcpopts                           |
| firewall_policies                       |
| firewall_rules                          |
| firewalls                               |
| flavors                                 |
| flavorserviceprofilebindings            |
| floatingipdnses                         |
| floatingips                             |
| ha_router_agent_port_bindings           |
| ha_router_networks                      |
| ha_router_vrid_allocations              |
| healthmonitors                          |
| ikepolicies                             |
| ipallocationpools                       |
| ipallocations                           |
| ipamallocationpools                     |
| ipamallocations                         |
| ipamsubnets                             |
| ipsec_site_connections                  |
| ipsecpeercidrs                          |
| ipsecpolicies                           |
| logs                                    |
| lsn                                     |
| lsn_port                                |
| maclearningstates                       |
| members                                 |
| meteringlabelrules                      |
| meteringlabels                          |
| ml2_brocadenetworks                     |
| ml2_brocadeports                        |
| ml2_distributed_port_bindings           |
| ml2_flat_allocations                    |
| ml2_geneve_allocations                  |
| ml2_geneve_endpoints                    |
| ml2_gre_allocations                     |
| ml2_gre_endpoints                       |
| ml2_nexus_vxlan_allocations             |
| ml2_nexus_vxlan_mcast_groups            |
| ml2_port_binding_levels                 |
| ml2_port_bindings                       |
| ml2_ucsm_port_profiles                  |
| ml2_vlan_allocations                    |
| ml2_vxlan_allocations                   |
| ml2_vxlan_endpoints                     |
| multi_provider_networks                 |
| network_segment_ranges                  |
| networkconnections                      |
| networkdhcpagentbindings                |
| networkdnsdomains                       |
| networkgatewaydevicereferences          |
| networkgatewaydevices                   |
| networkgateways                         |
| networkqueuemappings                    |
| networkrbacs                            |
| networks                                |
| networksecuritybindings                 |
| networksegments                         |
| neutron_nsx_network_mappings            |
| neutron_nsx_port_mappings               |
| neutron_nsx_router_mappings             |
| neutron_nsx_security_group_mappings     |
| nexthops                                |
| nsxv_edge_dhcp_static_bindings          |
| nsxv_edge_vnic_bindings                 |
| nsxv_firewall_rule_bindings             |
| nsxv_internal_edges                     |
| nsxv_internal_networks                  |
| nsxv_port_index_mappings                |
| nsxv_port_vnic_mappings                 |
| nsxv_router_bindings                    |
| nsxv_router_ext_attributes              |
| nsxv_rule_mappings                      |
| nsxv_security_group_section_mappings    |
| nsxv_spoofguard_policy_network_mappings |
| nsxv_tz_network_bindings                |
| nsxv_vdr_dhcp_bindings                  |
| nuage_net_partition_router_mapping      |
| nuage_net_partitions                    |
| nuage_provider_net_bindings             |
| nuage_subnet_l2dom_mapping              |
| poolloadbalanceragentbindings           |
| poolmonitorassociations                 |
| pools                                   |
| poolstatisticss                         |
| portbindingports                        |
| portdataplanestatuses                   |
| portdnses                               |
| portforwardings                         |
| portqueuemappings                       |
| ports                                   |
| portsecuritybindings                    |
| portuplinkstatuspropagation             |
| providerresourceassociations            |
| provisioningblocks                      |
| qos_bandwidth_limit_rules               |
| qos_dscp_marking_rules                  |
| qos_fip_policy_bindings                 |
| qos_minimum_bandwidth_rules             |
| qos_network_policy_bindings             |
| qos_policies                            |
| qos_policies_default                    |
| qos_port_policy_bindings                |
| qos_router_gw_policy_bindings           |
| qospolicyrbacs                          |
| qosqueues                               |
| quotas                                  |
| quotausages                             |
| reservations                            |
| resourcedeltas                          |
| router_extra_attributes                 |
| routerl3agentbindings                   |
| routerports                             |
| routerroutes                            |
| routerrules                             |
| routers                                 |
| securitygroupportbindings               |
| securitygrouprbacs                      |
| securitygrouprules                      |
| securitygroups                          |
| segmenthostmappings                     |
| serviceprofiles                         |
| sessionpersistences                     |
| standardattributes                      |
| subnet_service_types                    |
| subnetpoolprefixes                      |
| subnetpools                             |
| subnetroutes                            |
| subnets                                 |
| subports                                |
| tags                                    |
| trunks                                  |
| tz_network_bindings                     |
| vcns_router_bindings                    |
| vips                                    |
| vpnservices                             |
+-----------------------------------------+
172 rows in set (0.001 sec)

3、Neutron组件初始化

3.1创建Neutron用户并分配角色
# 模拟登录
[root@controller neutron]# source admin-login 
# 在 default 域创建neutron用户 
[root@controller neutron]# openstack user create --domain default --password 000000 neutron
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 3e88b5246b0e4c36849b4e1113bdc79a |
| name                | neutron                          |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
# 给neutron用户分配admin角色
[root@controller neutron]# openstack role add --project project --user neutron admin
# 验证
[root@controller neutron]# openstack role assignment list
+----------------------------------+----------------------------------+-------+----------------------------------+--------+--------+-----------+
| Role                             | User                             | Group | Project                          | Domain | System | Inherited |
+----------------------------------+----------------------------------+-------+----------------------------------+--------+--------+-----------+
| e63ef7f4a345451fb7db49a7ca255c08 | 0b425e2bb340446387615dd5967a9695 |       | 011fb8f2db554f9193f95c1b6b64d4e7 |        |        | False     |
| e63ef7f4a345451fb7db49a7ca255c08 | 2dd58fef03684eff8e182f71aeb04d23 |       | 011fb8f2db554f9193f95c1b6b64d4e7 |        |        | False     |
| e63ef7f4a345451fb7db49a7ca255c08 | 3e88b5246b0e4c36849b4e1113bdc79a |       | 011fb8f2db554f9193f95c1b6b64d4e7 |        |        | False     |
| e63ef7f4a345451fb7db49a7ca255c08 | 93a47b4afdc3448e876d1d2032f8fcba |       | 18196711d4294cf7be4729aac1f947f2 |        |        | False     |
| e63ef7f4a345451fb7db49a7ca255c08 | d2c660e396f34bd7a2f2d4d29b263d5c |       | 011fb8f2db554f9193f95c1b6b64d4e7 |        |        | False     |
| e63ef7f4a345451fb7db49a7ca255c08 | 93a47b4afdc3448e876d1d2032f8fcba |       |                                  |        | all    | False     |
+----------------------------------+----------------------------------+-------+----------------------------------+--------+--------+-----------+
3.2创建neutron服务及服务端点
# 创建network类型neutron服务
[root@controller neutron]# openstack service create --name neutron network
+---------+----------------------------------+
| Field   | Value                            |
+---------+----------------------------------+
| enabled | True                             |
| id      | d2de090bf8894ad29ca1b4f5d86dba67 |
| name    | neutron                          |
| type    | network                          |
+---------+----------------------------------+
# 创建3个服务端点
[root@controller neutron]# openstack endpoint create --region RegionOne neutron public http://controller:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | e4e3462d9ee2467d8f8e5d700f2df90e |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d2de090bf8894ad29ca1b4f5d86dba67 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://controller:9696           |
+--------------+----------------------------------+
[root@controller neutron]#  openstack endpoint create --region RegionOne neutron internal http://controller:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 4c5f279855734195826a7606683c4de1 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d2de090bf8894ad29ca1b4f5d86dba67 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://controller:9696           |
+--------------+----------------------------------+
[root@controller neutron]# openstack endpoint create --region RegionOne neutron admin http://controller:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | d4eccedc7cec48d1ac0c8c39415f6cb8 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d2de090bf8894ad29ca1b4f5d86dba67 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://controller:9696           |
+--------------+----------------------------------+
3.3启动控制节点上的Neutron服务

由于修改了Nova的配置文件,启动Neutron服务前,需要先重启Nova服务。

# 重启nova服务
[root@controller neutron]# systemctl restart openstack-nova-api
# 服务开机启动

[root@controller neutron]# systemctl enable neutron-server neutron-linuxbridge-agent neutron-dhcp-agent neutron-metadata-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-server.service to /usr/lib/systemd/system/neutron-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-linuxbridge-agent.service to /usr/lib/systemd/system/neutron-linuxbridge-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-dhcp-agent.service to /usr/lib/systemd/system/neutron-dhcp-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-metadata-agent.service to /usr/lib/systemd/system/neutron-metadata-agent.service.
[root@controller neutron]# systemctl start neutron-server neutron-linuxbridge-agent neutron-dhcp-agent neutron-metadata-agent

4、检测控制节点上的Neutron服务

# 方法一:查看端口占用情况
[root@controller neutron]# netstat -tnlup|grep 9696
tcp        0      0 0.0.0.0:9696            0.0.0.0:*               LISTEN      6430/server.log     
# 方法二:检验服务端点
[root@controller neutron]# curl http://controller:9696
{"versions": [{"status": "CURRENT", "id": "v2.0", "links": [{"href": "http://controller:9696/v2.0/", "rel": "self"}]}]}
# 方法三:查看服务运行状态
[root@controller neutron]# systemctl status neutron-server
● neutron-server.service - OpenStack Neutron Server
   Loaded: loaded (/usr/lib/systemd/system/neutron-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2023-04-24 11:34:55 CST; 51s ago
 Main PID: 6430 (/usr/bin/python)
   CGroup: /system.slice/neutron-server.service
           ├─6430 /usr/bin/python2 /usr/bin/neutron-server --config-file /usr...
           ├─6501 /usr/bin/python2 /usr/bin/neutron-server --config-file /usr...
           ├─6502 neutron-server: rpc worker (/usr/bin/python2 /usr/bin/neutr...
           ├─6503 neutron-server: rpc worker (/usr/bin/python2 /usr/bin/neutr...
           └─6504 neutron-server: rpc worker (/usr/bin/python2 /usr/bin/neutr...

Apr 24 11:34:51 controller systemd[1]: Starting OpenStack Neutron Server...
Apr 24 11:34:53 controller neutron-server[6430]: /usr/lib/python2.7/site-pac....
Apr 24 11:34:53 controller neutron-server[6430]: return pkg_resources.EntryP...)
Apr 24 11:34:55 controller systemd[1]: Started OpenStack Neutron Server.
Hint: Some lines were ellipsized, use -l to show in full.

5、安装和配置计算节点的Neutron服务

5.1安装Neutron软件包
# 计算节点安装软件包,包含网桥和网络提供者的相关软件
[root@compute opt]# yum install -y openstack-neutron-linuxbridge
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
train                                                               | 2.9 kB  00:00:00     
virt                                                                | 2.9 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package openstack-neutron-linuxbridge.noarch 1:15.3.4-1.el7 will be installed
--> Processing Dependency: openstack-neutron-common = 1:15.3.4-1.el7 for package: 1:openstack-neutron-linuxbridge-15.3.4-1.el7.noarch
--> Running transaction check
---> Package openstack-neutron-common.noarch 1:15.3.4-1.el7 will be installed
--> Processing Dependency: python2-neutron = 1:15.3.4-1.el7 for package: 1:openstack-neutron-common-15.3.4-1.el7.noarch
--> Running transaction check
---> Package python2-neutron.noarch 1:15.3.4-1.el7 will be installed
--> Processing Dependency: python2-weakrefmethod >= 1.0.2 for package: 1:python2-neutron-15.3.4-1.el7.noarch
--> Processing Dependency: python2-pecan >= 1.3.2 for package: 1:python2-neutron-15.3.4-1.el7.noarch
--> Processing Dependency: python2-osprofiler >= 2.3.0 for package: 1:python2-neutron-15.3.4-1.el7.noarch
--> Processing Dependency: python2-os-xenapi >= 0.3.1 for package: 1:python2-neutron-15.3.4-1.el7.noarch
--> Processing Dependency: python2-os-ken >= 0.3.1 for package: 1:python2-neutron-15.3.4-1.el7.noarch
--> Processing Dependency: python2-neutron-lib >= 1.29.1 for package: 1:python2-neutron-15.3.4-1.el7.noarch
--> Processing Dependency: python2-designateclient >= 2.7.0 for package: 1:python2-neutron-15.3.4-1.el7.noarch
--> Processing Dependency: python-httplib2 >= 0.9.1 for package: 1:python2-neutron-15.3.4-1.el7.noarch
--> Running transaction check
---> Package python-httplib2.noarch 0:0.9.2-1.el7 will be installed
---> Package python2-designateclient.noarch 0:3.0.0-1.el7 will be installed
---> Package python2-neutron-lib.noarch 0:1.29.1-1.el7 will be installed
--> Processing Dependency: python-setproctitle for package: python2-neutron-lib-1.29.1-1.el7.noarch
---> Package python2-os-ken.noarch 0:0.4.1-1.el7 will be installed
--> Processing Dependency: python2-tinyrpc for package: python2-os-ken-0.4.1-1.el7.noarch
---> Package python2-os-xenapi.noarch 0:0.3.4-1.el7 will be installed
---> Package python2-osprofiler.noarch 0:2.8.2-1.el7 will be installed
---> Package python2-pecan.noarch 0:1.3.2-1.el7 will be installed
--> Processing Dependency: python2-singledispatch for package: python2-pecan-1.3.2-1.el7.noarch
--> Processing Dependency: python-webtest for package: python2-pecan-1.3.2-1.el7.noarch
--> Processing Dependency: python-simplegeneric for package: python2-pecan-1.3.2-1.el7.noarch
--> Processing Dependency: python-logutils for package: python2-pecan-1.3.2-1.el7.noarch
---> Package python2-weakrefmethod.noarch 0:1.0.2-3.el7 will be installed
--> Running transaction check
---> Package python-logutils.noarch 0:0.3.3-3.el7 will be installed
---> Package python-simplegeneric.noarch 0:0.8-7.el7 will be installed
---> Package python-webtest.noarch 0:2.0.23-1.el7 will be installed
--> Processing Dependency: python-waitress for package: python-webtest-2.0.23-1.el7.noarch
--> Processing Dependency: python-beautifulsoup4 for package: python-webtest-2.0.23-1.el7.noarch
---> Package python2-setproctitle.x86_64 0:1.1.10-12.el7 will be installed
---> Package python2-singledispatch.noarch 0:3.4.0.3-4.el7 will be installed
---> Package python2-tinyrpc.noarch 0:0.5-4.20170523git1f38ac.el7 will be installed
--> Processing Dependency: python-zmq for package: python2-tinyrpc-0.5-4.20170523git1f38ac.el7.noarch
--> Processing Dependency: python-werkzeug for package: python2-tinyrpc-0.5-4.20170523git1f38ac.el7.noarch
--> Processing Dependency: python-gevent for package: python2-tinyrpc-0.5-4.20170523git1f38ac.el7.noarch
--> Running transaction check
---> Package python-beautifulsoup4.noarch 0:4.6.0-1.el7 will be installed
---> Package python-waitress.noarch 0:0.8.9-5.el7 will be installed
---> Package python-zmq.x86_64 0:14.7.0-2.el7 will be installed
--> Processing Dependency: libzmq.so.4()(64bit) for package: python-zmq-14.7.0-2.el7.x86_64
---> Package python2-gevent.x86_64 0:1.1.2-2.el7 will be installed
--> Processing Dependency: libev.so.4()(64bit) for package: python2-gevent-1.1.2-2.el7.x86_64
--> Processing Dependency: libcares.so.2()(64bit) for package: python2-gevent-1.1.2-2.el7.x86_64
---> Package python2-werkzeug.noarch 0:0.14.1-3.el7 will be installed
--> Running transaction check
---> Package c-ares.x86_64 0:1.10.0-3.el7 will be installed
---> Package libev.x86_64 0:4.15-7.el7 will be installed
---> Package zeromq.x86_64 0:4.0.5-4.el7 will be installed
--> Processing Dependency: libpgm-5.2.so.0()(64bit) for package: zeromq-4.0.5-4.el7.x86_64
--> Running transaction check
---> Package openpgm.x86_64 0:5.2.122-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================
 Package                          Arch      Version                        Repository
                                                                                      Size
===========================================================================================
Installing:
 openstack-neutron-linuxbridge    noarch    1:15.3.4-1.el7                 train      13 k
Installing for dependencies:
 c-ares                           x86_64    1.10.0-3.el7                   base       78 k
 libev                            x86_64    4.15-7.el7                     extras     44 k
 openpgm                          x86_64    5.2.122-2.el7                  train     172 k
 openstack-neutron-common         noarch    1:15.3.4-1.el7                 train     198 k
 python-beautifulsoup4            noarch    4.6.0-1.el7                    train     171 k
 python-httplib2                  noarch    0.9.2-1.el7                    extras    115 k
 python-logutils                  noarch    0.3.3-3.el7                    train      42 k
 python-simplegeneric             noarch    0.8-7.el7                      train      12 k
 python-waitress                  noarch    0.8.9-5.el7                    train     152 k
 python-webtest                   noarch    2.0.23-1.el7                   train      84 k
 python-zmq                       x86_64    14.7.0-2.el7                   train     495 k
 python2-designateclient          noarch    3.0.0-1.el7                    train      88 k
 python2-gevent                   x86_64    1.1.2-2.el7                    train     443 k
 python2-neutron                  noarch    1:15.3.4-1.el7                 train     2.3 M
 python2-neutron-lib              noarch    1.29.1-1.el7                   train     362 k
 python2-os-ken                   noarch    0.4.1-1.el7                    train     2.2 M
 python2-os-xenapi                noarch    0.3.4-1.el7                    train      74 k
 python2-osprofiler               noarch    2.8.2-1.el7                    train     125 k
 python2-pecan                    noarch    1.3.2-1.el7                    train     268 k
 python2-setproctitle             x86_64    1.1.10-12.el7                  train      19 k
 python2-singledispatch           noarch    3.4.0.3-4.el7                  train      18 k
 python2-tinyrpc                  noarch    0.5-4.20170523git1f38ac.el7    train      32 k
 python2-weakrefmethod            noarch    1.0.2-3.el7                    train      13 k
 python2-werkzeug                 noarch    0.14.1-3.el7                   train     466 k
 zeromq                           x86_64    4.0.5-4.el7                    train     434 k

Transaction Summary
===========================================================================================
Install  1 Package (+25 Dependent packages)

Total size: 8.3 M
Total download size: 8.1 M
Installed size: 49 M
Downloading packages:
-------------------------------------------------------------------------------------------
Total                                                      8.2 MB/s | 8.1 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python2-weakrefmethod-1.0.2-3.el7.noarch                               1/26 
  Installing : python2-osprofiler-2.8.2-1.el7.noarch                                  2/26 
  Installing : python-beautifulsoup4-4.6.0-1.el7.noarch                               3/26 
  Installing : python-httplib2-0.9.2-1.el7.noarch                                     4/26 
  Installing : python2-werkzeug-0.14.1-3.el7.noarch                                   5/26 
  Installing : python-waitress-0.8.9-5.el7.noarch                                     6/26 
  Installing : python-webtest-2.0.23-1.el7.noarch                                     7/26 
  Installing : python2-setproctitle-1.1.10-12.el7.x86_64                              8/26 
  Installing : libev-4.15-7.el7.x86_64                                                9/26 
  Installing : python2-os-xenapi-0.3.4-1.el7.noarch                                  10/26 
  Installing : c-ares-1.10.0-3.el7.x86_64                                            11/26 
  Installing : python2-gevent-1.1.2-2.el7.x86_64                                     12/26 
  Installing : python2-designateclient-3.0.0-1.el7.noarch                            13/26 
  Installing : openpgm-5.2.122-2.el7.x86_64                                          14/26 
  Installing : zeromq-4.0.5-4.el7.x86_64                                             15/26 
  Installing : python-zmq-14.7.0-2.el7.x86_64                                        16/26 
  Installing : python2-tinyrpc-0.5-4.20170523git1f38ac.el7.noarch                    17/26 
  Installing : python2-os-ken-0.4.1-1.el7.noarch                                     18/26 
warning: group neutron does not exist - using root
  Installing : python-logutils-0.3.3-3.el7.noarch                                    19/26 
  Installing : python2-singledispatch-3.4.0.3-4.el7.noarch                           20/26 
  Installing : python-simplegeneric-0.8-7.el7.noarch                                 21/26 
  Installing : python2-pecan-1.3.2-1.el7.noarch                                      22/26 
  Installing : python2-neutron-lib-1.29.1-1.el7.noarch                               23/26 
  Installing : 1:python2-neutron-15.3.4-1.el7.noarch                                 24/26 
  Installing : 1:openstack-neutron-common-15.3.4-1.el7.noarch                        25/26 
  Installing : 1:openstack-neutron-linuxbridge-15.3.4-1.el7.noarch                   26/26 
  Verifying  : python-simplegeneric-0.8-7.el7.noarch                                  1/26 
  Verifying  : python2-singledispatch-3.4.0.3-4.el7.noarch                            2/26 
  Verifying  : python2-tinyrpc-0.5-4.20170523git1f38ac.el7.noarch                     3/26 
  Verifying  : 1:openstack-neutron-linuxbridge-15.3.4-1.el7.noarch                    4/26 
  Verifying  : python-zmq-14.7.0-2.el7.x86_64                                         5/26 
  Verifying  : python-logutils-0.3.3-3.el7.noarch                                     6/26 
  Verifying  : python2-osprofiler-2.8.2-1.el7.noarch                                  7/26 
  Verifying  : python2-os-ken-0.4.1-1.el7.noarch                                      8/26 
  Verifying  : openpgm-5.2.122-2.el7.x86_64                                           9/26 
  Verifying  : python2-weakrefmethod-1.0.2-3.el7.noarch                              10/26 
  Verifying  : python2-designateclient-3.0.0-1.el7.noarch                            11/26 
  Verifying  : c-ares-1.10.0-3.el7.x86_64                                            12/26 
  Verifying  : python2-pecan-1.3.2-1.el7.noarch                                      13/26 
  Verifying  : python2-os-xenapi-0.3.4-1.el7.noarch                                  14/26 
  Verifying  : zeromq-4.0.5-4.el7.x86_64                                             15/26 
  Verifying  : libev-4.15-7.el7.x86_64                                               16/26 
  Verifying  : python2-neutron-lib-1.29.1-1.el7.noarch                               17/26 
  Verifying  : 1:openstack-neutron-common-15.3.4-1.el7.noarch                        18/26 
  Verifying  : 1:python2-neutron-15.3.4-1.el7.noarch                                 19/26 
  Verifying  : python-webtest-2.0.23-1.el7.noarch                                    20/26 
  Verifying  : python2-setproctitle-1.1.10-12.el7.x86_64                             21/26 
  Verifying  : python-waitress-0.8.9-5.el7.noarch                                    22/26 
  Verifying  : python2-werkzeug-0.14.1-3.el7.noarch                                  23/26 
  Verifying  : python-httplib2-0.9.2-1.el7.noarch                                    24/26 
  Verifying  : python-beautifulsoup4-4.6.0-1.el7.noarch                              25/26 
  Verifying  : python2-gevent-1.1.2-2.el7.x86_64                                     26/26 

Installed:
  openstack-neutron-linuxbridge.noarch 1:15.3.4-1.el7                                      

Dependency Installed:
  c-ares.x86_64 0:1.10.0-3.el7                                                             
  libev.x86_64 0:4.15-7.el7                                                                
  openpgm.x86_64 0:5.2.122-2.el7                                                           
  openstack-neutron-common.noarch 1:15.3.4-1.el7                                           
  python-beautifulsoup4.noarch 0:4.6.0-1.el7                                               
  python-httplib2.noarch 0:0.9.2-1.el7                                                     
  python-logutils.noarch 0:0.3.3-3.el7                                                     
  python-simplegeneric.noarch 0:0.8-7.el7                                                  
  python-waitress.noarch 0:0.8.9-5.el7                                                     
  python-webtest.noarch 0:2.0.23-1.el7                                                     
  python-zmq.x86_64 0:14.7.0-2.el7                                                         
  python2-designateclient.noarch 0:3.0.0-1.el7                                             
  python2-gevent.x86_64 0:1.1.2-2.el7                                                      
  python2-neutron.noarch 1:15.3.4-1.el7                                                    
  python2-neutron-lib.noarch 0:1.29.1-1.el7                                                
  python2-os-ken.noarch 0:0.4.1-1.el7                                                      
  python2-os-xenapi.noarch 0:0.3.4-1.el7                                                   
  python2-osprofiler.noarch 0:2.8.2-1.el7                                                  
  python2-pecan.noarch 0:1.3.2-1.el7                                                       
  python2-setproctitle.x86_64 0:1.1.10-12.el7                                              
  python2-singledispatch.noarch 0:3.4.0.3-4.el7                                            
  python2-tinyrpc.noarch 0:0.5-4.20170523git1f38ac.el7                                     
  python2-weakrefmethod.noarch 0:1.0.2-3.el7                                               
  python2-werkzeug.noarch 0:0.14.1-3.el7                                                   
  zeromq.x86_64 0:4.0.5-4.el7                                                              

Complete!

# 查看neutron用户和用户组
[root@compute opt]# cat /etc/passwd | grep neutron
neutron:x:989:986:OpenStack Neutron Daemons:/var/lib/neutron:/sbin/nologin
[root@compute opt]# cat /etc/group | grep neutron
neutron:x:986:

5.2修改Neutron配置文件

要对Neutron组件、网桥代理、Nova组件进行配置。

1.Neutron配置文件

# 备份配置文件
[root@compute ~]# cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
# 去除空行和注释
[root@compute ~]# grep -Ev '^$|#' /etc/neutron/neutron.conf.bak > /etc/neutron/neutron.conf
[root@compute ~]# cat /etc/neutron/neutron.conf
[DEFAULT]
[cors]
[database]
[keystone_authtoken]
# 修改Neutron配置文件
[DEFAULT]
transport_url = rabbit://rabbitmq:000000@controller:5672
auth_strategy = keystone

[cors]
[database]
[keystone_authtoken]
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = project
username = neutron
password = 000000

[oslo_concurrency]
lock_path = /var/lib/neutron/tmp

[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[privsep]
[ssl]

2.网桥代理的配置文件

# 网桥代理的配置文件备份和去空行和注释
[root@compute ~]# cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak
[root@compute ~]# grep -Ev '^$|#' /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak > /etc/neutron/plugins/ml2/linuxbridge_agent.ini
# 修改网桥代理的配置文件
[root@compute ~]# vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini

[DEFAULT]
[linux_bridge]
physical_interface_mappings = provider:ens34

[vxlan]
enable_vxlan = false

[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

3.Nova配置文件

# 在Nova配置文件中,需要在[DEFAULT]部分加入两行内容。在[neutron]部分加入内容
[root@compute ~]# vi /etc/nova/nova.conf

[DEFAULT]
enable_apis = osapi_compute,metadata
transport_url = rabbit://rabbitmq:000000@controller:5672
my_ip = 192.168.100.129
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
vif_plugging_is_fatal = false
vif_plugging_timeout = 0

[api]
auth_strategy = keystone

[api_database]
[barbican]
[cache]
[cinder]
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[database]
[devices]
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
api_servers = http://controller:9292

[guestfs]
[healthcheck]
[hyperv]
[ironic]
[key_manager]
[keystone]
[keystone_authtoken]
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = project
username = nova
password = 000000

[libvirt]
virt_type = qemu


[metrics]
[mks]
[neutron]
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = project
username = neutron
password = 000000
5.3启动计算节点Neutron服务
[root@compute ~]# systemctl restart openstack-nova-compute
[root@compute ~]# systemctl enable neutron-linuxbridge-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-linuxbridge-agent.service to /usr/lib/systemd/system/neutron-linuxbridge-agent.service.
[root@compute ~]# systemctl start neutron-linuxbridge-agent

6、检测Neutron服务

两种方法检测Neutron组件的运行状态。均在控制节点执行。

# 方法一:查看网络代理服务列表
# 查询出四个数据,均为UP状态
[root@controller ~]# openstack network agent list
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| ID                                   | Agent Type         | Host       | Availability Zone | Alive | State | Binary                    |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| 0e2c0f8f-8fa7-4b64-8df2-6f1aedaa7c2b | Linux bridge agent | compute    | None              | :-)   | UP    | neutron-linuxbridge-agent |
| c6688165-593d-4c5e-b25c-5ff2b6c75866 | Linux bridge agent | controller | None              | :-)   | UP    | neutron-linuxbridge-agent |
| dc335348-5639-40d1-b121-3abfc9aefc8e | Metadata agent     | controller | None              | :-)   | UP    | neutron-metadata-agent    |
| ddc49378-aea8-4f2e-b1b4-568fa4c85038 | DHCP agent         | controller | nova              | :-)   | UP    | neutron-dhcp-agent        |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
# 方法二:用Neutron状态检测工具检测
[root@controller ~]# neutron-status upgrade check
+---------------------------------------------------------------------+
| Upgrade Check Results                                               |
+---------------------------------------------------------------------+
| Check: Gateway external network                                     |
| Result: Success                                                     |
| Details: L3 agents can use multiple networks as external gateways.  |
+---------------------------------------------------------------------+
| Check: External network bridge                                      |
| Result: Success                                                     |
| Details: L3 agents are using integration bridge to connect external |
|   gateways                                                          |
+---------------------------------------------------------------------+
| Check: Worker counts configured                                     |
| Result: Warning                                                     |
| Details: The default number of workers has changed. Please see      |
|   release notes for the new values, but it is strongly              |
|   encouraged for deployers to manually set the values for           |
|   api_workers and rpc_workers.                                      |
+---------------------------------------------------------------------+

创建实例

⼀、简介

根据官⽅⽂档提供的创建实例的时候提供了两种⽹络,⼀种是provider,⼀种是self-service。 这两种的⽹络的区别就是,provider⽹络是从外⽹路由器的地址池中拿出来⼀部分地址⾃⼰来使⽤,这样就导致外界路由器的地址 池变少了,我们创建provider使⽤的IP地址是不能在放到池⼦⾥⾯的。
创建实例的时候分配到的地址就是外⽹路由器地址池中的地 址,这样就可以直接连接外⽹了。 但是外⽹的地址池是有限度的,你这⾥只能是使⽤⼀部分,⽆法满⾜你创建⼤量虚机的请求,所以就有了self-service⽹络。
self-server⽹络使⽤的是⾃⼰指定的⽹段,我们可以⾃⼰设置⽹段、开始地址和结束地址,都是可以⾃⼰指定的,IP地址随便划 分,没有provider⽹络那种,需要参考外⽹路由地址池的范围,但是他是没法连接外⽹的, 但是我们有provider⽹络,我们可以指定provider⽹络为路由通过他来进⾏外⽹访问。
#查看⽹络代理服务列表
[root@controller ~]# openstack network agent list
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| ID                                   | Agent Type         | Host       | Availability Zone | Alive | State | Binary                    |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| 10c1fde6-739c-43c2-a8ec-3596cb7d6f8a | Linux bridge agent | controller | None              | :-)   | UP    | neutron-linuxbridge-agent |
| 5658694c-31c3-4e83-939b-b95dc7252b84 | Metadata agent     | controller | None              | :-)   | UP    | neutron-metadata-agent    |
| a48b7692-f719-4b5b-93c3-9ef9c766e9ed | Linux bridge agent | computer   | None              | :-)   | UP    | neutron-linuxbridge-agent |
| aa64a73f-fb3b-4ae9-8d6e-679de866295c | L3 agent           | controller | nova              | :-)   | UP    | neutron-l3-agent          |
| cd26d670-21cd-4d41-8693-e881ce783047 | DHCP agent         | controller | nova              | :-)   | UP    | neutron-dhcp-agent        |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
#创建⽹络
[root@controller ~]# openstack network create  --share --external --provider-physical-network provider  --provider-network-type flat provider
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2023-05-11T08:41:10Z                 |
| description               |                                      |
| dns_domain                | None                                 |
| id                        | 095f5b36-693d-466c-8749-685870c0ecad |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | False                                |
| is_vlan_transparent       | None                                 |
| mtu                       | 1500                                 |
| name                      | provider                             |
| port_security_enabled     | True                                 |
| project_id                | 885243ea7d86481db7db2b106b685b27     |
| provider:network_type     | flat                                 |
| provider:physical_network | provider                             |
| provider:segmentation_id  | None                                 |
| qos_policy_id             | None                                 |
| revision_number           | 1                                    |
| router:external           | External                             |
| segments                  | None                                 |
| shared                    | True                                 |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      |                                      |
| updated_at                | 2023-05-11T08:41:10Z                 |
+---------------------------+--------------------------------------+
#查看创建的⽹络
[root@controller ~]# openstack network list
+--------------------------------------+----------+---------+
| ID                                   | Name     | Subnets |
+--------------------------------------+----------+---------+
| 095f5b36-693d-466c-8749-685870c0ecad | provider |         |
+--------------------------------------+----------+---------+

#创建⼦⽹
[root@controller ~]# openstack subnet create --network provider   --allocation-pool start=192.168.88.150,end=192.168.88.200  --dns-nameserver 114.114.114.114 --gateway 192.168.88.2 --subnet-range 192.168.88.0/24 provider
+----------------------+--------------------------------------+
| Field                | Value                                |
+----------------------+--------------------------------------+
| allocation_pools     | 192.168.88.150-192.168.88.200        |
| cidr                 | 192.168.88.0/24                      |
| created_at           | 2023-05-11T08:42:43Z                 |
| description          |                                      |
| dns_nameservers      | 114.114.114.114                      |
| dns_publish_fixed_ip | None                                 |
| enable_dhcp          | True                                 |
| gateway_ip           | 192.168.88.2                         |
| host_routes          |                                      |
| id                   | 9bc69934-c25f-4960-90ef-c04c2fdb8c98 |
| ip_version           | 4                                    |
| ipv6_address_mode    | None                                 |
| ipv6_ra_mode         | None                                 |
| name                 | provider                             |
| network_id           | 095f5b36-693d-466c-8749-685870c0ecad |
| prefix_length        | None                                 |
| project_id           | 885243ea7d86481db7db2b106b685b27     |
| revision_number      | 0                                    |
| segment_id           | None                                 |
| service_types        |                                      |
| subnetpool_id        | None                                 |
| tags                 |                                      |
| updated_at           | 2023-05-11T08:42:43Z                 |
+----------------------+--------------------------------------+
#查看⼦⽹列表
[root@controller ~]# openstack subnet list
+--------------------------------------+----------+--------------------------------------+-----------------+
| ID                                   | Name     | Network                              | Subnet          |
+--------------------------------------+----------+--------------------------------------+-----------------+
| 9bc69934-c25f-4960-90ef-c04c2fdb8c98 | provider | 095f5b36-693d-466c-8749-685870c0ecad | 192.168.88.0/24 |
+--------------------------------------+----------+--------------------------------------+-----------------+
#创建主机规格
[root@controller ~]# openstack flavor create --id 0 --vcpus 1 --ram 2048 --disk 1 m1.nano
+----------------------------+---------+
| Field                      | Value   |
+----------------------------+---------+
| OS-FLV-DISABLED:disabled   | False   |
| OS-FLV-EXT-DATA:ephemeral  | 0       |
| disk                       | 1       |
| id                         | 0       |
| name                       | m1.nano |
| os-flavor-access:is_public | True    |
| properties                 |         |
| ram                        | 2048    |
| rxtx_factor                | 1.0     |
| swap                       |         |
| vcpus                      | 1       |
+----------------------------+---------+
#查看云主机可用类型
[root@controller ~]# openstack flavor list
+----+---------+------+------+-----------+-------+-----------+
| ID | Name    |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+---------+------+------+-----------+-------+-----------+
| 0  | m1.nano | 2048 |    1 |         0 |     1 | True      |
+----+---------+------+------+-----------+-------+-----------+
#生成密钥对,添加公有密钥
[root@controller ~]# ssh-keygen -q -N ""
Enter file in which to save the key (/root/.ssh/id_rsa): 
[root@controller ~]# ls -a
 .    anaconda-ks.cfg   .bash_profile   cirros-0.5.1-x86_64-disk.img   .novaclient
 ..   .bash_history     .bashrc         .cshrc                         .ssh
'\'   .bash_logout      .cache          .mysql_history                 .tcshrc
#添加公有密钥
[root@controller ~]# openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
+-------------+-------------------------------------------------+
| Field       | Value                                           |
+-------------+-------------------------------------------------+
| fingerprint | a3:b9:7a:6e:bd:7b:14:67:aa:4d:b4:e3:b6:2d:ca:e0 |
| name        | mykey                                           |
| user_id     | e18caaac3b664912b59826a9e3876b70                |
+-------------+-------------------------------------------------+
#验证公钥的添加
[root@controller ~]# openstack keypair list
+-------+-------------------------------------------------+
| Name  | Fingerprint                                     |
+-------+-------------------------------------------------+
| mykey | a3:b9:7a:6e:bd:7b:14:67:aa:4d:b4:e3:b6:2d:ca:e0 |
+-------+-------------------------------------------------+

2.创建安全组规则并允许安全 shell (SSH) 的访问

#创建安全组
[root@controller ~]# openstack security group rule create --proto icmp default
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| created_at        | 2023-05-11T08:58:05Z                 |
| description       |                                      |
| direction         | ingress                              |
| ether_type        | IPv4                                 |
| id                | 5f831ba0-a41d-4089-8484-5b16b7d0da21 |
| name              | None                                 |
| port_range_max    | None                                 |
| port_range_min    | None                                 |
| project_id        | 885243ea7d86481db7db2b106b685b27     |
| protocol          | icmp                                 |
| remote_group_id   | None                                 |
| remote_ip_prefix  | 0.0.0.0/0                            |
| revision_number   | 0                                    |
| security_group_id | 56426309-a3fd-472d-b006-2e65eb5c0a1c |
| tags              | []                                   |
| updated_at        | 2023-05-11T08:58:05Z                 |
+-------------------+--------------------------------------+
#允许安全 shell (SSH) 的访问
[root@controller ~]# openstack security group rule create --proto tcp --dst-port 22 default+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| created_at        | 2023-05-11T08:58:30Z                 |
| description       |                                      |
| direction         | ingress                              |
| ether_type        | IPv4                                 |
| id                | 3aa556a8-1b69-403a-be51-0f4e21595462 |
| name              | None                                 |
| port_range_max    | 22                                   |
| port_range_min    | 22                                   |
| project_id        | 885243ea7d86481db7db2b106b685b27     |
| protocol          | tcp                                  |
| remote_group_id   | None                                 |
| remote_ip_prefix  | 0.0.0.0/0                            |
| revision_number   | 0                                    |
| security_group_id | 56426309-a3fd-472d-b006-2e65eb5c0a1c |
| tags              | []                                   |
| updated_at        | 2023-05-11T08:58:30Z                 |
+-------------------+--------------------------------------+
#查看安全组规则列表
[root@controller ~]# openstack security group rule list
+--------------------------------------+-------------+-----------+-----------+------------+--------------------------------------+--------------------------------------+
| ID                                   | IP Protocol | Ethertype | IP Range  | Port Range | Remote Security Group                | Security Group                       |
+--------------------------------------+-------------+-----------+-----------+------------+--------------------------------------+--------------------------------------+
| 23878d1a-23a5-4237-95fa-e2220d1976d4 | None        | IPv4      | 0.0.0.0/0 |            | 56426309-a3fd-472d-b006-2e65eb5c0a1c | 56426309-a3fd-472d-b006-2e65eb5c0a1c |
| 3aa556a8-1b69-403a-be51-0f4e21595462 | tcp         | IPv4      | 0.0.0.0/0 | 22:22      | None                                 | 56426309-a3fd-472d-b006-2e65eb5c0a1c |
| 5f831ba0-a41d-4089-8484-5b16b7d0da21 | icmp        | IPv4      | 0.0.0.0/0 |            | None                                 | 56426309-a3fd-472d-b006-2e65eb5c0a1c |
| 86697b74-6047-4774-8ed2-dbbe9ea9aff4 | None        | IPv4      | 0.0.0.0/0 |            | None                                 | 56426309-a3fd-472d-b006-2e65eb5c0a1c |
| bdd73d25-7c7e-4578-8405-5691762a1d96 | None        | IPv6      | ::/0      |            | None                                 | 56426309-a3fd-472d-b006-2e65eb5c0a1c |
| c44d71df-3ea2-470a-85f8-fd5f258a0378 | None        | IPv6      | ::/0      |            | 56426309-a3fd-472d-b006-2e65eb5c0a1c | 56426309-a3fd-472d-b006-2e65eb5c0a1c |
+--------------------------------------+-------------+-----------+-----------+------------+--------------------------------------+--------------------------------------+

3.创建实例

#查看云主机可用类型和可用镜像
[root@controller ~]# openstack flavor list
+----+---------+------+------+-----------+-------+-----------+
| ID | Name    |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+---------+------+------+-----------+-------+-----------+
| 0  | m1.nano | 2048 |    1 |         0 |     1 | True      |
+----+---------+------+------+-----------+-------+-----------+
[root@controller ~]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 76e55c85-4c45-4dc3-81b3-7d6bb73c87b9 | cirros | active |
+--------------------------------------+--------+--------+
#查看可用网络和可用安全组
[root@controller ~]# openstack network list
+--------------------------------------+----------+--------------------------------------+
| ID                                   | Name     | Subnets                              |
+--------------------------------------+----------+--------------------------------------+
| 095f5b36-693d-466c-8749-685870c0ecad | provider | 9bc69934-c25f-4960-90ef-c04c2fdb8c98 |
+--------------------------------------+----------+--------------------------------------+
[root@controller ~]# openstack security group list
+--------------------------------------+---------+------------------------+----------------------------------+------+
| ID                                   | Name    | Description            | Project                          | Tags |
+--------------------------------------+---------+------------------------+----------------------------------+------+
| 56426309-a3fd-472d-b006-2e65eb5c0a1c | default | Default security group | 885243ea7d86481db7db2b106b685b27 | []   |
+--------------------------------------+---------+------------------------+----------------------------------+------+
#创建实例
[root@controller ~]# openstack server create --flavor m1.nano --image cirros --nic net-id=095f5b36-693d-466c-8749-685870c0ecad --security-group default --key-name mykey provider-instance
+-------------------------------------+-----------------------------------------------+
| Field                               | Value                                         |
+-------------------------------------+-----------------------------------------------+
| OS-DCF:diskConfig                   | MANUAL                                        |
| OS-EXT-AZ:availability_zone         |                                               |
| OS-EXT-SRV-ATTR:host                | None                                          |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None                                          |
| OS-EXT-SRV-ATTR:instance_name       |                                               |
| OS-EXT-STS:power_state              | NOSTATE                                       |
| OS-EXT-STS:task_state               | scheduling                                    |
| OS-EXT-STS:vm_state                 | building                                      |
| OS-SRV-USG:launched_at              | None                                          |
| OS-SRV-USG:terminated_at            | None                                          |
| accessIPv4                          |                                               |
| accessIPv6                          |                                               |
| addresses                           |                                               |
| adminPass                           | i8jj7BFHLQfD                                  |
| config_drive                        |                                               |
| created                             | 2023-05-11T09:07:28Z                          |
| flavor                              | m1.nano (0)                                   |
| hostId                              |                                               |
| id                                  | d7e3c443-0660-460d-beee-e8cee9074106          |
| image                               | cirros (76e55c85-4c45-4dc3-81b3-7d6bb73c87b9) |
| key_name                            | mykey                                         |
| name                                | provider-instance                             |
| progress                            | 0                                             |
| project_id                          | 885243ea7d86481db7db2b106b685b27              |
| properties                          |                                               |
| security_groups                     | name='56426309-a3fd-472d-b006-2e65eb5c0a1c'   |
| status                              | BUILD                                         |
| updated                             | 2023-05-11T09:07:28Z                          |
| user_id                             | e18caaac3b664912b59826a9e3876b70              |
| volumes_attached                    |                                               |
+-------------------------------------+-----------------------------------------------+
#查看实例
[root@controller ~]# openstack server list
+--------------------------------------+-------------------+--------+-------------------------+--------+---------+
| ID                                   | Name              | Status | Networks                | Image  | Flavor  |
+--------------------------------------+-------------------+--------+-------------------------+--------+---------+
| d7e3c443-0660-460d-beee-e8cee9074106 | provider-instance | ACTIVE | provider=192.168.88.164 | cirros | m1.nano |
+--------------------------------------+-------------------+--------+-------------------------+--------+---------+
#使用虚拟控制台访问实例
[root@controller ~]# openstack console url show provider-instance
+-------+-------------------------------------------------------------------------------------------+
| Field | Value                                                                                     |
+-------+-------------------------------------------------------------------------------------------+
| type  | novnc                                                                                     |
| url   | http://controller:6080/vnc_auto.html?path=%3Ftoken%3Dbc8f8e13-81d6-4983-8e55-9c9abb0958be |
+-------+-------------------------------------------------------------------------------------------+

4.在浏览器使用url来连接实例

image-20230511171437155

ping百度

image-20230511171347084

posted @   雙_木  阅读(391)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示