GNU/Linux >> Linux Esercitazione >  >> Ubuntu

OpenStack Liberty su Ubuntu 14.04 – Configura Neutron

Neutron è uno dei componenti importanti in OpenStack, ci consente di creare o collegare dispositivi di interfaccia alle reti, segui questa guida per configurare Neutron (Networking) nel tuo ambiente. Neutron gestisce tutte le cose relative alla rete di cui abbiamo bisogno per l'infrastruttura di rete virtuale, fornisce le reti, le sottoreti e le astrazioni degli oggetti router.

Dobbiamo scegliere una delle seguenti opzioni di rete per procedere con la configurazione di OpenStack.

Opzione di rete 1:reti di provider
Opzione di rete 2:reti self-service

Per saperne di più su questi, clicca qui.

Qui utilizzeremo le reti self-service.

Installa e configura il nodo controller:

Prima di configurare il servizio Neutron, è necessario creare un database, un servizio e un endpoint API. Per farlo, accedi come root al server MySQL.

# mysql -u root -p

Crea il database dei neutroni.

CREATE DATABASE neutron;

Concedi un'adeguata autorizzazione al database dei neutroni.

GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'password';

Sostituisci "password ” con una password adeguata. Esci da MySQL.

Carica le tue credenziali di amministratore dallo script dell'ambiente.

# source admin-openrc.sh

Crea l'utente neutrone per la creazione delle credenziali di servizio.

# openstack user create --password-prompt neutron
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | default                          |
| enabled   | True                             |
| id        | 91c75b24ce324309891f6a4ea8b33887 |
| name      | neutron                          |
+-----------+----------------------------------+

Aggiungi il ruolo di amministratore all'utente neutron.

# openstack role add --project service --user neutron admin

Crea l'entità del servizio di neutroni.

# openstack service create --name neutron --description "OpenStack Neutron" network
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Neutron                |
| enabled     | True                             |
| id          | 1834077666c54c93821c95a03fa853a1 |
| name        | neutron                          |
| type        | network                          |
+-------------+----------------------------------+

Crea l'endpoint dell'API del servizio neutroni.

# 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           |
+--------------+----------------------------------+

Installa e configura i componenti di rete sul nodo del controller:

# apt-get install neutron-server neutron-plugin-ml2  neutron-plugin-linuxbridge-agent neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent python-neutronclient conntrack

Modifica /etc/neutron/neutron.conf.

# nano /etc/neutron/neutron.conf

Modifica le impostazioni seguenti e assicurati di inserire una voce nelle sezioni appropriate.

[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.

Configura plug-in Modular Layer 2 (ML2):

Modifica il file /etc/neutron/plugins/ml2/ml2_conf.ini

# nano /etc/neutron/plugins/ml2/ml2_conf.ini

Modifica le seguenti strofe.

[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

Configura l'agente bridge Linux:

Per configurare l'agente bridge Linux, modificare /etc/neutron/plugins/ml2/linuxbridge_agent.ini sul nodo controller.

# nano /etc/neutron/plugins/ml2/linuxbridge_agent.ini

Apporta le modifiche al file come di seguito.

[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

Configura l'agente di livello 3:

Modifica il file /etc/neutron/l3_agent.ini

# nano /etc/neutron/l3_agent.ini

Modifica il file come di seguito.

[DEFAULT]
...
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
external_network_bridge =
verbose = True

Configura l'agente DHCP:

Modifica il file /etc/neutron/dhcp_agent.ini.

# nano /etc/neutron/dhcp_agent.ini

Apporta le modifiche pertinenti al file come di seguito.

[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

Ora crea il file /etc/neutron/dnsmasq-neutron.conf per abilitare l'opzione DHCP MTU (26) e configuralo a 1450 byte:

# nano /etc/neutron/dnsmasq-neutron.conf

Inserisci la riga sottostante.

dhcp-option-force=26,1450

Configura l'agente di metadati:

Modifica il file /etc/neutron/metadata_agent.ini sul nodo controller.

# nano /etc/neutron/metadata_agent.ini

Apporta le modifiche di conseguenza.

[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

Per completare l'installazione, compilare il database.

# 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

Riavvia il servizio Compute API.

# service nova-api restart

Riavvia i servizi di rete.

# 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

Per impostazione predefinita, i pacchetti Ubuntu creano un database SQLite. puoi rimuovere il file di database SQLite.

# rm -f /var/lib/neutron/neutron.sqlite

Verificalo elencando le estensioni caricate.

# 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                    |
+-----------------------+-----------------------------------------------+

È tutto!. È ora di installare e configurare il nodo di calcolo per funzionare con il componente Neutron.


Ubuntu
  1. Installa pgAdmin 4 su Ubuntu 16.04

  2. OpenStack Kilo su Ubuntu 14.04.2 – Configura Nova

  3. OpenStack Kilo su Ubuntu 14.04.2 – Configura Sguardo

  4. OpenStack Kilo su Ubuntu 14.04.2 – Configura KeyStone #2

  5. OpenStack Kilo su Ubuntu 14.04.2 – Configura KeyStone #1

OpenStack Liberty su Ubuntu 14.04 LTS – Configura Nova

OpenStack Kilo su Ubuntu 14.04.2 – Configura Neutron #1

OpenStack Liberty su Ubuntu 14.04 LTS – Configura KeyStone #1

Installa OpenStack Liberty su Ubuntu 14.04 LTS

OpenStack Liberty su Ubuntu 14.04 – Crea reti virtuali

OpenStack Liberty su Ubuntu 14.04 – Configura Neutron #2