首页 > 代码库 > openstack controller ha测试环境搭建记录(十二)——配置neutron(计算节点)
openstack controller ha测试环境搭建记录(十二)——配置neutron(计算节点)
在计算节点配置内核参数:
vi /etc/sysctl.conf
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
在计算节点使内核参数立即生效:
sysctl -p
在计算节点安装软件:
yum install -y openstack-neutron-ml2 openstack-neutron-openvswitch
在计算节点修改配置文件:
openstack-config --set /etc/neutron/neutron.conf DEFAULT rpc_backend rabbit
openstack-config --set /etc/neutron/neutron.conf DEFAULT rabbit_password 123456
openstack-config --set /etc/neutron/neutron.conf DEFAULT rabbit_hosts controller1:5672,controller2:5672,controller3:5672
openstack-config --set /etc/neutron/neutron.conf DEFAULT rabbit_retry_interval 1
openstack-config --set /etc/neutron/neutron.conf DEFAULT rabbit_retry_backoff 2
openstack-config --set /etc/neutron/neutron.conf DEFAULT rabbit_max_retries 0
openstack-config --set /etc/neutron/neutron.conf DEFAULT rabbit_durable_queues true
openstack-config --set /etc/neutron/neutron.conf DEFAULT rabbit_ha_queues true
openstack-config --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_uri http://myvip:5000/v2.0
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken identity_uri http://myvip:35357
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken admin_user neutron
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken admin_password 123456
openstack-config --set /etc/neutron/neutron.conf DEFAULT core_plugin ml2
openstack-config --set /etc/neutron/neutron.conf DEFAULT service_plugins router
openstack-config --set /etc/neutron/neutron.conf DEFAULT allow_overlapping_ips True
openstack-config --set /etc/neutron/neutron.conf DEFAULT verbose True
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers flat,gre
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types gre
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers openvswitch
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_flat flat_networks external
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_gre tunnel_id_ranges 1:1000
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup enable_security_group True
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup enable_ipset True
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs local_ip 10.0.0.31
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling True
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini agent tunnel_types gre
在计算节点启动服务:
systemctl enable openvswitch.service
systemctl start openvswitch.service
在计算节点修改配置文件:
openstack-config --set /etc/nova/nova.conf DEFAULT network_api_class nova.network.neutronv2.api.API
openstack-config --set /etc/nova/nova.conf DEFAULT security_group_api neutron
openstack-config --set /etc/nova/nova.conf DEFAULT linuxnet_interface_driver nova.network.linux_net.LinuxOVSInterfaceDriver
openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
openstack-config --set /etc/nova/nova.conf neutron url http://myvip:9696
openstack-config --set /etc/nova/nova.conf neutron auth_strategy keystone
openstack-config --set /etc/nova/nova.conf neutron admin_auth_url http://myvip:35357/v2.0
openstack-config --set /etc/nova/nova.conf neutron admin_tenant_name service
openstack-config --set /etc/nova/nova.conf neutron admin_username neutron
openstack-config --set /etc/nova/nova.conf neutron admin_password 123456
在计算节点创建符号链接、拷贝等操作:
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
cp /usr/lib/systemd/system/neutron-openvswitch-agent.service \
/usr/lib/systemd/system/neutron-openvswitch-agent.service.orig
sed -i ‘s,plugins/openvswitch/ovs_neutron_plugin.ini,plugin.ini,g‘ \
/usr/lib/systemd/system/neutron-openvswitch-agent.service
重启相关服务:
systemctl restart openstack-nova-compute.service
systemctl enable neutron-openvswitch-agent.service
systemctl start neutron-openvswitch-agent.service
验证:
source admin-openrc.sh
neutron agent-list
+--------------------------------------+--------------------+----------+-------+----------------+---------------------------+
| id | agent_type | host | alive | admin_state_up | binary |
+--------------------------------------+--------------------+----------+-------+----------------+---------------------------+
| afdc8ccd-d997-41ca-8176-59b47b90cf87 | Metadata agent | network | :-) | True | neutron-metadata-agent |
| b70c7a39-9aae-4fb4-8be1-f4ac7a127004 | Open vSwitch agent | compute1 | :-) | True | neutron-openvswitch-agent |
| b934acfb-8a10-424b-8510-2c692adbadd3 | DHCP agent | network | :-) | True | neutron-dhcp-agent |
| bb530231-b099-455d-8cbd-72c782a6514e | Open vSwitch agent | network | :-) | True | neutron-openvswitch-agent |
| c21e8af8-0db9-4aaa-b7c6-788109fd23c7 | L3 agent | network | :-) | True | neutron-l3-agent |
+--------------------------------------+--------------------+----------+-------+----------------+---------------------------+
openstack controller ha测试环境搭建记录(十二)——配置neutron(计算节点)