Neutron es uno de los componentes importantes en OpenStack, nos permite crear o conectar un dispositivo de interfaz a las redes, siga esta guía para configurar Neutron (redes) en su entorno. Neutron administra todas las cosas relacionadas con las redes que necesitamos para la infraestructura de redes virtuales, proporciona las redes, subredes y abstracciones de objetos de enrutador.
Debemos elegir cualquiera de las siguientes opciones de red para continuar con la configuración de OpenStack.
Opción de red 1:Redes de proveedores
Opción de red 2:Redes de autoservicio
Para saber más sobre estos, haga clic aquí.
Aquí, vamos a utilizar redes de autoservicio.
Instalar y configurar el nodo del controlador:
Antes de configurar el servicio Neutron, debemos crear una base de datos, un servicio y un punto final de API. Para hacer eso, inicie sesión como raíz en el servidor MySQL.
# mysql -u root -p
Crea la base de datos de neutrones.
CREATE DATABASE neutron;
Otorgue un permiso adecuado a la base de datos de neutrones.
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'password';
Reemplace “contraseña ” con una contraseña adecuada. Salga de MySQL.
Cargue su credencial de administrador desde la secuencia de comandos del entorno.
# source admin-openrc.sh
Cree el usuario neutron para crear credenciales de servicio.
# openstack user create --password-prompt neutron User Password: Repeat User Password: +-----------+----------------------------------+ | Field | Value | +-----------+----------------------------------+ | domain_id | default | | enabled | True | | id | 91c75b24ce324309891f6a4ea8b33887 | | name | neutron | +-----------+----------------------------------+
Agregue el rol de administrador al usuario neutron.
# openstack role add --project service --user neutron admin
Cree la entidad de servicio de neutrones.
# openstack service create --name neutron --description "OpenStack Neutron" network +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Neutron | | enabled | True | | id | 1834077666c54c93821c95a03fa853a1 | | name | neutron | | type | network | +-------------+----------------------------------+
Cree el punto final de la API del servicio de neutrones.
# openstack endpoint create --region RegionOne network public http://controller:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | c145840a76004e6d9e4bdccfb3603e84 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 1834077666c54c93821c95a03fa853a1 | | service_name | neutron | | service_type | network | | url | http://controller:9696 | +--------------+----------------------------------+ # openstack endpoint create --region RegionOne network internal http://controller:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | d2305c57e55341fcbfbc1bd91c4d6378 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 1834077666c54c93821c95a03fa853a1 | | service_name | neutron | | service_type | network | | url | http://controller:9696 | +--------------+----------------------------------+ # openstack endpoint create --region RegionOne network admin http://controller:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 2dadc6ded42a4db3bf217d1abad22f15 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 1834077666c54c93821c95a03fa853a1 | | service_name | neutron | | service_type | network | | url | http://controller:9696 | +--------------+----------------------------------+
Instalar y configurar los componentes de red en el nodo del controlador:
# apt-get install neutron-server neutron-plugin-ml2 neutron-plugin-linuxbridge-agent neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent python-neutronclient conntrack
Edite /etc/neutron/neutron.conf.
# nano /etc/neutron/neutron.conf
Modifique la configuración a continuación y asegúrese de colocar entradas en las secciones adecuadas.
[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 nova_url = http://controller:8774/v2 verbose = True ## Replace "controller" with hostname of openstack controller [oslo_messaging_rabbit] ... rabbit_host = controller rabbit_userid = openstack rabbit_password = password ## Replace "password" with the password you chose for the openstack account in RabbitMQ ## Replace "controller" with hostname of openstack controller [database] ... connection = mysql+pymysql://neutron:password@controller/neutron ## Replace "password" with the password you chose for neutron database ## Commentout any other MySQL connections [keystone_authtoken] ... auth_uri = http://controller:5000 auth_url = http://controller:35357 auth_plugin = password project_domain_id = default user_domain_id = default project_name = service username = neutron password = password ## Replace "password" with the password you chose for neutron user in the identity service. ## Commentout other authentication details. [nova] ... auth_url = http://controller:35357 auth_plugin = password project_domain_id = default user_domain_id = default region_name = RegionOne project_name = service username = nova password = password ## Replace "password" with the password you chose for nova user in the identity service.
Configurar complemento de capa modular 2 (ML2):
Edite el archivo /etc/neutron/plugins/ml2/ml2_conf.ini
# nano /etc/neutron/plugins/ml2/ml2_conf.ini
Modifica las siguientes estrofas.
[ml2] ... type_drivers = flat,vlan,vxlan tenant_network_types = vxlan mechanism_drivers = linuxbridge,l2population extension_drivers = port_security [ml2_type_flat] ... flat_networks = public [ml2_type_vxlan] ... vni_ranges = 1:1000 [securitygroup] ... enable_ipset = True
Configurar el agente puente de Linux:
Para configurar el agente de puente de Linux, edite /etc/neutron/plugins/ml2/linuxbridge_agent.ini en el nodo del controlador.
# nano /etc/neutron/plugins/ml2/linuxbridge_agent.ini
Realice los cambios en el archivo como se muestra a continuación.
[linux_bridge] physical_interface_mappings = public:eth1 ## Replace "eth1" with the name of the physical public facing network interface. [vxlan] enable_vxlan = True local_ip = 192.168.12.21 l2_population = True ## Replace "192.168.12.21" with the management ip-address of the controller. [agent] ... prevent_arp_spoofing = True [securitygroup] ... enable_security_group = True firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
Configurar el agente de capa 3:
Edite el archivo /etc/neutron/l3_agent.ini
# nano /etc/neutron/l3_agent.ini
Modifique el archivo como se indica a continuación.
[DEFAULT] ... interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver external_network_bridge = verbose = True
Configurar el agente DHCP:
Edite el archivo /etc/neutron/dhcp_agent.ini.
# nano /etc/neutron/dhcp_agent.ini
Realice los cambios pertinentes en el archivo como se muestra a continuación.
[DEFAULT] ... interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = True verbose = True dnsmasq_config_file = /etc/neutron/dnsmasq-neutron.conf
Ahora cree el archivo /etc/neutron/dnsmasq-neutron.conf para habilitar la opción DHCP MTU (26) y configúrelo a 1450 bytes:
# nano /etc/neutron/dnsmasq-neutron.conf
Coloque debajo de la línea en él.
dhcp-option-force=26,1450
Configurar el agente de metadatos:
Edite el archivo /etc/neutron/metadata_agent.ini en el nodo del controlador.
# nano /etc/neutron/metadata_agent.ini
Realice los cambios correspondientes.
[DEFAULT] ... auth_uri = http://controller:5000 auth_url = http://controller:35357 auth_region = RegionOne auth_plugin = password project_domain_id = default user_domain_id = default project_name = service username = neutron password = password ## Replace "password" with the password you chose for the neutron user in the Identity service. ## Commentout other authentication details. nova_metadata_ip = controller metadata_proxy_shared_secret = METADATA_SECRET ## Replace METADATA_SECRET with a suitable secret for the metadata proxy. generate using # openssl rand -hex 10 verbose = True
Para finalizar la instalación, complete la base de datos.
# 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
Reinicie el servicio Compute API.
# service nova-api restart
Reinicie los servicios de red.
# service neutron-server restart # service neutron-plugin-linuxbridge-agent restart # service neutron-dhcp-agent restart # service neutron-metadata-agent restart # service neutron-l3-agent restart
De forma predeterminada, los paquetes de Ubuntu crean una base de datos SQLite. puede eliminar el archivo de la base de datos SQLite.
# rm -f /var/lib/neutron/neutron.sqlite
Verifíquelo enumerando las extensiones cargadas.
# neutron ext-list +-----------------------+-----------------------------------------------+ | alias | name | +-----------------------+-----------------------------------------------+ | dns-integration | DNS Integration | | ext-gw-mode | Neutron L3 Configurable external gateway mode | | binding | Port Binding | | agent | agent | | subnet_allocation | Subnet Allocation | | l3_agent_scheduler | L3 Agent Scheduler | | external-net | Neutron external network | | flavors | Neutron Service Flavors | | net-mtu | Network MTU | | quotas | Quota management support | | l3-ha | HA Router extension | | provider | Provider Network | | multi-provider | Multi Provider Network | | extraroute | Neutron Extra Route | | router | Neutron L3 Router | | extra_dhcp_opt | Neutron Extra DHCP opts | | security-group | security-group | | dhcp_agent_scheduler | DHCP Agent Scheduler | | rbac-policies | RBAC Policies | | port-security | Port Security | | allowed-address-pairs | Allowed Address Pairs | | dvr | Distributed Virtual Router | +-----------------------+-----------------------------------------------+
¡Eso es todo!. Es hora de instalar y configurar el nodo de cómputo para que funcione con el componente Neutron.