OpenStackNewton版本部署----用Openvswitch替换Linuxbridge

来源:互联网 发布:好东东网络 编辑:程序博客网 时间:2024/05/16 14:26

OpenStackNewton版本部署----Openvswitch替换 Linuxbridge

基于之后与Opendaylight互通的需要,需要将Linux bridge替换位Openvswitch(OVS)

安装和配置控制节点

1、如果已经安装Linux bridge,就先停止Linux bridge的服务

# systemctl stop neutron-linuxbridge-agent.service

2、删除neutron数据库

mysql> DROP DATABASE neutron;

3、创建数据库

1root用户登录数据库

$ mysql -u root -p

2)创建neutron数据库

mysql> CREATE DATABASE neutron;

        3)创建neutron数据库用户并授予权限

mysql> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \
  IDENTIFIED BY 'NEUTRON_DBPASS';
mysql> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \
  IDENTIFIED BY 'NEUTRON_DBPASS';

      用合适的密码替换NEUTRON_DBPASS

4、安装组件

# yum install neutron-openvswitch-agent -y

5、/etc/neutron/neutron.conf添加如下配置

[DEFAULT]
...
rpc_backend = rabbit
 
[oslo_messaging_rabbit]
rabbit_host = 192.168.1.103
rabbit_userid = openstack
rabbit_password = DPASS

         RabbitMQ的密码替换DPASS

      [oslo_concurrency]部分注释掉lock_path选项

6、/etc/neutron/plugins/ml2/ml2_conf.ini修改如下配置

[ml2]
...
mechanism_drivers = openvswitch,l2population

7、/etc/nova/nova.conf i修改如下配置:

[DEFAULT]
...
dhcpbridge_flagfile = /etc/nova/nova.conf
dhcpbridge = /usr/bin/nova-dhcpbridge
state_path = /var/lib/nova
force_dhcp_release = True
dhcpbridge_flagfile = /etc/nova/nova.conf
verbose = True
ec2_private_dns_show_ip = True
[libvirt]
use_virtio_for_bridges = True
[wsgi]
api_paste_config = /etc/nova/api-paste.ini

8、修改/etc/neutron/plugins/ml2/openvswitch_agent.ini文件:

[agent]
tunnel_types = vxlan
l2_population = True
prevent_arp_spoofing = True
[ovs]
local_ip = 192.168.1.103
bridge_mappings = provider:br-ex
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver

9、/etc/neutron/l3_agent.ini做如下修改:

[DEFAULT]
...
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver

10、对/etc/neutron/dhcp_agent.ini做如下修改:

[DEFAULT]
...
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver

11、填充数据库

# 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

12、重启服务

# systemctl restart neutron-server.service \
  neutron-openvswitch-agent.service neutron-dhcp-agent.service \
  neutron-metadata-agent.service neutron-l3-agent

13、新建外部网络桥接

# ovs-vsctl add-br br-ex

      将外部网络桥接映射到连接外网的网卡

# ovs-vsctl add-port br-ex eno1

14、再次重启服务

# systemctl restart neutron-server.service \
  neutron-openvswitch-agent.service neutron-dhcp-agent.service \
  neutron-metadata-agent.service neutron-l3-agent

安装和配置计算节点

1、/etc/sysctl.conf中添加如下配置:

net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1

然后用如下命令使之生效:

#  sysctl -p

2、安装组件

# yum install neutron-openvswitch-agent -y

3、修改/etc/neutron/plugins/ml2/openvswitch_agent.ini文件:

[agent]
tunnel_types = vxlan
l2_population = True
prevent_arp_spoofing = True
[ovs]
local_ip = 192.168.1.104
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver

4、重启计算服务

# systemctl restart openstack-nova-compute.service

5、重启OVS

# systemctl restart neutron-openvswitch-agent

验证操作

 通过如下命令:

# openstack network agent list

如果能看到控制节点和计算节点上的neutron-openvswitch-agent正常工作,那么配置成功