2022-10-28
#12 [학습서] OpenStack 설치 학습서 - 7.Neutron (1/2)
2022-10-28
Tasks

OpenStack 설치 학습서#


7. Neutron#

OpenStack Networking service는 인터페이스 장치를 생성하고 네트워크에 연결을 위한 서비스이며, 해당 서비스는 Neutron이라 합니다. 또한, Neutron이 제공하는 Plug-in은 다양한 네트워킹 장비와 소프트웨어를 수용합니다.

Neutron은 Keystone, Glance, Placement, Nova 설치 이후에 설치하는 서비스입니다. Controller node에는 neutron-server 등을 설치하고, Compute node는 plug-in 및 agents 등을 설치합니다.


본 학습서에서는 공식문서의 Networking Option 2: Self-service networks를 적용합니다.
따라서, 이 예제에서 설치된 Neutron은 Layer-3(라우팅) 서비스기반으로 가상 네트워크를 제공합니다.

  • Controller node

    • 사전설정

      CONTROLLER_IP=192.168.0.150
      OPENSTACK_PASSWORD=passwds
      
    • 데이터베이스에 서비스 생성

      mysql -e "CREATE DATABASE neutron;"
      mysql -e "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY '${OPENSTACK_PASSWORD}';"
      mysql -e "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY '${OPENSTACK_PASSWORD}';"
      mysql -e "FLUSH PRIVILEGES;"
      
    • admin 커맨드 액세스

      . admin-openrc
      
    • 서비스 자격 증명 및 생성

      openstack user create --domain default --password ${OPENSTACK_PASSWORD} neutron
      openstack role add --project service --user neutron admin
      openstack service create --name neutron --description "OpenStack Networking" network
      
      • 7-1.png
    • API 엔드포인트를 생성

      openstack endpoint create --region RegionOne network public http://${CONTROLLER_IP}:9696
      openstack endpoint create --region RegionOne network internal http://${CONTROLLER_IP}:9696
      openstack endpoint create --region RegionOne network admin http://${CONTROLLER_IP}:9696
      
      • 7-2.png
    • 패키지 설치 및 설정

      apt install -y neutron-server neutron-plugin-ml2 neutron-linuxbridge-agent neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent
      
      # neutron.conf 파일 수정
      crudini --set /etc/neutron/neutron.conf database connection mysql+pymysql://neutron:${OPENSTACK_PASSWORD}@${CONTROLLER_IP}/neutron
      crudini --set /etc/neutron/neutron.conf DEFAULT core_plugin ml2
      crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins router
      crudini --set /etc/neutron/neutron.conf DEFAULT allow_overlapping_ips true
      crudini --set /etc/neutron/neutron.conf DEFAULT transport_url rabbit://openstack:${OPENSTACK_PASSWORD}@${CONTROLLER_IP}
      crudini --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone
      crudini --set /etc/neutron/neutron.conf DEFAULT notify_nova_on_port_status_changes true
      crudini --set /etc/neutron/neutron.conf DEFAULT notify_nova_on_port_data_changes true
      crudini --set /etc/neutron/neutron.conf keystone_authtoken www_authenticate_uri http://${CONTROLLER_IP}:5000
      crudini --set /etc/neutron/neutron.conf keystone_authtoken auth_url http://${CONTROLLER_IP}:5000
      crudini --set /etc/neutron/neutron.conf keystone_authtoken memcached_servers ${CONTROLLER_IP}:11211
      crudini --set /etc/neutron/neutron.conf keystone_authtoken auth_type password
      crudini --set /etc/neutron/neutron.conf keystone_authtoken project_domain_name default
      crudini --set /etc/neutron/neutron.conf keystone_authtoken user_domain_name default
      crudini --set /etc/neutron/neutron.conf keystone_authtoken project_name service
      crudini --set /etc/neutron/neutron.conf keystone_authtoken username neutron
      crudini --set /etc/neutron/neutron.conf keystone_authtoken password ${OPENSTACK_PASSWORD}
      crudini --set /etc/neutron/neutron.conf nova auth_url http://${CONTROLLER_IP}:5000
      crudini --set /etc/neutron/neutron.conf nova auth_type password
      crudini --set /etc/neutron/neutron.conf nova project_domain_name default
      crudini --set /etc/neutron/neutron.conf nova user_domain_name default
      crudini --set /etc/neutron/neutron.conf nova region_name RegionOne
      crudini --set /etc/neutron/neutron.conf nova project_name service
      crudini --set /etc/neutron/neutron.conf nova username nova
      crudini --set /etc/neutron/neutron.conf nova password ${OPENSTACK_PASSWORD}
      crudini --set /etc/neutron/neutron.conf oslo_concurrency lock_path /var/lib/neutron/tmp
      
      # plugin 파일 수정
      crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers flat,vlan,vxlan
      crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan
      crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers linuxbridge,l2population
      crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security
      crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_flat flat_networks provider
      crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_vxlan vni_ranges 1:1000
      crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup enable_ipset true
      crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini linux_bridge physical_interface_mappings provider:${CONTROLLER_INTERFACE}
      crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan enable_vxlan true
      crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan local_ip ${CONTROLLER_IP}
      crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan l2_population true
      crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup enable_security_group true
      crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
      sysctl net.bridge.bridge-nf-call-iptables
      sysctl net.bridge.bridge-nf-call-ip6tables
      
      # agent 파일 수정
      crudini --set /etc/neutron/l3_agent.ini DEFAULT interface_driver linuxbridge
      crudini --set /etc/neutron/dhcp_agent.ini DEFAULT interface_driver linuxbridge
      crudini --set /etc/neutron/dhcp_agent.ini DEFAULT dhcp_driver neutron.agent.linux.dhcp.Dnsmasq
      crudini --set /etc/neutron/dhcp_agent.ini DEFAULT enable_isolated_metadata true
      crudini --set /etc/neutron/metadata_agent.ini DEFAULT nova_metadata_host ${CONTROLLER_IP}
      crudini --set /etc/neutron/metadata_agent.ini DEFAULT metadata_proxy_shared_secret ${OPENSTACK_PASSWORD}
      
      # nova.conf 파일 수정
      crudini --set /etc/nova/nova.conf neutron auth_url http://${CONTROLLER_IP}:5000
      crudini --set /etc/nova/nova.conf neutron auth_type password
      crudini --set /etc/nova/nova.conf neutron project_domain_name default
      crudini --set /etc/nova/nova.conf neutron user_domain_name default
      crudini --set /etc/nova/nova.conf neutron region_name RegionOne
      crudini --set /etc/nova/nova.conf neutron project_name service
      crudini --set /etc/nova/nova.conf neutron username neutron
      crudini --set /etc/nova/nova.conf neutron password ${OPENSTACK_PASSWORD}
      crudini --set /etc/nova/nova.conf neutron service_metadata_proxy true
      crudini --set /etc/nova/nova.conf neutron metadata_proxy_shared_secret ${OPENSTACK_PASSWORD}
      
    • 데이터베이스 설정

      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
      
      • 7-3.png
    • 서비스 재시작

      service nova-api restart
      service neutron-server restart
      service neutron-linuxbridge-agent restart
      service neutron-dhcp-agent restart
      service neutron-metadata-agent restart
      service neutron-l3-agent restart
      
      • 7-4.png
Comment 0

Add a comment