当neutron启用L3 agent时,如果在配置文件中配置了external_network_bridge,从这个bridge上出去的包只能是untag的。但在DC中,极有可能被分配的是某一vlan。这种情况下,在配置文件中就要如下设置:
/etc/neutron/l3_agent.ini # Name of bridge used for external network traffic. This should be set to # empty value for the linux bridge external_network_bridge = ""
设定external网络可以参照以下命令:
neutron net-create --shared vlan840 --provider:network_type vlan --provider:physical_network physnet1 --provider:segmentation_id 840 --router:external=True
其他设置可以参考以下blog:
设定完成后拓补如下:
、
我们可以在vlan840上直接起虚机,也可以在vlan850(内部网络上)启动虚机。
在网络节点上看到:
# ovs-vsctl show 418f4819-8ad6-4fe5-a959-3605eee4852b Bridge "br-eth1" Port "phy-br-eth1" Interface "phy-br-eth1" Port "br-eth1" Interface "br-eth1" type: internal Port "eth1" Interface "eth1" Bridge br-int Port "tapa570fb69-fb" tag: 5 Interface "tapa570fb69-fb" type: internal Port "qr-f01fed18-ad" tag: 5 Interface "qr-f01fed18-ad" type: internal Port br-int Interface br-int type: internal Port "tapa7b25e2f-ad" tag: 1 Interface "tapa7b25e2f-ad" type: internal Port "qg-d2f9cb0b-11" tag: 3 Interface "qg-d2f9cb0b-11" type: internal Port "tapa85a86f8-c1" tag: 3 Interface "tapa85a86f8-c1" type: internal Port "int-br-eth1" Interface "int-br-eth1" ovs_version: "1.11.0"
qr-XXX和qg-YYY都在br-eth1上,qg-YYY和qr-XXX之间是L3 agent通过iptables的nat转换来实现的。