注意此處用的一個網絡,暫時不用啓動第二個網
官網地址 https://docs.openstack.org/neutron/stein/install/controller-install-rdo.html 控制端服務 #: 建立庫,並受權 MariaDB [(none)]> CREATE DATABASE neutron; Query OK, 1 row affected (0.001 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \ -> IDENTIFIED BY 'neutron123'; #:導入環境變量 [root@cobbler ~]# source scripts/admin-stein.sh #:建立neutron用戶 [root@cobbler ~]# openstack user create --domain default --password-prompt neutron #:爲admin項目添加一個用戶neutron,並添加至service角色 [root@cobbler ~]# openstack role add --project service --user neutron admin #:建立一個network的項目 [root@cobbler ~]# openstack service create --name neutron --description "OpenStack Networking" network #:註冊api [root@cobbler ~]# openstack endpoint create --region RegionOne network public http://www.magedu.net:9696 [root@cobbler ~]# openstack endpoint create --region RegionOne network internal http://www.magedu.net:9696 [root@cobbler ~]# openstack endpoint create --region RegionOne network admin http://www.magedu.net:9696
官網地址 https://docs.openstack.org/neutron/stein/install/controller-install-option1-rdo.html 配置網絡 #:安裝包 [ root@cobbler ~]# yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y #:配置 [root@cobbler ~]# vim /etc/neutron/neutron.conf [database] # connection = mysql+pymysql://neutron:neutron123@www.magedu.net/neutron [DEFAULT] # core_plugin = ml2 service_plugins = transport_url = rabbit://openstack:openstack123@www.magedu.net auth_strategy = keystone keystone_authtoken] # www_authenticate_uri = http://www.magedu.net:5000 auth_url = http://www.magedu.net:5000 memcached_servers = www.magedu.net:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = neutron [DEFAULT] notify_nova_on_port_status_changes = true notify_nova_on_port_data_changes = true [nova] auth_url = http://www.magedu.net:5000 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = nova password = nova [oslo_concurrency] # lock_path = /var/lib/neutron/tmp [root@cobbler ~]# vim /etc/neutron/plugins/ml2/ml2_conf.ini [ml2] type_drivers = flat,vlan tenant_network_types = mechanism_drivers = linuxbridge extension_drivers = port_security [ml2_type_flat] flat_networks = external #給外網取一個名字 [securitygroup] enable_ipset = true [root@cobbler ~]# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini [linux_bridge] physical_interface_mappings = external:eth0 #對應外網名字,eth0表示你IP的網卡,根據須要本身設置 [vxlan] enable_vxlan = false [securitygroup] enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver #:配置sysctl [root@cobbler ~]# vim /etc/sysctl.conf net.bridge.bridge-nf-call-iptables = 1 net.bridge.bridge-nf-call-ip6tables = 1 #:配置dhcp [root@cobbler ~]# vim /etc/neutron/dhcp_agent.ini [DEFAULT] # interface_driver = linuxbridge dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true
官網地址 https://docs.openstack.org/neutron/stein/install/controller-install-rdo.html #:繼續配置 [root@cobbler ~]# vim /etc/neutron/metadata_agent.ini [DEFAULT] # nova_metadata_host = www.magedu.net #:改爲本身的vip名稱 metadata_proxy_shared_secret = 0831 #:設置一個密碼 [root@cobbler ~]# vim /etc/nova/nova.conf [neutron] # url = http://www.magedu.net:9696 auth_url = http://www.magedu.net:5000 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = neutron password = neutron service_metadata_proxy = true metadata_proxy_shared_secret = 0831 #:此處和設置的密碼必須同樣 #:作軟連接 [root@cobbler ~]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini #:初始化數據庫 [root@cobbler ~]# 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 #:啓動服務 [root@cobbler ~]# systemctl restart openstack-nova-api.service [root@cobbler ~]# systemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service [root@cobbler ~]# systemctl start neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
#: 生效sysctl
[root@cobbler ~]# sysctl -p
官網地址 https://docs.openstack.org/neutron/stein/install/compute-install-rdo.html 計算節點配置 #:安裝包 [root@node1 ~]# yum install openstack-neutron-linuxbridge ebtables ipset -y #:配置 [root@node1 ~]# vim /etc/neutron/neutron.conf [DEFAULT] # transport_url = rabbit://openstack:openstack123@www.magedu.net auth_strategy = keystone [keystone_authtoken] # www_authenticate_uri = http://www.magedu.net:5000 auth_url = http://www.magedu.net:5000 memcached_servers = www.magedu.net:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = neutron [oslo_concurrency] # lock_path = /var/lib/neutron/tmp
官網地址 https://docs.openstack.org/neutron/stein/install/compute-install-option1-rdo.html 配置網絡 #:配置 [root@node1 ~]# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini [linux_bridge] physical_interface_mappings = external:eth0 #:注意此處也是本身IP的網絡和名字 [vxlan] enable_vxlan = false [securitygroup] enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver #:修改sysctl [root@node1 ~]# vim /etc/sysctl.conf net.bridge.bridge-nf-call-iptables = 1 net.bridge.bridge-nf-call-ip6tables = 1
官網地址 https://docs.openstack.org/neutron/stein/install/compute-install-rdo.html 繼續配置 #:配置 [root@node1 ~]# vim /etc/nova/nova.conf [neutron] # url = http://www.magedu.net:9696 auth_url = http://www.magedu.net:5000 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = neutron password = neutron #:啓動服務 [root@node1 ~]# systemctl restart openstack-nova-compute.service [root@node1 ~]# systemctl enable neutron-linuxbridge-agent.service [root@node1 ~]# systemctl start neutron-linuxbridge-agent.service
官網地址 https://docs.openstack.org/neutron/stein/install/verify.html 測試 #:導入變量 [root@cobbler ~]# source scripts/admin-stein.sh #:測試 [root@cobbler ~]# openstack extension list --network 官網地址 https://docs.openstack.org/neutron/stein/install/verify-option1.html 測試網絡 [root@cobbler ~]# openstack network agent list