1、安装服务
# yum install openvswitch openstack-neutron-openvswitch ebtables ipset -y

2、修改配置文件/etc/neutron/neutron.conf
# cd /etc/neutron/ && mv neutron.conf neutron.conf.source && cat neutron.conf.source |grep -Ev "^#|^$" > neutron.conf && chown root:neutron neutron.conf
# vi /etc/neutron/neutron.conf
在【DEFAULT】部分中,配置RabbitMQ消息队列访问
[DEFAULT]
# ...
transport_url = rabbit://openstack:openstack@controller

在 [DEFAULT] and [keystone_authtoken] 部分中,配置 Identity service 访问权限
[DEFAULT]
# ...
auth_strategy = keystone

[keystone_authtoken]
# ...
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron

在【oslo_concurrency】部分中,配置锁路径
[oslo_concurrency]
# ...
lock_path = /var/lib/neutron/tmp

3、修改配置文件/etc/neutron/plugins/ml2/openvswitch_agent.ini
# cd /etc/neutron/plugins/ml2 && mv openvswitch_agent.ini openvswitch_agent.ini.source && cat openvswitch_agent.ini.source |grep -Ev "^#|^$" > openvswitch_agent.ini  && chown root:neutron openvswitch_agent.ini
# vi /etc/neutron/plugins/ml2/openvswitch_agent.ini
[DEFAULT]
 
[agent]
tunnel_types = vxlan
l2_population = True
 
[ovs]
tunnel_bridge = br-tun
local_ip = 172.16.10.101       #本机第二块网卡ip
bridge_mappings = 
 
[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true
 
[xenapi]
 
4、修改配置文件/etc/nova/nova.conf
# vi /etc/nova/nova.conf
在【neutron】部分增加
[neutron]
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron

5、重启nova-compute
# systemctl restart openstack-nova-compute.service

6、启动 neutron-openvswitch-agent 服务并设置开机自启动
# systemctl enable neutron-openvswitch-agent.service 
# systemctl start neutron-openvswitch-agent.service
# systemctl restart neutron-openvswitch-agent.service

7、验证Neutron
列出成功启动的Neutron代理
# openstack network agent list
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| ID                                   | Agent Type         | Host       | Availability Zone | Alive | State | Binary                    |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| 24e103c9-5bef-491f-b21f-282e72a8b716 | L3 agent           | controller | nova              | :-)   | UP    | neutron-l3-agent          |
| 2fd25eda-f8ef-4a53-a487-09ad99d1a64f | Open vSwitch agent | compute02  | None              | :-)   | UP    | neutron-openvswitch-agent |
| a2a0c23b-9749-424b-9ea9-f1f13d0e4dff | Metadata agent     | controller | None              | :-)   | UP    | neutron-metadata-agent    |
| ce2f44f5-0998-4f19-98e9-35efc8b7054a | Open vSwitch agent | compute01  | None              | :-)   | UP    | neutron-openvswitch-agent |
| e44ca0f5-7bca-4ef9-a7cc-e8d9ad9572dd | DHCP agent         | controller | nova              | :-)   | UP    | neutron-dhcp-agent        |
| ffc927f5-4540-488e-acb5-25d2d7f80a3c | Open vSwitch agent | controller | None              | :-)   | UP    | neutron-openvswitch-agent |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+

查看网络
# openstack network list

查看子网
# openstack subnet list

查看网络接口
# openstack port list

删除网络

# openstack port delete ip-address=192.168.58.110
# openstack subnet delete subnet_192.168.58
# openstack network delete public

说明:删除网络前,要先后顺序删除,即先要删除子网下的网络接口-->删除子网-->删除网络

 

计算节点neutron.conf

[DEFAULT]

transport_url = rabbit://openstack:openstack@controller

auth_strategy = keystone

[cors]

[database]

[keystone_authtoken]

www_authenticate_uri = http://controller:5000

auth_url = http://controller:5000

memcached_servers = controller:11211

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = neutron

password = neutron

[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]

 

openvswitch_agent.ini

[DEFAULT]

[agent]
tunnel_types = vxlan
l2_population = True

[ovs]
tunnel_bridge = br-tun
local_ip = 172.16.10.101
# local_ip = 本机第二块网卡IP
bridge_mappings =

[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true

[xenapi]

 

nova.conf添加neutron部分

[neutron]
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron