openstack高可用集群4-VXLAN的原理和實踐


 
1.VXLAN的原理
 
VXLAN 包轉發流程
VXLAN 在 VTEP 間建立隧道,通過 Layer 3 網絡傳輸封裝后的 Layer 2 數據。
下面的例子演示了數據如何在 VXLAN 上傳輸:
 
圖中 Host-A 和 Host-B 位於 VNI 10 的 VXLAN,通過 VTEP-1 和 VTEP-2 之間建立的 VXLAN 隧道通信。
數據傳輸過程如下:
1. Host-A 向 Host-B 發送數據時,Host-B 的 MAC 和 IP 作為數據包的目標 MAC 和 IP,Host-A 的 MAC 作為數據包的源 MAC 和 IP,然后通過 VTEP-1 將數據發送出去。
2. VTEP-1 從自己維護的映射表中找到 MAC-B 對應的 VTEP-2,然后執行 VXLAN 封裝,加上 VXLAN 頭,UDP 頭,以及外層 IP 和 MAC 頭。此時的外層 IP 頭,目標地址為 VTEP-2 的 IP,源地址為 VTEP-1 的 IP。同時由於下一跳是 Router-1,所以外層 MAC 頭中目標地址為 Router-1 的 MAC。
3. 數據包從 VTEP-1 發送出去后,外部網絡的路由器會依據外層 IP 頭進行包路由,最后到達與 VTEP-2 連接的路由器 Router-2。
4. Router-2 將數據包發送給 VTEP-2。VTEP-2 負責解封數據包,依次去掉外層 MAC 頭,外層 IP 頭,UDP 頭 和 VXLAN 頭。
5. VTEP-2 依據目標 MAC 地址將數據包發送給 Host-B。
上面的流程我們看到 VTEP 是 VXLAN 的最核心組件,負責數據的封裝和解封。 隧道也是建立在 VTEP 之間的,VTEP 負責數據的傳送。
Linux 對 VXLAN 的支持
VTEP 可以由專有硬件來實現,也可以使用純軟件實現。 目前比較成熟的 VTEP 軟件實現包括:
1. 帶 VXLAN 內核模塊的 Linux
2. Open vSwitch
我們先來看 Linux 如何支持 VXLAN,Open vSwitch 方式將在后面章節討論。
實現方式:
1. Linux vxlan 創建一個 UDP Socket,默認在 8472 端口監聽。
2. Linux vxlan 在 UDP socket 上接收到 vxlan 包后,解包,然后根據其中的 vxlan ID 將它轉給某個 vxlan interface,然后再通過它所連接的 linux bridge 轉給虛機。
3. Linux vxlan 在收到虛機發來的數據包后,將其封裝為多播 UDP 包,從網卡發出。
到這里,相信大家對 VXLAN 的原理已經有了大致的了解。 下節我們將學習如何在 Neutron 中配置和實施 VXLAN。
 
 
2.VXLAN在ML2中的啟用
在 /etc/neutron/plugins/ml2/ml2_conf.ini 設置 vxlan network 相關參數。
[ml2]
type_drivers = flat,vlan,gre,vxlan,geneve
tenant_network_types = vxlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security
tenant_network_types = vxlan
指定普通用戶創建的網絡類型為 vxlan。 這里還使用了一個名為 “l2population” mechanism driver,我們放到后面單獨介紹。
然后指定 vxlan 的范圍。
[ml2_type_vxlan]
vni_ranges = 1001:2000
上面的配置定義了 vxlan vni 的范圍是 1001 - 2000。 這個范圍是針對普通用戶在自己的租戶里創建 vxlan network 的范圍。 因為普通用戶創建 network 時並不能指定 vni,Neutron 會按順序自動從這個范圍中取值。
對於 admin 則沒有 vni 范圍的限制,admin 可以創建 vni 范圍為 1-16777216 的 vxlan network。
接着需要在 [VXLAN] 中配置 VTEP。
控制節點 devstack_controller 的 ml2_conf.ini 配置如下:
[vxlan]
enable_vxlan = True
l2_population = True
local_ip = 166.66.16.10
計算節點 devstack_compute01 的 ml2_conf.ini 配置如下:
[vxlan]
enable_vxlan = True
l2_population = True
local_ip = 166.66.16.11
local_ip 指定節點上用作 VTEP 的 IP 地址。 devstack_controller 的 VTEP IP 是 166.66.16.10,網卡為 eth1。 devstack_compute01 的 VTEP IP 是 166.66.16.11,網卡為 eth1。
注意:作為准備工作,這兩個 VTEP IP 需要提前配置到節點的 eht1.102 上,Neutron 並不會幫我們分配這個 IP。
 
