What is L2 Network?
An L2 network is a layer 2 broadcast domain used for layer
2 isolation. Generally, L2 networks are identified by names of devices on the
physical network.
- VLAN, VXLAN, and SDN can be used as an L2 network.
- An L2 network is used to provide layer 2 isolation for an L3 network.
L2 Network Types
The following four types of L2 networks are supported:
Note:
- L2NoVlanNetwork
- You must specify the NIC name of the host.
- The hosts in the cluster to which the L2 network is attached must have NICs that share the same name.
- When the data packets of VM instances flow out of the host NIC and reach the physical switch, the data packets are not flagged with VLAN tags. Note that the physical switch must be in VLAN Access mode.
- If you create an L2 network of the L2NoVlanNetwork type, a network bridge is created based on the specified host NIC.
- L2VlanNetwork
- You must specify the host NIC name and VLAN ID.
- The hosts in the cluster to which the L2 network is attached must have NICs that share the same name.
- When the data packets of VM instances flow out of the host NIC and reach the physical switch, the data packets are tagged with the specified VLAN ID.
- If you create an L2 network of the L2VlanNetwork type, a VLAN device is created based on the specified VLAN ID and then a network bridge is created based on the VLAN device.
- If you attach an L2 network of the L2NoVlanNetwork type and an L2 network of the L2VlanNetwork type or attach multiple L2 networks of the L2VlanNetwork type to a cluster, the physical switch NIC must be in Trunk mode. Besides, the VLAN ID in use must be contained in the Trunk VLAN configurations.
- VxlanNetwork
- Virtual Extensible LAN (VXLAN) is an overlay technology that allows for the creation of overlaying L2 networks. This technology can support a maximum of 16 million logical networks.
- VxlanNetwork is an implementation of the software-based VXLAN technology.
- If you create an L2 network of the VxlanNetwork type, you must specify a software SDN-based VXLAN pool. The L2 network must correspond to a VNI in the pool.
- The VTEP IPs of the hosts in the cluster to which the L2 network of the VxlanNetwork type is attached must belong to the specified VXLAN pool.
- When the data packets of VM instances flow out of the host, the host encapsulates VXLAN messages to the data packets and then sends the encapsulated data to the physical switch.
- HardwareVxlanNetwork
- Virtual Extensible LAN (VXLAN) is an overlay technology that allows for the creation of overlaying L2 networks. This technology can support a maximum of 16 million logical networks.
- HardwareVxlanNetwork is a solution to the integration with third-party hardware SDN.
- If you create an L2 network of the HardwareVxlanNetwork type, you must specify a hardware SDN-based VXLAN pool. The L2 network must correspond to a VNI in the pool.
- When the data packets of VM instances flow out of the host NICs and reach the distributed virtual switches, the data packets are flagged with the specified VLAN ID. The VLAN ID is mapped with VXLAN ID based on the SDN controlled that you add to the Cloud.

- In CentOS 7, the NIC name in the ethX format will be changed after the system reboots. In addition, the NIC sequence will also be randomly changed. We recommend that you change the NIC name of each compute node (especially for VM instances with multiple NICs) to a non-ethX format, such as em01.
L2 Network | Cluster | L3 Network | VM Instance
The relationship between an L2 network and a cluster, an L3 network, a VM instance is
as follows:
- If you attached an L2 network to a cluster whereas the L2 network was not attached to a host, you could not add the host to the cluster.
- If you did not attach an L2 network to a cluster and the L2 network was not attached to a host, you could not attach the L2 network to the cluster.
- If you attached an L2 network to a host whereas the corresponding L2 network devices were inconsistently connected to other hosts in a cluster, note that the VM IP that you created would not work properly.
- If you delete an L2 network, the corresponding L3 networks and VM NICs that are using these networks will also be deleted.
- If you delete an L2 network, the VPC vRouter and vRouter offering that use the L2 network will also be deleted.
- If you delete an L2 public network, all network services that are using the network, such as VPC vRouter, vRouter offering, VIP, EIP, port forwarding, load balancing, IPsec tunnel, and Netflow will also be deleted.
- You can create multiple L2 networks of the VxlanNetworks type by using a VXLAN Pool of the Software SDN type. These L2 networks can be applied to flat networks and VPC networks, respectively.
- VM instances in an L2 network of the VxlanNetwork type cannot be accessed through the Internet. To access these VM instances through the Internet, use an EIP or port forwarding.
- You can also create multiple L2 networks of the HardwareVxlanNetworks type by using a VXLAN Pool of the Hardware SDN type. These L2 networks can currently be applied to flat networks.
- You can use an L2 network to create multiple L3 networks. However, we recommend that unless necessary you do not create multiple L3 networks from an L2 network. This may cause the DHCP services of these L3 networks unable to work as expected.
- You can use an L2 network of the HardwareVxlanNetwork type to create only flat networks. In addition, an L2 network of the HardwareVxlanNetwork type supports only flat network services.
- If you use a vSwitch of the OVS-DPDK type for an L2 network, you can use the L2 network to create only IPv4 VPC networks and provide corresponding network services.