本节开始安装Neutron服务,Neutron用于管理虚拟网络,在CT01和PC01分别进行相关模块的安装
一、在CT01安装相关模块
1、新建数据库
CREATE DATABASE neutron; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'neutron'; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'neutron';
2、新建用户及endpoint
. admin-openrc openstack user create --domain default --password-prompt neutron openstack role add --project serviceproject --user neutron admin openstack service create --name neutron --description "OpenStack Networking" network openstack endpoint create --region Region01 network public http://CT01:9696 openstack endpoint create --region Region01 network internal http://CT01:9696 openstack endpoint create --region Region01 network admin http://CT01:9696
3、安装
apt install neutron-server neutron-plugin-ml2 neutron-linuxbridge-agent neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent
4、修改配置
4.1、/etc/neutron/neutron.conf
[database] connection = mysql+pymysql://neutron:neutron@CT01/neutron [DEFAULT] core_plugin = ml2 service_plugins = router allow_overlapping_ips = true transport_url = rabbit://openstack:openstack@CT01 auth_strategy = keystone notify_nova_on_port_status_changes = true notify_nova_on_port_data_changes = true [keystone_authtoken] auth_uri = http://CT01:5000 auth_url = http://CT01:35357 memcached_servers = CT01:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = serviceproject username = neutron password = neutron [nova] auth_url = http://CT01:35357 auth_type = password project_domain_name = default user_domain_name = default region_name = Region01 project_name = serviceproject username = nova password = nova
4.2、/etc/neutron/plugins/ml2/ml2_conf.ini
[ml2] type_drivers = flat,vlan,vxlan tenant_network_types = vxlan mechanism_drivers = linuxbridge,l2population extension_drivers = port_security [ml2_type_flat] flat_networks = provider [ml2_type_vxlan] vni_ranges = 1:1000 [securitygroup] enable_ipset = true
4.3、/etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge] physical_interface_mappings = provider:enp0s8 [vxlan] enable_vxlan = true local_ip = 10.0.3.10 l2_population = true [securitygroup] enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
4.4、/etc/neutron/l3_agent.ini
[DEFAULT] interface_driver = linuxbridge
4.5、 /etc/neutron/dhcp_agent.ini
[DEFAULT] interface_driver = linuxbridge dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true
4.6、 /etc/neutron/metadata_agent.ini
[DEFAULT] nova_metadata_ip = CT01 metadata_proxy_shared_secret = metadata
4.7、 /etc/nova/nova.conf
[neutron] url = http://CT01:9696 auth_url = http://CT01:35357 auth_type = password project_domain_name = default user_domain_name = default region_name = Region01 project_name = serviceproject username = neutron password = neutron service_metadata_proxy = true metadata_proxy_shared_secret = metadata
5、填充数据库,并重启服务
sudo 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 sudo service nova-api restart sudo service neutron-server restart sudo service neutron-linuxbridge-agent restart sudo service neutron-dhcp-agent restart sudo service neutron-metadata-agent restart sudo service neutron-l3-agent restart
二、在PC01安装相关模块
1、安装
apt install neutron-linuxbridge-agent
2、修改配置文件
2.1、/etc/neutron/neutron.conf
[database] #注释下面内容 #connection [DEFAULT] transport_url = rabbit://openstack:openstack@CT01 auth_strategy = keystone [keystone_authtoken] auth_uri = http://CT01:5000 auth_url = http://CT01:35357 memcached_servers = CT01:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = serviceproject username = neutron password = neutron
2.2、/etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge] physical_interface_mappings = provider:enp0s8 [vxlan] enable_vxlan = true local_ip = 10.0.3.11 l2_population = true [securitygroup] enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
2.3、/etc/nova/nova.conf
[neutron] url = http://CT01:9696 auth_url = http://CT01:35357 auth_type = password project_domain_name = default user_domain_name = default region_name = Region01 project_name = serviceproject username = neutron password = neutron
3、重启服务
service nova-compute restart service neutron-linuxbridge-agent restart
三、在CT01进行验证
1、验证
. admin-openrc openstack extension list --network openstack network agent list