OpenStack搭建之neutron计算节点-ovs(8)
文章目录
安装组件
apt install neutron-openvswitch-agent -y
配置公共组件
root@compute1:~# cp /etc/neutron/neutron.conf{,.bak}
root@compute1:~#
root@compute1:~# egrep -v "^$|#" /etc/neutron/neutron.conf.bak > /etc/neutron/neutron.conf
root@compute1:~# cat /etc/neutron/neutron.conf
[DEFAULT]
# ...
transport_url = rabbit://openstack:admin1234@controller
core_plugin = ml2
[agent]
root_helper = "sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf"
[cache]
[cors]
[database]
#connection = sqlite:var/lib/neutron/neutron.sqlite
[healthcheck]
[ironic]
[keystone_authtoken]
[nova]
[oslo_concurrency]
# ...
lock_path = /var/lib/neutron/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[placement]
[privsep]
[profiler]
[quotas]
[ssl]
网络选项2: Self-service networks
配置Open vSwitch代理
root@compute1:~# cp /etc/neutron/plugins/ml2/openvswitch_agent.ini{,.bak}
root@compute1:~# egrep -v "^$|#" /etc/neutron/plugins/ml2/openvswitch_agent.ini.bak > /etc/neutron/plugins/ml2/openvswitch_agent.ini
root@compute1:~# cat /etc/neutron/plugins/ml2/openvswitch_agent.ini
[DEFAULT]
[agent]
tunnel_types = vxlan
l2_population = true
[dhcp]
[network_log]
[ovs]
bridge_mappings = provider:br-ens32
local_ip = 192.168.91.20
[securitygroup]
# ...
enable_security_group = true
firewall_driver = openvswitch
#firewall_driver = iptables_hybrid
配置网桥:
root@controller:~# ovs-vsctl add-br br-ens32
root@controller:~# ovs-vsctl add-port br-ens32 ens32
配置内核转发:
cat >> /etc/sysctl.conf << EOF
# 用于控制系统是否开启对数据包源地址的校验,关闭
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
# 开启二层转发设备
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
EOF
加载模块:
modprobe br_netfilter
让内核配置生效:
sysctl -p
配置Compute服务以使用Networking服务
编辑/etc/nova/nova.conf
文件,完成如下操作:
auth_url = http://controller:5000
auth_type = password
project_domain_name = Default
user_domain_name = Default
region_name = RegionOne
project_name = service
username = neutron
password = admin1234
完成安装
重启服务:
service nova-compute restart
service neutron-openvswitch-agent restart
验证安装(控制节点)
root@controller:~# . admin-openrc.sh
root@controller:~# openstack network agent list
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| ID | Agent Type | Host | Availability Zone | Alive | State | Binary |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| 17c55542-119c-4b79-bd40-a4bbcfb45257 | Open vSwitch agent | compute2 | None | :-) | UP | neutron-openvswitch-agent |
| 417ef414-704e-4b9d-9078-a842ab8d60ed | Open vSwitch agent | compute1 | None | :-) | UP | neutron-openvswitch-agent |
| 47079d4a-58da-48dc-884a-218751babd27 | L3 agent | controller | nova | :-) | UP | neutron-l3-agent |
| 52513ae2-5591-49e7-b098-30db84591bac | Metadata agent | controller | None | :-) | UP | neutron-metadata-agent |
| 5cd1a1a5-f854-4be3-b7ed-a7f785c3774b | Open vSwitch agent | controller | None | :-) | UP | neutron-openvswitch-agent |
| 87be64fd-0a01-403a-b499-0a0e1635c352 | DHCP agent | controller | nova | :-) | UP | neutron-dhcp-agent |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+