[toc]
增加一个flat网络
控制节点和计算节点增加一块网卡,配置另外一个网段
控制节点
编辑/etc/neutron/plugins/ml2/ml2_conf.ini
#官方文档中默认只配置一个网段
[ml2_type_flat]
flat_networks = provider
#现在再增加一个网段,名称为net_172_16_1
[ml2_type_flat]
flat_networks = provider,net_172_16_1
编辑/etc/neutron/plugins/ml2/linuxbridge_agent.ini
#原先配置
[linux_bridge]
physical_interface_mappings = provider:eth0
#现在再增加一个网段
[linux_bridge]
physical_interface_mappings = provider:eth0,net_172_16_1:eth1
重启服务
systemctl restart neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service
计算节点
编辑/etc/neutron/plugins/ml2/linuxbridge_agent.ini
#原先配置
[linux_bridge]
physical_interface_mappings = provider:eth0
#改为如下
[linux_bridge]
physical_interface_mappings = provider:eth0,net_172_16_1:eth1
重启服务
systemctl restart neutron-linuxbridge-agent.service
控制节点检查neutron服务是否正常
neutron agent-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
| id | agent_type | host | availability_zone | alive | admin_state_up | binary |
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
| b627a998-e6d2-4cea-b6f1-773f0a294823 | DHCP agent | controller | nova | :-) | True | neutron-dhcp-agent |
| d2999370-36db-43c1-9fa8-dbdf9afcd118 | Linux bridge agent | compute1 | | :-) | True | neutron-linuxbridge-agent |
| f6e6488d-2be8-425d-99ea-97974450cedf | Linux bridge agent | controller | | :-) | True | neutron-linuxbridge-agent |
| fc7271f1-f214-4a17-bda7-ba340a61e0f9 | Metadata agent | controller | | :-) | True | neutron-metadata-agent |
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
创建网络
openstack network create --share --external \
--provider-physical-network net_172_16_1 \
--provider-network-type flat net_172_16_1
创建子网
一个网络可以对应多个子网
openstack subnet create --network net_172_16_1 \
--allocation-pool start=172.16.1.10,end=172.16.1.250 \
--dns-nameserver 223.5.5.5 --gateway 172.16.1.1 \
--subnet-range 172.16.1.0/24 net_172_16_1