[root@openstack1 ~]# grep -v '^#\|^$' /etc/neutron/plugins/ml2/ml2_conf.ini
[DEFAULT]
[l2pop]
[ml2]
type_drivers = flat,vlan,gre,vxlan,geneve
tenant_network_types = vxlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security
[ml2_type_flat]
flat_networks = external
[ml2_type_geneve]
[ml2_type_gre]
[ml2_type_vlan]
network_vlan_ranges = default:50:4000
[ml2_type_vxlan]
vni_ranges = 1001:2000
[securitygroup]
enable_ipset = true
 
[root@openstack1 ~]# grep -v '^#\|^$' /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[DEFAULT]
[agent]
[linux_bridge]
physical_interface_mappings = default:eth1.102,external:eth2
[securitygroup]
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
enable_security_group = true
[vxlan]
enable_vxlan = True
l2_population = True
local_ip = 166.66.16.10
 
[root@openstack1 ~]# ip addr show eth1.102
12: eth1.102@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:71:15:f0 brd ff:ff:ff:ff:ff:ff
    inet 166.66.16.10/24 scope global eth1.102
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe71:15f0/64 scope link
       valid_lft forever preferred_lft forever
 
 
 
[root@openstack2 ~]# grep -v '^#\|^$' /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[DEFAULT]
[agent]
[linux_bridge]
physical_interface_mappings = default:eth1.102,external:eth2
[securitygroup]
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
enable_security_group = true
[vxlan]
enable_vxlan = True
l2_population = True
local_ip = 166.66.16.11
 
 
[root@openstack2 ~]# ip addr show eth1.102
16: eth1.102@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:ec:fa:40 brd ff:ff:ff:ff:ff:ff
    inet 166.66.16.11/24 scope global eth1.102
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:feec:fa40/64 scope link
       valid_lft forever preferred_lft forever
 
 
3.創建VXLAN
 
通過 Web UI 創建 vxlan100_net 並觀察節點網絡結構的變化。
打開菜單 Admin -> Networks,點擊 “Create Network” 按鈕
顯示創建頁面。
Provider Network Type 選擇 “VXLAN” Segmentation ID 即 VNI,設置為 100
點擊 “Create Network”,vxlan100 創建成功。
點擊 vxlan100 鏈接,進入 network 配置頁面,目前還沒有 subnet,點擊 “Create Subnet” 按鈕。
創建 subnet_172_16_100_0,IP 地址為 172.16.100.0/24。
 
底層網絡發生了什么變化
在控制節點上執行 brctl show,查看當前的網絡結構。
[root@openstack1 ~]# brctl show
bridge name    bridge id        STP enabled    interfaces
brq792e882c-bc        8000.567b0d903e15    no  tap24ba5a90-39 
                                                vxlan-100      
                                                     
[root@openstack1 ~]# ip netns exec qdhcp-792e882c-bc78-42de-aa6a-ba35388c938e ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ns-24ba5a90-39@if23: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default qlen 1000
    link/ether fa:16:3e:58:c1:aa brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.16.100.2/24 brd 172.16.100.255 scope global ns-24ba5a90-39
       valid_lft forever preferred_lft forever
    inet 169.254.169.254/16 brd 169.254.255.255 scope global ns-24ba5a90-39
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:fe58:c1aa/64 scope link
       valid_lft forever preferred_lft forever
 
 
 
Neutron 創建了: 
1. vxlan100 對應的網橋brq792e882c-bc
2. vxlan interface vxlan-100 
3. dhcp 的 tap 設備 tap24ba5a90-39
 
vxlan-100 和 tap24ba5a90-39 已經連接到brq792e882c-bc,vxlan100 的二層網絡就緒。
執行 ip -d link show dev vxlan-100 查看 vxlan interface 的詳細配置。
可見,vxlan-100 的 VNI 是 100,對應的 VTEP 網絡接口為 eth1.102。
此時 vxlan100 結構如圖所示:
 
 
4. 部署 instance 並分析網絡的連通性
 
