Cài đặt và cấu hình Liberty OpenStack – Phần 3
Cài đặt và cấu hình Liberty OpenStack – Phần 3
Cài đặt Neutron trên Controller Node
- Tạo database cho Neutron
mysql -u root -pOpenstack12345
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.*TO 'neutron'@'localhost'IDENTIFIED BY Openstack12345';
GRANT ALL PRIVILEGES ON neutron.*TO 'neutron'@'%'IDENTIFIED BY Openstack12345';
exit;
- Tạo user, gán role, endpoint cho neutron
openstack user create --domain default --password Openstack12345 neutron
openstack role add --project service --user neutron admin
openstack service create --name neutron --description "OpenStack Networking"network
openstack endpoint create --region RegionOne network public http://10.10.10.120:9696
openstack endpoint create --region RegionOne network internal http://10.10.10.120:9696
openstack endpoint create --region RegionOne network admin http://10.10.10.120:9696
- Cài đặt các thành phần cho NEUTRON trên Controller Node
apt-get -y install neutron-server neutron-plugin-ml2 \
neutron-plugin-linuxbridge-agent neutron-l3-agent neutron-dhcp-agent \
neutron-metadata-agent python-neutronclient
- Sao lưu file cấu hình
cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
- Xóa file /etc/neutron/neutron.conf
rm /etc/neutron/neutron.conf
- Tạo file neutron.conf với lệnh vi /etc/neutron/neutron.conf chứa nội dung sau
[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://10.10.10.120:8774/v2
verbose = True
[matchmaker_redis]
[matchmaker_ring]
[quotas]
[agent]
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
[keystone_authtoken]
auth_uri = http://10.10.10.120:5000
auth_url = http://10.10.10.120:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = Openstack12345
[database]
connection = mysql+pymysql://neutron:Openstack12345@10.10.10.120/neutron
[nova]
auth_url = http://10.10.10.120:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = nova
password = Openstack12345
[oslo_concurrency]
lock_path = $state_path/lock
[oslo_policy]
[oslo_messaging_amqp]
[oslo_messaging_qpid]
[oslo_messaging_rabbit]
rabbit_host = 10.10.10.120
rabbit_userid = openstack
rabbit_password = Openstack12345
[qos]
- Cấu hình cho (ML2) plug-in
cp /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini.bak
- Sửa file /etc/neutron/plugins/ml2/ml2_conf.ini với nội dung sau
[ml2]
tenant_network_types = vxlan
type_drivers = flat,vlan,vxlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security
[ml2_type_flat]
flat_networks = public
[ml2_type_vlan]
[ml2_type_gre]
[ml2_type_vxlan]
vni_ranges = 1:1000
[ml2_type_geneve]
[securitygroup]
enable_ipset = True
Configure the Linux bridge agent
- Sao lưu cấu hình cho file linuxbridge_agent.ini
cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak
- Sửa file linuxbridge_agent.ini bằng lệnh `/etc/neutron/plugins/ml2/linuxbridge_agent.ini`với nội dung dưới
```sh
[linux_bridge]
physical_interface_mappings = public:eth1
[vxlan]
enable_vxlan = True
local_ip = 10.10.10.120
l2_population = True
[agent]
prevent_arp_spoofing = True
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
Cấu hình cho layer-3 agent
- Sao lưu file cấu hình
cp /etc/neutron/l3_agent.ini /etc/neutron/l3_agent.ini.bak
Xóa file /etc/neutron/l3_agent.ini
rm /etc/neutron/l3_agent.ini
-Sửa file /etc/neutron/l3_agent.ini bằng lệnh vi /etc/neutron/l3_agent.ini với nội dung dưới
[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
external_network_bridge =
verbose = True
[AGENT]
Cấu hình DHCP agent
- Sao lưu file dhcp_agent.ini
cp /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.bak
- Sửa file dhcp_agent.ini bằng lệnh vi /etc/neutron/dhcp_agent.ini với nội dung dưới
[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
[AGENT]
- Tạo file vi /etc/neutron/dnsmasq-neutron.conf với nội dung sau:
echo"dhcp-option-force=26,1450">/etc/neutron/dnsmasq-neutron.conf
- Cấu hình metadata agent
- Sao lưu file cp /etc/neutron/metadata_agent.ini
cp /etc/neutron/metadata_agent.ini /etc/neutron/metadata_agent.ini.bak
-Sửa file sau với lệnh vi /etc/neutron/metadata_agent.ini chứa nội dung dưới
DEFAULT]
auth_uri = http://10.10.10.120:5000
auth_url = http://10.10.10.120:35357
auth_region = RegionOne
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = Openstack12345
nova_metadata_ip = 10.10.10.120
metadata_proxy_shared_secret = Openstack12345
verbose = True
- Thêm vào file /etc/nova/nova.conf trên node Controller đoạn dưới cùng dưới
[neutron]
url = http://10.10.10.120:9696
auth_url = http://10.10.10.120:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = Openstack12345
service_metadata_proxy = True
metadata_proxy_shared_secret = Openstack12345
- Đồng bộ database cho NVOA
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
- Khởi động lại nova-api
service nova-api restart
- Khởi động lại các dịch vụ của NEUTRON trên CONTROLLER NODE
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
- Xóa file SQLite mặc định của OpenStack
rm -f /var/lib/neutron/neutron.sqlite
Cài đặt thành phần của neutron trên COMPUTE NODE
- Cài đặt linuxbridge-agent trên node Compute
apt-get -y install neutron-plugin-linuxbridge-agent
- Sao lưu file /etc/neutron/neutron.conf
cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
- Sửa file với lệnh vi /etc/neutron/neutron.conf chứa nội dung sau.
[DEFAULT]
core_plugin = ml2
rpc_backend = rabbit
auth_strategy = keystone
verbose = True
[matchmaker_redis]
[matchmaker_ring]
[quotas]
[agent]
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
[keystone_authtoken]
auth_uri = http://10.10.10.120:5000
auth_url = http://10.10.10.120:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = Openstack12345
[database]
# connection = sqlite:////var/lib/neutron/neutron.sqlite
[nova]
[oslo_concurrency]
lock_path = $state_path/lock
[oslo_policy]
[oslo_messaging_amqp]
[oslo_messaging_qpid]
[oslo_messaging_rabbit]
rabbit_host = 10.10.10.120
rabbit_userid = openstack
rabbit_password = Openstack12345
[qos]
Configure the Linux bridge agent
- Sao lưu file /etc/neutron/plugins/ml2/linuxbridge_agent.ini
cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak
- Sửa file bằng lệnh vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini với nội dung sau:
[linux_bridge]
physical_interface_mappings = public:eth1
[vxlan]
enable_vxlan = True
local_ip = 10.10.10.121
l2_population = True
[agent]
prevent_arp_spoofing = True
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
- Thêm vào dưới cùng file /etc/nova/nova.conf trên Compute node với nội dung dưới
[neutron]
url = http://10.10.10.120:9696
auth_url = http://10.10.10.120:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = Openstack12345
- Khởi động lại nova-compute
service nova-compute restart
- Khởi động lại Linux bridge agent
service neutron-plugin-linuxbridge-agent restart
Cai dat dashboad tren CONTROLLER
apt-get -y install openstack-dashboard
- Quá trình cài đặt thành công, hãy đăng nhập vào controller với IP: 192.168.1.120/horizon