Welcome to Elvin's blog

openstack pike 使用 openvswitch + vxlan

# openstack pike 使用 openvswitch + vxlan
# openstack pike linuxbridge-agent 换为 openvswitch-agent

#openstack pike 集群高可用  安装部署 汇总 http://www.cnblogs.com/elvi/p/7613861.html

############################################################
# openstack 使用 openvswitch + vxlan
# openstack  pike linuxbridge-agent 换为 openvswitch-agent

#控制节点

##########################
#安装过linuxbridge,需删除

#关闭,卸载linuxbridge-agent
systemctl disable neutron-linuxbridge-agent
systemctl stop    neutron-linuxbridge-agent
yum remove -y openstack-neutron-linuxbridge

#删除网络,在Web版操作
#释放虚拟ip地址——删除route——删除网络

# ##部分命令参考
# #查看bridge agent
# Bridge=`openstack network agent list | grep 'Linux bridge agent'|awk '{print $2}'`
# echo $Bridge
# #删除bridge agent
# neutron agent-delete $Bridge
# #删除网络
# NET=`openstack network list|awk '{print $2}'`
# echo $NET
# openstack network delete  $NET

##########################

#安装openvswitch
yum install -y openstack-neutron-openvswitch

#参数
MyIP=10.2.1.17
Net=ens33 #网卡名

#内核配置
echo '
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
'>>/etc/sysctl.conf
sysctl -p

#backup
cp /etc/neutron/plugins/ml2/ml2_conf.ini{,bak1}
cp /etc/neutron/l3_agent.ini{,bak1}
cp /etc/neutron/dhcp_agent.ini{,bak1}
cp /etc/neutron/plugins/ml2/openvswitch_agent.ini{,.bak}

#开启route 
openstack-config --set /etc/neutron/neutron.conf DEFAULT service_plugins router

echo '#
[ml2]
tenant_network_types = vxlan
type_drivers = flat,vlan,gre,vxlan
mechanism_drivers = openvswitch,l2population
extension_drivers = port_security
[ml2_type_flat]
flat_networks = provider
[ml2_type_vxlan]
vni_ranges = 3001:4000
[securitygroup]
#enable_security_group = true
enable_ipset = true
#'>/etc/neutron/plugins/ml2/ml2_conf.ini

echo '#
[DEFAULT]
#interface_driver = openvswitch
interface_driver=neutron.agent.linux.interface.OVSInterfaceDriver
external_network_bridge = br-ex
#'>/etc/neutron/l3_agent.ini

echo '#
[DEFAULT]
#interface_driver = openvswitch
interface_driver=neutron.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true
#'>/etc/neutron/dhcp_agent.ini

echo '#
[ovs]
integration_bridge = br-int
tunnel_bridge = br-tun
local_ip = '$MyIP'
#bridge_mappings = br-ex
#bridge_mappings = provider:br-ex
bridge_mappings = 
[agent]
tunnel_types = vxlan,gre
l2_population = true
arp_responder = true
[securitygroup]
#enable_ipset = true
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
#'>/etc/neutron/plugins/ml2/openvswitch_agent.ini

#启动openvswitch服务
systemctl enable openvswitch 
systemctl restart openvswitch 

#创建网桥,将ip转移到网桥,添加到开机启动
echo '#
ovs-vsctl add-br br-ex
ovs-vsctl add-port br-ex  '$Net'
ovs-vsctl show
ifconfig '$Net' 0.0.0.0 
ifconfig br-ex '$MyIP'/24
route add default gw 10.2.1.1 #可选,添加默认路由
#'>>/etc/rc.local
chmod +x /etc/rc.d/rc.localtail -n 8 /etc/rc.local |bash

#启用L3
systemctl enable neutron-l3-agent.service
#systemctl restart neutron-l3-agent.service

#重启服务
systemctl restart neutron-server  neutron-dhcp-agent neutron-metadata-agent \
   neutron-l3-agent neutron-openvswitch-agent

############################################################
#计算节点

#参数
MyIP=10.2.1.16
Net=ens33 #网卡名

#内核配置
echo '
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
'>>/etc/sysctl.conf
sysctl -p

yum install -y openstack-neutron-openvswitch

#backup
cp /etc/neutron/plugins/ml2/ml2_conf.ini{,bak1}
cp /etc/neutron/plugins/ml2/openvswitch_agent.ini{,.bak}

#开启route
openstack-config --set /etc/neutron/neutron.conf DEFAULT service_plugins router

echo '#
[agent]
tunnel_types = vxlan,gre
l2_population = true
arp_responder = true
[ovs]
local_ip = '$MyIP'
tunnel_bridge = br-tun
#bridge_mappings = br-ex
#bridge_mappings = provider:br-ex
bridge_mappings = 
[securitygroup]
enable_ipset = true
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
#'>/etc/neutron/plugins/ml2/openvswitch_agent.ini

echo '#
[ml2]
tenant_network_types = vxlan
type_drivers = flat,vlan,vxlan
mechanism_drivers = openvswitch,l2population
extension_drivers = port_security
[ml2_type_flat]
flat_networks = provider
[ml2_type_vxlan]
vni_ranges = 3001:4000
[securitygroup]
enable_security_group = true
enable_ipset = true
#'>/etc/neutron/plugins/ml2/ml2_conf.ini

#启动服务
systemctl enable neutron-openvswitch-agent.service
systemctl restart neutron-openvswitch-agent.service

#创建网桥,将ip转移到网桥,添加到开机启动
echo '#
ovs-vsctl add-br br-ex
ovs-vsctl add-port br-ex  '$Net'
ovs-vsctl show
ifconfig '$Net' 0.0.0.0 
ifconfig br-ex '$MyIP'/24
route add default gw 10.2.1.1 #可选,添加默认路由
#'>>/etc/rc.local
chmod +x /etc/rc.d/rc.local ;tail -n 8 /etc/rc.local |bash

#重启服务
systemctl restart openstack-nova-compute neutron-openvswitch-agent

############################################################
#参考
http://blog.csdn.net/dylloveyou/article/details/70305620
http://blog.csdn.net/wylfengyujiancheng/article/details/70129720
https://www.cnblogs.com/goldsunshine/p/7358429.html
http://www.jianshu.com/p/a58f84af34d2
http://blog.csdn.net/s1234567_89/article/details/51860650
http://www.bubuko.com/infodetail-2012336.html
############################################################

 

posted @ 2017-11-14 21:32  blog-elvin-vip  阅读(3388)  评论(0编辑  收藏  举报