Neutron的配置文件随着代码的修改而变化,理解每个配置选项的含义对于正确部署Neutron或快速定位Neutron的异常问题有着重要的意思。下面仅仅简陋的讲解下Neutron主要配置文件重要配置项的含义,表述不准确的地方还请见谅。
1)neutron进程分布
控制节点:neutron-server,
网络节点:
neutron-lbaas-agent/neutron-metadata-agent/neutron-l3-agent/neutron-dhcp-agent/neutron-openvswitch-agent/neutron-vpn-agent(可以看出没有fwaas的服务进程,原因是其包含在neutron-l3-agent中)
计算节点:neutron-openvswitch-agent;
每个进程所用到的配置文件,可以通过ps –aux|grep service_name来查看启动所需的相应文件。
2)配置文件主要有:
其中J版中新添dnsmasq-neutron.conf以增加对dnsmasq服务的控制,下面对配置文件的主要参数进行解析:
a)cat api-paste.ini
用于neutron提供restful api被调用的认证相关所需信息,包括租户名称/用户名称/密码、主机IP/访问协议http/访问端口35357等token信息:
b)cat dnsmasq-neutron.conf
dhcp-option-force=26,1400
其中1400代表新建VM通过DCHP获取IP后端口的MTU大小;
c)cat l3_agent.ini
[DEFAULT]
#L3 agent服务调试开关
debug = False
# OVS, Ryu, NEC做为Plugin时的接口驱动
interface_driver=neutron.agent.linux.interface.OVSInterfaceDriver
#OVS interface 是否使用ovs_use_veth,需要内核支持namespace.
# ovs_use_veth = False
# 允许建立多个namespace,以此来支持IP地址重叠,即一个租户在不同的路由器下可以同时使用相同的私网网段
use_namespaces = True
# 此选项在内核不支持多个namespace时,只绑定一个对应的router
router_id =
# 在创建多个外网时(不包含一个外网多个子网的情况),用于将l3 agent和外网ID的绑定
gateway_external_network_id =
# Indicates that this L3 agent should alsohandle routers that do not have
# an external network gatewayconfigured. This option should be Trueonly
# for a single agent in a Neutrondeployment, and may be False for all agents
# if all routers must have an externalnetwork gateway
# handle_internal_only_routers = True
handle_internal_only_routers = True
# 网络节点外网网桥的名字
external_network_bridge = br-ex
# Neutron metadata server的TCP端口
metadata_port = 9697
# 同步路由相关的配置项
send_arp_for_ha = 3
periodic_interval = 40
periodic_fuzzy_delay = 5
# 使能metadata_proxy
enable_metadata_proxy = True
# Location of Metadata Proxy UNIX domainsocket
# metadata_proxy_socket =$state_path/metadata_proxy
# 默认情况下,当虚拟路由器删除时,对应的namespace是不会删除的,这样做的原因可以详见https://bugs.launchpad.net/neutron/+bug/1052535的讨论;开启时需明确风险
router_delete_namespaces = False
# 执行ovs命令的超时时间
# ovs_vsctl_timeout = 10
# 该选项是针对J版新添的DVR特性做的配置项,默认legacy是没有开启DVR的时候配置,开启DVR的时候,计算节点配置为dvr,单纯的网络节点配置为dvr_snat
agent_mode = legacy
# l3 agnet ha的一些配置选项
# ha_confs_path = $state_path/ha_confs
# ha_vrrp_auth_type = PASS
# ha_vrrp_auth_password =
# ha_vrrp_advert_int = 2
#是否自动failover
allow_automatic_l3agent_failover=False
d)metadata_agent.ini文件主要用于获取。。的信息,和网络本身关系不大;
e)plugin.ini为plugins/ml2/ml2_conf.ini的链接,仅在控制节点有,其内容解析参见ml2_conf.in;
f) policy.json为控制策略相关的配置,如果/etc/selinux/config为SELINUX=disabled或SELINUX=permissive将不再生效,对于安全要求较高的平台不能关闭或失效该服务;
g)rootwrap.conf的主要作用是让neutron的python代码配置,最终都要转换为底层core plugin或service plugin的在下发命令,比如linux namespace、ovs、iptables、haproxy、openswan等等,在配置这些底层服务命令的时候,需要保证命令的可执行权限或合适路径;
h)cat dhcp_agent.ini
DHCP配置选项中和多和l3 agent重复,其中需要提及的包括租约个数以防止攻击,以及与router的namespace处理方式相对应的namspace的处理配置选项;
………
# Limit number of leases to prevent adenial-of-service.
# dnsmasq_lease_max = 16777216
……….
# dhcp_delete_namespaces, which is false bydefault, can be set to True if
# namespaces can be deleted cleanly on thehost running the dhcp agent.
# Do not enable this until you understandthe problem with the Linux iproute
# utility mentioned inhttps://bugs.launchpad.net/neutron/+bug/1052535 and
# you are sure that your version of iproutedoes not suffer from the problem.
# If True, namespaces will be deleted whena dhcp server is disabled.
# dhcp_delete_namespaces = False
dhcp_delete_namespaces = False
…………..
i) catfwaas_driver.ini
#比较简单,主要是底层驱动以及是否使能,fwaas的底层plugin默认为iptables
[fwaas]
driver =neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver
enabled = True
j) cat lbaas_agent.ini
配置选项较多,较为重要的和fwaas一样,底层的plugin配置
…..
device_driver =neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver
[haproxy]
……
# The user group
user_group = haproxy
k) cat neutron.conf
#neutron的配置选项较多,仅对重要选项进行一一解释
[DEFAULT]
……..
# 是否开启DVR功能,如果开启需要底层做相关的配置;默认为False表示不开启
router_distributed = False
……..
#日志目录
log_dir =/var/log/neutron
………….
#提供访问API的地址和端口
bind_host = 0.0.0.0
bind_port = 9696
………..
# core_plugin 的配置,J版后ml2用途较多
core_plugin =neutron.plugins.ml2.plugin.Ml2Plugin
#需要开启的services功能,可能包括router,firewall,lbaas,vpnaas,metering
service_plugins=neutron.services.loadbalancer.plugin.LoadBalancerPlugin,neutron.services.l3_router.l3_router_plugin.L3RouterPlugin,neutron.services.firewall.fwaas_plugin.FirewallPlugin
………..
#虚拟端口的分配基址
base_mac = fa:16:3e:00:00:00
# 相应的DVR Base MACaddress
# dvr_base_mac = fa:16:3f:00:00:00
…..
#DHCP的租约时间
dhcp_lease_duration = 86400
…………….
# 是否允许地址重叠,如果允许的话底层需要支持namespace功能
allow_overlapping_ips = True
…………..
对于网络配置有关限额的配置
# Maximum number of DNS nameservers persubnet
# max_dns_nameservers = 5
# Maximum number of host routes per subnet
# max_subnet_host_routes = 20
# Maximum number of fixed ips per port
# max_fixed_ips_per_port = 5
# Maximum number of routes per router
# max_routes = 30
# 用来判断当neutron的agent最后更新时间和当前时间(neutronserver)相差超过该值时,就认为该agent是死掉的
agent_down_time = 75
#当有多个l3 agent时,路由,dhcp,lb等的调度策略,默认都是ChanceScheduler
# network_scheduler_driver =neutron.scheduler.dhcp_agent_scheduler.ChanceScheduler
router_scheduler_driver =neutron.scheduler.l3_agent_scheduler.ChanceScheduler
# loadbalancer_pool_scheduler_driver =neutron.services.loadbalancer.agent_scheduler.ChanceScheduler
# network_auto_schedule = True
# router_auto_schedule = True
# 自动将死掉的l3 agent重新分配到其他活着的l3agent上,需要admin_state_up被设置为alive.默认为False表示关闭该功能
# allow_automatic_l3agent_failover = False
# 对应一个网络开启的dhcp服务数,当有多个l3agent时会分布在不同的l3 agent上起到HA的作用
dhcp_agents_per_network = 3
# 是否开启L3 HA的作用以及开启的相关配置选项
# l3_ha = False
## max_l3_agents_per_router = 3
# min_l3_agents_per_router = 2
# l3_ha_net_cidr = 169.254.192.0/18
………….
#为提高api和rpc的服务能力,可以开启多个服务进程,I版默认为0,表示值开启一个,J版的RDO上默认开启16个
api_workers = 2
rpc_workers = 2
#当端口改变时,通知nova
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
nova_url = http://192.168.23.235:8774/v2
nova_region_name =RegionOne
nova_admin_username =nova
nova_admin_tenant_id =42736627a3c1418aa76b0f6f5db3c3e1
nova_admin_password =9cce0a69ebfa4e8d
nova_admin_auth_url =http://192.168.23.235:35357/v2.0
#和其他组件一样,可以选择对应的消息机制类型,包括amqp,qpid等,也包括rabbit的消息队列集群HA服务
………….
#amqp_durable_queues=false
…………..
#qpid_hostname=localhost
…………
rabbit_port=5672
rabbit_hosts=192.168.23.235:5672
# ZeroMQ receiver listening port. (integervalue)
#rpc_zmq_port=9501
……………..
[quotas]
# 网络相关限额配置
# default_quota = -1
# quota_network = 10
# quota_subnet = 10
# quota_port = 50
# quota_security_group = 10
# quota_security_group_rule = 100
# quota_vip = 10
# quota_pool = 10
# quota_member = -1
# quota_health_monitor = -1
# quota_router = 10
# quota_floatingip = 50
# quota_firewall = 1
# quota_firewall_policy = 1
# quota_firewall_rule = 100
[agent]
#agent想server报告状态的时间间隔,
report_interval = 30
…………
[service_providers]
# 向neutron提供底层serviceplugin的说明
service_provider=LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
service_provider=VPN:openswan:neutron.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default
k)cat plugins/ml2/ml2_conf.ini
[ml2]
# 底层网络资源使用类型type_drivers= local,flat,vlan,gre,vxlan
type_drivers = vxlan
# Example: type_drivers =flat,vlan,gre,vxlan
# 租户网络类型,可以配置多个tenant_network_types= vlan,gre,vxlan
tenant_network_types = vxlan
# 底层驱动机制
mechanism_drivers =openvswitch
[ml2_type_flat]
…………..
#flat对应物理网络配置:
# Example:flat_networks = physnet1,physnet2
[ml2_type_vlan]
…………..
#vlan对应的物理网络配置,包括vlan的范围
# network_vlan_ranges =
# Example: network_vlan_ranges =physnet1:1000:2999,physnet2
[ml2_type_gre]
# gre类型对应的隧道ID范围
# tunnel_id_ranges =
[ml2_type_vxlan]
# vxlan对应的vni范围
vni_ranges =1:1000
#vxlan对应的组播组
vxlan_group =224.0.0.1
[securitygroup]
#使能安全组
enable_security_group = True
………….
l) catplugins/openvswitch/ovs_neutron_plugin.ini
[ovs]
…………….
#ovs对应的底层配置选项,需要和上面ml2的机制相对应,包括网络类型以及对应的取值范围,参与含义根据名字很容易解析出,不再赘述
# Sample Configurations.
#-----------------------------------------------------------------------------
#
# 1. With VLANs on eth1.
# [ovs]
# network_vlan_ranges = default:2000:3999
# tunnel_id_ranges =
# integration_bridge = br-int
# bridge_mappings = default:br-eth1
#
# 2. With GRE tunneling.
# [ovs]
# network_vlan_ranges =
# tunnel_id_ranges = 1:1000
# integration_bridge = br-int
# tunnel_bridge = br-tun
# local_ip = 10.0.0.3
#
# 3. With VXLAN tunneling.
# [ovs]
# network_vlan_ranges =
# tenant_network_type = vxlan
# tunnel_type = vxlan
# tunnel_id_ranges = 1:1000
# integration_bridge = br-int
# tunnel_bridge = br-tun
# local_ip = 10.0.0.3
# [agent]
# tunnel_types = vxlan
n) cat vpn_agent.ini
[DEFAULT]
…….
#与FW和LB一样,重要的是底层driver
[vpnagent]
…………..
vpn_device_driver=neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver
[ipsec]
# ipsec_status_check_interval=60
sina微博@北京-小武 个人博客: http://blog.csdn.net/night_elf_1020
|