openstack pike 使用 openvswitch + vxlan

# openstack pike 使用 openvswitch + vxlan
# openstack pike linuxbridge-agent 換爲 openvswitch-agenthtml

#openstack pike 集羣高可用  安裝部署 彙總 http://www.cnblogs.com/elvi/p/7613861.htmllinux

############################################################
# 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
############################################################
相關文章
相關標籤/搜索