1、控制节点
1.1、数据库配置
mysql -uroot -p123456CREATE DATABASE neutron;GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'neutron';GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'neutron';
1.2、创建项目
openstack user create --domain default --password neutron neutronopenstack role add --project service --user neutron adminopenstack service create --name neutron --description "OpenStack Networking" networkopenstack endpoint create --region RegionOne network public http://controller:9696openstack endpoint create --region RegionOne network internal http://controller:9696openstack endpoint create --region RegionOne network admin http://controller:9696
1.3、网络配置
1.3.1、网络选项1:提供商网络
1.3.1.1、安装组件
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -ycp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/neutron.conf
vim /etc/neutron/neutron.conf
[database]# ...connection = mysql+pymysql://neutron:neutron@controller/neutron[DEFAULT]# ...core_plugin = ml2service_plugins =transport_url = rabbit://openstack:openstack@controllerauth_strategy = keystonenotify_nova_on_port_status_changes = truenotify_nova_on_port_data_changes = true[keystone_authtoken]# ...www_authenticate_uri = http://controller:5000auth_url = http://controller:5000memcached_servers = controller:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = neutronpassword = neutron[nova]# ...auth_url = http://controller:5000auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = novapassword = nova[oslo_concurrency]# ...lock_path = /var/lib/neutron/tmp
1.3.1.2、配置模块化第 2 层 (ML2) 插件
cp /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/plugins/ml2/ml2_conf.ini
vim /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]# ...type_drivers = flat,vlantenant_network_types =mechanism_drivers = linuxbridgeextension_drivers = port_security[ml2_type_flat]# ...flat_networks = provider[securitygroup]# ...enable_ipset = true
1.3.1.3、配置 Linux 网桥代理
cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/plugins/ml2/linuxbridge_agent.ini
vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]physical_interface_mappings = provider:ens192[vxlan]enable_vxlan = false[securitygroup]# ...enable_security_group = truefirewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
1.3.1.4、确保 Linux 操作系统内核支持网桥筛选器
#把值配置为1sysctl net.bridge.bridge-nf-call-iptablessysctl net.bridge.bridge-nf-call-ip6tables#如果没有这个文件,要启用网络网桥支持modprobe br_netfiltervim /etc/sysctl.confnet.bridge.bridge-nf-call-iptables =1net.net.bridge.bridge-nf-call-ip6tables =1sysctl -p
1.3.1.5、配置 DHCP 代理
cp /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/dhcp_agent.inivim /etc/neutron/dhcp_agent.ini[DEFAULT]# ...interface_driver = linuxbridgedhcp_driver = neutron.agent.linux.dhcp.Dnsmasqenable_isolated_metadata = True
1.3.2、网络选项2:自助网络
1.3.2.1、安装组件
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -ycp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/neutron.conf
vim /etc/neutron/neutron.conf
[database]# ...connection = mysql+pymysql://neutron:neutron@controller/neutron[DEFAULT]# ...core_plugin = ml2service_plugins = routerallow_overlapping_ips = truetransport_url = rabbit://openstack:openstack@controllerauth_strategy = keystonenotify_nova_on_port_status_changes = truenotify_nova_on_port_data_changes = true[keystone_authtoken]# ...www_authenticate_uri = http://controller:5000auth_url = http://controller:5000memcached_servers = controller:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = neutronpassword = neutron[nova]# ...auth_url = http://controller:5000auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = novapassword = nova[oslo_concurrency]# ...lock_path = /var/lib/neutron/tmp
1.3.2.2、配置模块化第 2 层 (ML2) 插件
cp /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/plugins/ml2/ml2_conf.ini
vim /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]# ...type_drivers = flat,vlan,vxlantenant_network_types = vxlanmechanism_drivers = linuxbridge,l2populationextension_drivers = port_security[ml2_type_flat]# ...flat_networks = provider[ml2_type_vxlan]# ...vni_ranges = 1:1000[securitygroup]# ...enable_ipset = true
1.3.2.3、配置 Linux 网桥代理
cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/plugins/ml2/linuxbridge_agent.ini
vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]physical_interface_mappings = provider:PROVIDER_INTERFACE_NAME[vxlan]enable_vxlan = truelocal_ip = OVERLAY_INTERFACE_IP_ADDRESSl2_population = true[securitygroup]# ...enable_security_group = truefirewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
1.3.2.4、确保 Linux 操作系统内核支持网桥筛选器
#把值配置为1sysctl net.bridge.bridge-nf-call-iptablessysctl net.bridge.bridge-nf-call-ip6tables#如果没有这个文件,要启用网络网桥支持modprobe br_netfiltervim /etc/sysctl.confnet.bridge.bridge-nf-call-iptables =1net.net.bridge.bridge-nf-call-ip6tables =1sysctl -p
1.3.2.5、配置第三层代理
[DEFAULT]# ...interface_driver = linuxbridge
1.3.2.6、配置 DHCP 代理
cp /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/dhcp_agent.inivim /etc/neutron/dhcp_agent.ini[DEFAULT]# ...interface_driver = linuxbridgedhcp_driver = neutron.agent.linux.dhcp.Dnsmasqenable_isolated_metadata = True
1.4、配置元数据代理
cp /etc/neutron/metadata_agent.ini /etc/neutron/metadata_agent.ini.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/metadata_agent.inivim /etc/neutron/metadata_agent.ini[DEFAULT]# ...nova_metadata_host = controllermetadata_proxy_shared_secret = METADATA_SECRET
1.5、将计算服务配置为使用网络服务
vim /etc/nova/nova.conf[neutron]auth_url = http://controller:5000auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = neutronpassword = neutronservice_metadata_proxy = truemetadata_proxy_shared_secret = METADATA_SECRET
1.6、完成安装
1.6.1、服务初始化脚本需要一个指向 ML2 插件配置文件的符号链接
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
1.6.2、同步数据库
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
1.6.3、启动
1.6.3.1、网络选项1:提供商网络
systemctl restart openstack-nova-api.service && systemctl status openstack-nova-api.servicesystemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.servicesystemctl restart neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.servicesystemctl status neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
1.6.3.1、网络选项2:自助网络
systemctl restart openstack-nova-api.service && systemctl status openstack-nova-api.servicesystemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.servicesystemctl restart neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.servicesystemctl status neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service#网络选项 2,还启用和启动第 3 层服务systemctl enable neutron-l3-agent.servicesystemctl restart neutron-l3-agent.servicesystemctl status neutron-l3-agent.service
2、计算节点
2.1、安装
yum install openstack-neutron-linuxbridge ebtables ipset -ycp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/neutron.confvim /etc/neutron/neutron.conf[DEFAULT]# ...transport_url = rabbit://openstack:openstack@controllerauth_strategy = keystone[keystone_authtoken]# ...www_authenticate_uri = http://controller:5000auth_url = http://controller:5000memcached_servers = controller:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = neutronpassword = neutron[oslo_concurrency]# ...lock_path = /var/lib/neutron/tmp
2.2、网络配置
2.2.1、网络选项1:提供商网络
2.2.1.1、安装组件、配置网桥代理
cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/plugins/ml2/linuxbridge_agent.inivim /etc/neutron/plugins/ml2/linuxbridge_agent.ini[linux_bridge]physical_interface_mappings = provider:PROVIDER_INTERFACE_NAME[vxlan]enable_vxlan = false[securitygroup]# ...enable_security_group = truefirewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
2.2.1.2、确保 Linux 操作系统内核支持网桥筛选器:
#把值配置为1sysctl net.bridge.bridge-nf-call-iptablessysctl net.bridge.bridge-nf-call-ip6tables#如果没有这个文件,要启用网络网桥支持modprobe br_netfiltervim /etc/sysctl.confnet.bridge.bridge-nf-call-iptables =1net.net.bridge.bridge-nf-call-ip6tables =1sysctl -p
2.2.2、网络选项2:自助网络
2.2.2.1、安装组件、配置网桥代理
cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.baksed -ri '/^[ \t]*(#|$)/d' /etc/neutron/plugins/ml2/linuxbridge_agent.inivim /etc/neutron/plugins/ml2/linuxbridge_agent.ini[linux_bridge]physical_interface_mappings = provider:PROVIDER_INTERFACE_NAME[vxlan]enable_vxlan = truelocal_ip = OVERLAY_INTERFACE_IP_ADDRESSl2_population = true[securitygroup]# ...enable_security_group = truefirewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
2.2.2.2、确保 Linux 操作系统内核支持网桥筛选器:
#把值配置为1sysctl net.bridge.bridge-nf-call-iptablessysctl net.bridge.bridge-nf-call-ip6tables#如果没有这个文件,要启用网络网桥支持modprobe br_netfiltervim /etc/sysctl.confnet.bridge.bridge-nf-call-iptables =1net.net.bridge.bridge-nf-call-ip6tables =1sysctl -p
2.3、将计算服务配置为使用网络服务
vim /etc/nova/nova.conf[neutron]# ...auth_url = http://controller:5000auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = neutronpassword = neutron
2.4、启动
systemctl restart openstack-nova-compute.servicesystemctl status openstack-nova-compute.servicesystemctl enable neutron-linuxbridge-agent.servicesystemctl restart neutron-linuxbridge-agent.servicesystemctl status neutron-linuxbridge-agent.service
3、验证
openstack extension list --networkopenstack network agent list