launch 新的 instance “cirros-vm1”,網絡選擇 vxlan100。
cirros-vm1 分配到的 IP 為 172.16.100.3。
日志查看
 
# tail -n 20 /var/log/nova/nova-compute.log
2019-03-18 13:31:47.799 7876 INFO nova.compute.claims [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] Attempting claim on node openstack1: memory 64 MB, disk 1 GB, vcpus 1 CPU
2019-03-18 13:31:47.800 7876 INFO nova.compute.claims [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] Total memory: 16383 MB, used: 512.00 MB
2019-03-18 13:31:47.800 7876 INFO nova.compute.claims [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] memory limit not specified, defaulting to unlimited
2019-03-18 13:31:47.801 7876 INFO nova.compute.claims [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] Total disk: 539 GB, used: 0.00 GB
2019-03-18 13:31:47.801 7876 INFO nova.compute.claims [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] disk limit not specified, defaulting to unlimited
2019-03-18 13:31:47.802 7876 INFO nova.compute.claims [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] Total vcpu: 8 VCPU, used: 0.00 VCPU
2019-03-18 13:31:47.802 7876 INFO nova.compute.claims [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] vcpu limit not specified, defaulting to unlimited
2019-03-18 13:31:47.803 7876 INFO nova.compute.claims [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] Claim successful on node openstack1
2019-03-18 13:31:48.396 7876 INFO nova.virt.libvirt.driver [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] Creating image
2019-03-18 13:31:53.010 7876 INFO oslo.privsep.daemon [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] Running privsep helper: ['sudo', 'nova-rootwrap', '/etc/nova/rootwrap.conf', 'privsep-helper', '--config-file', '/usr/share/nova/nova-dist.conf', '--config-file', '/etc/nova/nova.conf', '--privsep_context', 'vif_plug_linux_bridge.privsep.vif_plug', '--privsep_sock_path', '/tmp/tmp0WG70W/privsep.sock']
2019-03-18 13:31:54.516 7876 INFO oslo.privsep.daemon [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] Spawned new privsep daemon via rootwrap
2019-03-18 13:31:54.401 9050 INFO oslo.privsep.daemon [-] privsep daemon starting
2019-03-18 13:31:54.409 9050 INFO oslo.privsep.daemon [-] privsep process running with uid/gid: 0/0
2019-03-18 13:31:54.413 9050 INFO oslo.privsep.daemon [-] privsep process running with capabilities (eff/prm/inh): CAP_NET_ADMIN/CAP_NET_ADMIN/none
2019-03-18 13:31:54.414 9050 INFO oslo.privsep.daemon [-] privsep daemon running as pid 9050
2019-03-18 13:31:54.637 7876 INFO os_vif [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] Successfully plugged vif VIFBridge(active=False,address=fa:16:3e:92:f6:00,bridge_name='brq792e882c-bc',has_traffic_filtering=True,id=1eb38508-9c15-4b52-bf23-f21aa9d608fc,network=Network(792e882c-bc78-42de-aa6a-ba35388c938e),plugin='linux_bridge',port_profile=<?>,preserve_on_delete=False,vif_name='tap1eb38508-9c')
2019-03-18 13:31:55.558 7876 INFO nova.compute.manager [-] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] VM Started (Lifecycle Event)
2019-03-18 13:31:55.633 7876 INFO nova.compute.manager [req-9a0bc14d-f29f-46b6-8c4d-3e06c78cda77 - - - - -] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] VM Paused (Lifecycle Event)
2019-03-18 13:31:55.771 7876 INFO nova.compute.manager [req-9a0bc14d-f29f-46b6-8c4d-3e06c78cda77 - - - - -] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] During sync_power_state the instance has a pending task (spawning). Skip.
2019-03-18 13:31:57.819 7876 INFO nova.compute.manager [req-9a0bc14d-f29f-46b6-8c4d-3e06c78cda77 - - - - -] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] VM Resumed (Lifecycle Event)
2019-03-18 13:31:57.837 7876 INFO nova.virt.libvirt.driver [-] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] Instance spawned successfully.
2019-03-18 13:31:57.838 7876 INFO nova.compute.manager [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] Took 9.44 seconds to spawn the instance on the hypervisor.
2019-03-18 13:31:57.960 7876 INFO nova.compute.manager [req-9a0bc14d-f29f-46b6-8c4d-3e06c78cda77 - - - - -] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] During sync_power_state the instance has a pending task (spawning). Skip.
2019-03-18 13:31:57.983 7876 INFO nova.compute.manager [req-583cdb4e-084d-4318-b8b2-acfb0faef061 71673628ffc640668c08add7502b0f44 6840d3aa8b814d9caa54432ce44471b6 - default default] [instance: 0da28ce5-99b9-4164-9e92-da11eec72bb9] Took 10.21 seconds to build instance.
 
 
[root@openstack2 ~]# tail -n 20 /var/log/neutron/linuxbridge-agent.log
2019-03-18 11:47:24.282 5295 INFO neutron.common.config [-] Logging enabled!
2019-03-18 11:47:24.283 5295 INFO neutron.common.config [-] /usr/bin/neutron-linuxbridge-agent version 11.0.6
2019-03-18 11:47:24.284 5295 INFO neutron.plugins.ml2.drivers.linuxbridge.agent.linuxbridge_neutron_agent [-] Interface mappings: {'default': 'eth1.102', 'external': 'eth2'}
2019-03-18 11:47:24.284 5295 INFO neutron.plugins.ml2.drivers.linuxbridge.agent.linuxbridge_neutron_agent [-] Bridge mappings: {}
2019-03-18 11:47:24.960 5295 INFO oslo_rootwrap.client [-] Spawned new rootwrap daemon process with pid=5313
2019-03-18 11:47:25.050 5295 INFO neutron.plugins.ml2.drivers.linuxbridge.agent.linuxbridge_neutron_agent [-] Agent initialized successfully, now running...
2019-03-18 11:47:25.098 5295 INFO neutron.plugins.ml2.drivers.agent._common_agent [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] RPC agent_id: lb5254007115f0
2019-03-18 11:47:25.108 5295 INFO neutron.agent.agent_extensions_manager [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Loaded agent extensions: []
2019-03-18 11:47:25.326 5295 INFO neutron.plugins.ml2.drivers.agent._common_agent [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Linux bridge agent Agent RPC Daemon Started!
2019-03-18 11:47:25.327 5295 INFO neutron.plugins.ml2.drivers.agent._common_agent [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Linux bridge agent Agent out of sync with plugin!
2019-03-18 11:47:25.338 5295 INFO neutron.plugins.ml2.drivers.linuxbridge.agent.arp_protect [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Clearing orphaned ARP spoofing entries for devices []
2019-03-18 11:47:25.340 5295 INFO neutron.agent.securitygroups_rpc [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Preparing filters for devices set(['tap24ba5a90-39'])
2019-03-18 11:47:25.755 5295 INFO neutron.plugins.ml2.drivers.agent._common_agent [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Port tap24ba5a90-39 updated. Details: {u'profile': {}, u'network_qos_policy_id': None, u'qos_policy_id': None, u'allowed_address_pairs': [], u'admin_state_up': True, u'network_id': u'792e882c-bc78-42de-aa6a-ba35388c938e', u'segmentation_id': 100, u'mtu': 1450, u'device_owner': u'network:dhcp', u'physical_network': None, u'mac_address': u'fa:16:3e:58:c1:aa', u'device': u'tap24ba5a90-39', u'port_security_enabled': False, u'port_id': u'24ba5a90-39fe-438e-9538-437ead8ad608', u'fixed_ips': [{u'subnet_id': u'01c7fcfd-2537-4db3-9ce0-cb66f9b6d3c2', u'ip_address': u'172.16.100.2'}], u'network_type': u'vxlan'}
2019-03-18 11:47:25.766 5295 INFO neutron.plugins.ml2.drivers.linuxbridge.agent.arp_protect [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Skipping ARP spoofing rules for port 'tap24ba5a90-39' because it has port security disabled
2019-03-18 13:31:55.884 5295 INFO neutron.agent.securitygroups_rpc [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Preparing filters for devices set(['tap1eb38508-9c'])
2019-03-18 13:31:55.982 5295 WARNING oslo_rootwrap.client [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Leaving behind already spawned process with pid 5313, root should kill it if it's still there (I can't): error: [Errno 32] Broken pipe
2019-03-18 13:31:56.676 5295 INFO oslo_rootwrap.client [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Spawned new rootwrap daemon process with pid=9149
2019-03-18 13:31:57.254 5295 INFO neutron.agent.securitygroups_rpc [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Security group member updated [u'ebd32402-61eb-439b-bd29-891c08c03560']
2019-03-18 13:31:57.282 5295 INFO neutron.plugins.ml2.drivers.agent._common_agent [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Port tap1eb38508-9c updated. Details: {u'profile': {}, u'network_qos_policy_id': None, u'qos_policy_id': None, u'allowed_address_pairs': [], u'admin_state_up': True, u'network_id': u'792e882c-bc78-42de-aa6a-ba35388c938e', u'segmentation_id': 100, u'mtu': 1450, u'device_owner': u'compute:nova', u'physical_network': None, u'mac_address': u'fa:16:3e:92:f6:00', u'device': u'tap1eb38508-9c', u'port_security_enabled': True, u'port_id': u'1eb38508-9c15-4b52-bf23-f21aa9d608fc', u'fixed_ips': [{u'subnet_id': u'01c7fcfd-2537-4db3-9ce0-cb66f9b6d3c2', u'ip_address': u'172.16.100.3'}], u'network_type': u'vxlan'}
2019-03-18 13:31:57.742 5295 INFO neutron.agent.securitygroups_rpc [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Security group member updated [u'ebd32402-61eb-439b-bd29-891c08c03560']
2019-03-18 13:31:57.884 5295 INFO neutron.agent.securitygroups_rpc [req-317bbe30-203b-409c-a37c-3307c9526325 - - - - -] Refresh firewall rules
 
 
cirros-vm1 被 schedule 到控制節點,對應的 tap 設備為  tap1eb38508-9c,並且連接到 bridge brq792e882c-bc。
[root@openstack1 ~]# brctl show
bridge name    bridge id        STP enabled    interfaces
brq792e882c-bc        8000.567b0d903e15    no        tap1eb38508-9c
                                                     tap24ba5a90-39
                                                     vxlan-100
 
 
 
當前 vxlan100 的結構如下:
繼續用同樣的方式 launch instance cirros-vm2,分配到的 IP 為 172.16.100.4。
cirros-vm2 被 schedule 到計算節點,對應的 tap 設備為 tapd7c3c0e1-3f,並且連接到 bridge brq792e882c-bc。
[root@openstack2 ~]# brctl show
bridge name    bridge id        STP enabled    interfaces
brq792e882c-bc        8000.9a3f78dc2c7f    no        tapd7c3c0e1-3f
                                                     vxlan-100
 
 
因為計算節點上沒有 dhcp 服務,所以沒有相應的 tap 設備。 另外,bridge 的名稱與控制節點上一致,都是 brq792e882c-bc,表明是同一個 network。
當前 vxlan100 的結構如下:
cirros-vm1(172.16.100.3) 與 cirros-vm2(172.16.100.4) 位於不同節點,通過 vxlan100 相連,下面執行 PING 驗證連通性。 在 cirros-vm1 控制台中執行 ping 172.16.100.4
如我們預料,ping 成功。
對於多 vxlan 之間的 routing 以及 floating ip,實現方式與 vlan 非常類似
 
5.L2 Population的配置
 
目前 L2 Population 支持 VXLAN with Linux bridge 和 VXLAN/GRE with OVS。
可以通過以下配置啟用 L2 Population。
在 /etc/neutron/plugins/ml2/ml2_conf.ini 設置 l2population mechanism driver。
mechanism_drivers = linuxbridge,l2population
同時在 [VXLAN] 中配置 enable L2 Population。
L2 Population 生效后,創建的 vxlan-100 會多一個 Proxy ARP 功能。
查看控制節點上的 forwarding database,可以看到 VTEP 保存了 cirros-vm2 的 port 信息。
cirros-vm2 的 MAC 為 fa:16:3e:cf:75:36。 VTEP IP 為 166.66.16.11。
當需要與 cirros-vm2 通信時,控制節點 VTEP 166.66.16.10 會將封裝好的 VXLAN 數據包直接發送給計算節點的 VTEP 166.66.16.11。
我們再查看一下計算節點上的 forwarding database:
fdb 中保存了 cirros-vm1 和 dhcp 的 port 信息。 當需要與它們通信時,計算節點 VTEP 知道應該將數據包直接發送給控制節點的 VTEP。
 
作者:Dexter_Wang   工作崗位:某互聯網公司資深雲計算與存儲工程師  聯系郵箱:993852246@qq.com


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM