规划网络

部署节点为一个controller节点,一个compute节点。controller节点有3个网卡,分别为eth0(管理和API网络,192.168.10.0/24)、eth1(租户网络,10.10.10.0/24)、eth2(外部网络,192.168.100.0/24,不设置IP);compute节点有2个网卡,分别为eth0(管理和API网络,192.168.10.0/24)、eth1(租户网络,10.10.10.0/24)。

创建虚拟网络

修改配置文件

controller节点

/etc/neutron/plugins/ml2/ml2conf.ini

[ml2]
type_drivers = flat,vxlan
tenant_network_types = vxlan
mechanism_drivers = openvswitch,l2population
extension_drivers = port_security

[ml2_type_vxlan]
vni_ranges = 1001:2000

[securitygroup]
enable_ipset = true

/etc/neutron/l3agent.ini

[DEFAULT]
external_network_bridge = br-ex
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
/etc/neutron/dhcp_agent.ini

[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True

/etc/neutron/plugins/ml2/openvswitchagent.ini

[agent]
tunnel_types = vxlan
l2_population = True

[ovs]
bridge_mappings = 
tunnel_bridge = br-tun
local_ip = 10.10.10.10

[securitygroup]
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
enable_security_group = true

compute节点

/etc/neutron/plugins/ml2/openvswitchagent.ini

[agent]
tunnel_types = vxlan
l2_population = True

[ovs]
bridge_mappings = 
tunnel_bridge = br-tun
local_ip = 10.10.10.11

[securitygroup]
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
enable_security_group = true

提前准备ovs网桥

root@controller:~# ovs-vsctl add-br br-ex
root@controller:~# ovs-vsctl add-port br-ex eth2

配置文件修改后,需要重启网络相关服务。

controller节点启动了 neturon-metadata-agent、neutron-l3-agent、neutron-openvswitch-agent、neutron-dhcp-agent
compute节点启动了 neutron-openvswitch-agent