如何在openstack中设置平面网络?

How to set up flat network in openstack?

我通过 openstack-ansible 部署了 openstack,我正在尝试设置一个 openstack 网络,以便可以从物理网络 (192.168.10.0/20) 访问这些实例:

openstack network create --share --external \
--provider-physical-network flat \
--provider-network-type flat public

openstack subnet create --network public \
--allocation-pool start=192.168.14.241,end=192.168.14.249 \
--dns-nameserver 192.168.10.144 --gateway 192.168.10.1 \
--subnet-range 192.168.10.0/20 public-subnet

但实例不接收 IP 地址,也不执行任何 ping 操作。

这是我的 ml2_conf.ini:

cat /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = flat,vlan,vxlan,local
tenant_network_types = vxlan,flat,vlan
mechanism_drivers = linuxbridge
extension_drivers = port_security
# ML2 flat networks

[ml2_type_flat]
flat_networks = flat
# ML2 VLAN networks

[ml2_type_vlan]
network_vlan_ranges = vlan:101:200,vlan:301:400
# ML2 VXLAN networks

[ml2_type_vxlan]
vxlan_group = 239.1.1.1
vni_ranges = 1:1000

[ml2_type_geneve]
vni_ranges =
max_header_size = 38
# Security groups

[securitygroup]
enable_security_group = True
enable_ipset = True

有解决办法吗?

  • 1、检查network:dhcp端口是否存在,如果存在,则表明在[=28范围内有一个或多个开头为ip的端口=]start=192.168.14.241,end=192.168.14.249。像这样:
# openstack port list --device-owner network:dhcp
+--------------------------------------+------+-------------------+----------------------------------------------------------------------------+--------+
| ID                                   | Name | MAC Address       | Fixed IP Addresses                                                         | Status |
+--------------------------------------+------+-------------------+----------------------------------------------------------------------------+--------+
| 08db769d-7500-41c0-bc3a-086fdb75c65d |      | fa:16:3e:4f:76:75 | ip_address='192.168.1.2', subnet_id='83e0dea2-cee3-437b-94c7-d5650d94d921' | ACTIVE |
+--------------------------------------+------+-------------------+----------------------------------------------------------------------------+--------+

  • 2、检查是否正确生成网桥(brqf775913d-8fNetwork的ID头部一致,并且有一些 tapXXX 端口应该连接到实例),像这样:
# openstack subnet list
+--------------------------------------+-----------+--------------------------------------+----------------+
| ID                                   | Name      | Network                              | Subnet         |
+--------------------------------------+-----------+--------------------------------------+----------------+
| 83e0dea2-cee3-437b-94c7-d5650d94d921 | flat_snet | f775913d-8f9d-4f46-9fe7-2a1bce710ec6 | 192.168.1.0/24 |
+--------------------------------------+-----------+--------------------------------------+----------------+

# brctl show
bridge name bridge id       STP enabled interfaces
brqf775913d-8f      8000.000ec6ade4f2   no      enx000ec6ade4f2
                            tap08db769d-75
                            tapd4d2a5e3-fd
docker0     8000.0242e6da798c   no
  • 3,通过登录检查实例是否配置了正确的ip信息(ip aip r s或其他检查网络流量,如traceroute)实例控制台。

  • 4,在我的情况下,我们应该将 pvid 的值设置为连接到的交换机端口中唯一的 flat 网络的 vlanID管理程序,因为我们还有其他 vlan 网络,这些网络在 openstack 集群中配置为 vlan 类型。