↓↓↓↓↓↓↓↓视频已上线 B 站↓↓↓↓↓↓↓↓
<h2 id="1">1.创建网络服务数据库</h2>
#mysql -uroot -p000000
>create database neutron;
> grant all privileges on neutron.* to 'neutron'@'localhost' identified by '000000';
> grant all privileges on neutron.* to 'neutron'@'%' identified by '000000';
复制代码
<h2 id="2">2.获得 admin 凭证来获取只有管理员能执行的命令的访问权限</h2>
<h2 id="3">3.创建服务证书,neutron 用户</h2>
#openstack user create --domain default --password 000000 neutron
#openstack role add --project service --user neutron admin
#openstack service create --name neutron --description "OpenStack Networking" network
复制代码
<h2 id="4">4.创建网络服务 API 端点:</h2>
#openstack endpoint create --region RegionOne network public http://controller:9696
#openstack endpoint create --region RegionOne network internal http://controller:9696
#openstack endpoint create --region RegionOne network admin http://controller:9696
复制代码
<h2 id="5">5.Controller 节点安装并配置网络服务组件</h2>
#yum -y install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables
复制代码
1.编辑配置文件 /etc/neutron/neutron.conf
#vi /etc/neutron/neutron.conf
在 [database] 部分,配置数据库访问:
connection = mysql+pymysql://neutron:000000@controller/neutron
在``[DEFAULT]``部分,添加如下内容
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True
rpc_backend = rabbit
auth_strategy = keystone
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
在[oslo_messaging_rabbit]部分,配置 “RabbitMQ” 消息队列的连接:
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 000000
在[keystone_authtoken]部分,配置认证服务访问
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = 000000
在[nova]部分,配置网络服务来通知计算节点的网络拓扑变化:
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = 000000
在 [oslo_concurrency] 部分,配置锁路径:
lock_path = /var/lib/neutron/tmp
复制代码
2.编辑/etc/neutron/plugins/ml2/ml2_conf.ini
文件,配置启用 flat,VLAN,GRE,LOCAL 以及 VXLAN 网络:
#vi /etc/neutron/plugins/ml2/ml2_conf.ini
在[ml2]下添加
type_drivers = flat,vlan,vxlan,gre,local
tenant_network_types = vxlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security
在 [ml2_type_flat] 部分,配置公共虚拟网络为flat网络
flat_networks = provider
在 [ml2_type_vxlan] 部分,为私有网络配置VXLAN网络识别的网络范围:
vni_ranges = 1:1000
在 [securitygroup] 部分,启用 ipset 增加安全组规则的高效性:
enable_ipset = True
复制代码
3.配置 linuxbridge 代理,编辑文件/etc/neutron/plugins/ml2/linuxbridge_agent.ini
#vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
在 [linux_bridge] 部分,将公共虚拟网络和公共物理网络接口对应起来:
physical_interface_mappings = provider:eth1
#注意,此处的eth1为基础环境配置中的200的网段 也就是 192.168.200.0/24
在 [vxlan] 部分,启用VXLAN覆盖网络,配置覆盖网络的物理网络接口的IP地址,启用layer-2 population:
enable_vxlan = True
local_ip = 192.168.100.10 #这里的IP地址是controller的管理网络
l2_population = True
在 [securitygroup] 部分,启用安全组并配置 Linuxbridge iptables firewall driver:
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
复制代码
4.配置 layer-3 代理,编辑文件/etc/neutron/l3_agent.ini
#vi /etc/neutron/l3_agent.ini
在[DEFAULT]下添加
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
external_network_bridge =
复制代码
5.配置 DHCP 代理编辑/etc/neutron/dhcp_agent.ini
文件
#vi /etc/neutron/dhcp_agent.ini
在[DEFAULT]下添加
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
复制代码
6.编辑/etc/neutron/metadata_agent.ini
文件
#vi /etc/neutron/metadata_agent.ini
在``[DEFAULT]`` 部分,配置元数据主机以及共享密码:
nova_metadata_ip = controller
metadata_proxy_shared_secret = 000000
复制代码
7.编辑/etc/nova/nova.conf
文件
#vi /etc/nova/nova.conf
在``[neutron]``部分,配置访问参数,启用元数据代理并设置密码:
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = 000000
service_metadata_proxy = True
metadata_proxy_shared_secret = 000000
复制代码
<h2 id="6">6.网络服务初始化</h2>
# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
复制代码
<h2 id="7">7.同步数据库</h2>
# 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
复制代码
<h2 id="8">8.Controller 节点重启计算 API 服务</h2>
# systemctl restart openstack-nova-api.service
复制代码
<h2 id="9">9.启动网络服务并设置开机启动</h2>
#systemctl start neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service neutron-l3-agent.service#systemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service neutron-l3-agent.service
<h2 id="10">10.Compute 节点安装并配置 neutron 服务</h2>
# yum -y install openstack-neutron-linuxbridge ebtables ipset
复制代码
1.编辑/etc/neutron/neutron.conf
文件
#vi /etc/neutron/neutron.conf
在 “[DEFAULT]” 下添加
rpc_backend = rabbit
auth_strategy = keystone
在[oslo_messaging_rabbit]下添加
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 000000
在[keystone_authtoken]下添加
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = 000000
在 [oslo_concurrency] 部分,配置锁路径:
lock_path = /var/lib/neutron/tmp
复制代码
2.编辑/etc/neutron/plugins/ml2/linuxbridge_agent.ini
文件
#vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
在 [linux_bridge] 部分,将公共虚拟网络和公共物理网络接口对应起来
physical_interface_mappings = provider:eth1
在 [vxlan] 部分,启用VXLAN覆盖网络,配置覆盖网络的物理网络接口的IP地址,启用layer-2 population:
enable_vxlan = True
local_ip = 192.168.100.20
l2_population = True
在 [securitygroup] 部分,启用安全组并配置 Linuxbridge iptables firewall driver:
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
复制代码
3.编辑/etc/nova/nova.conf
文件并完成下面的操作
#vi /etc/nova/nova.conf
在[neutron]部分添加
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = 000000
复制代码
<h2 id="11">11.compute 节点重启服务并设置开机自启</h2>
# systemctl restart openstack-nova-compute.service neutron-linuxbridge-agent.service
# systemctl enable neutron-linuxbridge-agent.service
复制代码
<h2 id="12">12.验证(Controller 节点)</h2>
#. /root/admin-openrc
#neutron ext-list
#neutron agent-list
复制代码
评论