Hosts and VM instances reside on the same layer 2 broadcast domain.
Services such as User Data, EIP, DHCP, and security group are provided.
Both the distributed EIP and the distributed DHCP can avoid a single point of
failure (SPOF). Hence, when high concurrency occurs, the entire concurrency of
the system can be improved effectively.
IPv6 network protocol is supported.
A flat network provides the following network services:
User Data: Allow you to start, attach or perform specific operations on a VM
instance by using cloud-init, such as injecting
ssh-key.
EIP: Refer to elastic IP addresses that can be used to reach internal, private
networks via public networks.
DHCP: Obtain IP addresses dynamically, which is achieved by the distributed
DHCP.
Note: The DHCP service includes the DNS feature.
Security group:
The security group network module provides the security group
service.
VM firewalls can be securely controlled with iptables.
Figure 1. Flat Network Topology
Prerequisites
In this Tutorial, assume that you have installed the latest ZStack Cloud, and complete the basic cloud initialization, including
adding a zone, cluster, host, backup storage, primary storage, and other basic
resources. For more information, see installation and deployment chapter and
initialization by Wizard chapter in User Guide.
This Tutorial mainly describes basic deployments and typical scenarios of flat
networks.
Basic Deployment
ZStack Cloud supports IPv4 flat networks, IPv6 flat networks, and
public networks. This section describes basic deployments of IPv4 flat networks and IPv6
flat networks.
Deploy an IPv4 Flat Network
IPv4, known as Internet Protocol version 4 which defines IP addresses in a 32-bit
format, is the most popular Internet Protocol version across the globe. ZStack Cloud flat networks support the IPv4 protocol. This topic mainly
describes the basic deployment of IPv4 flat networks.
About this task
The following table lists the assumed environment configurations.
Flat Network
Configurations
NIC
em01
VLAN ID
No VLAN
IP Range
172.20.108.40-172.20.108.50
Netmask
255.255.0.0
Gateway
172.20.0.1
DHCP IP
172.20.180.41
To create an IPv4 flat network, follow these steps:
Create an L2 network corresponded by an IPv4 flat network, and attach the L2
network to the corresponding cluster.
Create an L3 network corresponded by an IPv4 flat network.
Create a VM instance by using this IPv4 flat network.
Validate the connectivity of this IPv4 flat network.
Procedure
Create an L2 network corresponded by an IPv4 flat network, and attach this L2
network to the corresponding cluster.
On the main menu of ZStack Cloud, choose Resource Center > Network Resource > L2 Network Resources > L2 Network. On the L2 Network page, click
Create L2 Network. Then, the Create L2
Network page is displayed. On the displayed Create
L2 Network page, set the following parameters by referring to
IPv4
Flat Network Configuration:
Zone: By default, the current zone is
displayed.
Name: Enter a name for the L2 flat
network.
Description: Optional. Enter a description
for the L2 flat network.
Type: Select
L2NoVlanNetwork.
Cluster: Optional. Select the cluster to be
attached, for example, Cluster-1.
Network Acceleration
Mode: You can use different technologies to improve
network performance of the L2 network, including Standard, SR-IOV,
and Smart NIC. Here, select Standard.
NIC Name: Select or enter an NIC name for the
L2 network. For example, em01.
Figure 2. Create L2 Flat Network
Create an L3 network corresponded by an IPv4 flat network.
On the main menu of ZStack Cloud, choose Resource Center > Network Resource > L3 Network Resources > Flat Network. On the Flat Network page, click
Create Flat Network. The Create Flat
Network page appears. On the displayed Create
Private Network page, set the following parameters by
referring to IPv4 Flat Network Configuration:
Name: Enter a name for the L3 flat
network.
Description: Optional. Enter a description
for the L3 flat network.
L2 Network: Select an L2 flat network that
you created.
IP Address Management: Select whether to
enable IP Address Management (IPAM) for the L3 flat network. If you
enable IPAM, you can set network ranges, IP allocation policy, and
DHCP service for the L3 network. Enable IPAM here.
Network Address Type: Select
IPv4.
Network Range Method: Select a method to add
a network range for the flat network. Here, select IP
Range.
Start IP: Set a start IP address for the
network range, for example, 172.20.108.40.
End IP: Set an end IP address for the network
range, for example, 172.20.108.50.
Netmask: Set a netmask for the network range,
for example, 255.255.0.0.
Gateway: Set a gateway for the network range,
for example, 172.20.0.1.
DHCP Service: Choose
whether to enable the DHCP service.
Note:
The DHCP service is a built-in distributed service of
the Cloud, which assigns IP addresses only to resources
in the Cloud and does not conflict with your existing
DHCP server.
By default, the DHCP service is enabled so that IP
addresses are automatically assigned to resources in the
Cloud. You can customize a DHCP IP or use the DHCP IP
that the system assigned according to the IP allocation
policy.
If you disable this option, IP addresses are not
automatically assigned to resources that use this
network. Therefore, you need to manually assign IP
addresses to these resources. In addition, you cannot
specify a DHCP IP. Neither can the system allocate
one.
IP Allocation Policy: Optional. After
the DHCP service is enabled, IP addresses can be assigned
according to the following three allocation policies:
Random: The system randomly
assigns IP addresses from the network range.
Allocate in Order:
The system assigns all available IP addresses
from the network range in ascending order.
Released IP addresses are assigned in the next
allocation.
Example: Assume that the network range is
192.168.0.101~192.168.0.120, within
which 192.168.0.101~192.168.0.108
are allocated. If 192.168.0.106 is
released, it will be assigned first in the next
allocation.
Allocate in Cycle:
The system assigns available IP addresses to
VM instances from the network range in ascending
order. Released IP addresses are assigned when
currently available IP addresses are used up.
Example: Assume that the network range is
192.168.0.101~192.168.0.120, within
which 192.168.0.101~192.168.0.108
are allocated. If 192.168.0.106 is
released, it will be assigned after
192.168.0.120 is used.
DHCP IP:
Optional. Set an IP address for the DHCP server, for
example, 172.20.180.41.
Note:
A DHCP IP is an IP address used by the DHCP
service to assign IP addresses to resources that
use this L3 network.
If you create an L3 network for the first time
with the DHCP service enabled, or if you add the
first network range to an L3 network with the DHCP
service enabled, you can customize the DHCP
IP.
If the L3 network has a DHCP IP, you cannot
customize the DHCP IP when you add a network
range.
The DHCP IP can be in or outside the added IP
range, but it must be an unoccupied IP address in
the CIDR block of the added IP range
The IP range determined by the start IP and end
IP cannot contain the link-local address
169.254.0.0/16.
If you select random as the IP allocation policy
and this field is left blank, the system randomly
assigns IP addresses from the added network
range.
If you select allocate in order/allocate in
cycle as the IP allocation policy and this field
is left blank, the system uses the start IP
address in the network range as the DHCP IP.
DNS: Optional. Enter a DNS, such as
114.114.114.114.
Figure 3. Create L3 Flat Network
Create a VM instance by using this IPv4 flat network.
On the main menu of ZStack Cloud, choose Resource Center > Resource Pool > Virtual Resource > VM Instance. On the VM Instance page, click
Create VM Instance. Then, the Create VM
Instance page is displayed. On the displayed page, create two
VM instances by using the IPv4 flat network, for example, VM-1 and VM-2.
Validate the connectivity of this IPv4 flat network.
Expected result: The two VM instances (VM-1 and VM-2) on the same network
range can communicate with each other.
Validate the connectivity:
Log in to VM-1 and validate whether VM-1 can ping
VM-2.Figure 4. VM-1 Pings VM-2
Log in to VM-2 and validate whether VM-2 can ping
VM-1.Figure 5. VM-2 Pings VM-1
So far, we have introduced the basic deployments of the IPv4 flat
network.
Deploy an IPv6 Flat Network
IPv6 is Internet Protocol version 6 that defines IP addresses in a 128-bit format.
IPv6 resolves the long-anticipated problem of IPv4 address exhaustion, so many devices can
be connected to the Internet. ZStack Cloud flat networks support the
IPv6 protocol. This topic describes the basic deployment of IPv6 flat networks.
About this task
The following table lists the assumed environment configurations.
Flat Network
Configurations
NIC
em1
VLAN ID
2002
IP Range
234e:0:4567::2-234e:0:4567:0:ffff:ffff:ffff:ffff
Prefix length
64
Gateway
234e:0:4567::1
DHCP IP
234e:0:4567::3
DNS
240c::6644
To create an IPv6 flat network, follow these steps:
Create an L2 network corresponded by an IPv6 flat network, and attach this
L2 network to the corresponding cluster.
Create an L3 network corresponded by the IPv6 flat network.
Create two VM instances by using the IPv6 flat network.
Obtain IPv6 addresses of the VM instances.
Validate the connectivity of the IPv6 flat network.
Procedure
Create an L2 network corresponded by an IPv6 flat network, and attach this L2
network to the corresponding cluster.
On the main menu of ZStack Cloud, choose Resource Center > Network Resource > L2 Network Resources > L2 Network. On the L2 Network page, click
Create L2 Network. Then, the Create L2
Network page is displayed. On the displayed Create
L2 Network page, set the following parameters by referring to
IPv6
Flat Network Configuration:
Zone: By default, the current zone is
displayed.
Name: Enter a name for the L2 flat network,
for example, L2-IPv6-Flat Network.
Description: Optional. Enter a description
for the L2 flat network.
Type: Select
L2VlanNetwork.
Cluster: Optional. Select the cluster to be
attached, for example, Cluster-1.
Network Acceleration
Mode: You can use different technologies to improve
network performance of the L2 network, including Standard, SR-IOV,
and Smart NIC. Here, select Standard.
VLAN ID: Enter a VLAN ID, for example,
2002.
NIC Name: Select or enter an NIC name for the
L2 network. For example, em1.
Figure 6. Create L2-IPv6-Flat Network
Create an L3 network corresponded by the IPv6 flat network.
On the main menu of ZStack Cloud, choose Resource Center > Network Resource > L3 Network Resources > Flat Network. On the Flat Network page, click
Create Flat Network. The Create Flat
Network page appears. On the displayed Create
Private Network page, set the following parameters by
referring to IPv6 Flat Network Configuration.
Name: Enter a name for the L3 network, such
as L3-IPv6-Flat Network.
Description: Optional. Enter a description
for the L3 flat network.
L2 Network: Select an L2 flat network that
you created, such as L2-IPv6-Flat Network.
IP Address Management: Select whether to
enable IP Address Management (IPAM) for the L3 flat network. If you
enable IPAM, you can set network ranges, IP allocation policy, and
DHCP service for the L3 network. Enable IPAM here.
Network Address Type: Select
IPv6.
Network Range Method: Select a method to add
a network range for the flat network. Here, select IP
Range.
IP Configuration Mode: Select
Stateful-DHCP.
Start IP: Set a start IP address for the
network range, for example, 234e:0:4567::2.
End IP: Set an end IP address for the network
range, for example, 234e:0:4567:0:ffff:ffff:ffff:ffff.
Prefix Length: Set a prefix length for the
network range, for example, 64.
Gateway: Set a gateway for the network range,
for example, 234e:0:4567::1.
DHCP Service: Choose whether to enable the
DHCP service.
Note:
The DHCP service is enabled by default. This service
automatically assigns an IP address to a VM instance.
You can specify an IP address for the DHCP server. If
you do not specify, the system assigns a random IP
address for the DHCP server.
If you disable the DHCP service, no IP address is
automatically assigned to VM instances in the flat
network. You need to manually configure IP addresses for
the VM instances.
DHCP IP: Optional. Set an IP address
for the DHCP server, for example,
234e:0:4567::3.
Note:
When you create an L3 network and enable the
DHCP service for the first time, or when you add
the first network range for an L3 network that has
the DHCP service enabled, you can specify an IP
address for the DHCP server.
If a DHCP IP is specified for an L3 network, you
cannot specify another DHCP IP when you add a
network range for the network.
The DHCP IP can be within or out of the added IP
range. However, the IP address must be within the
CIDR block to which the added IP range belongs and
must not be in use.
The IP range determined by the start IP and end
IP cannot contain the link-local address
fe80::/10.
If not specified, the system would randomly
specify a DHCP IP within the added IP range for
the DHCP server.
DNS: Set a DNS address for the L3 network,
for example, 240c::6644.
Figure 7. Create L3-IPv6-Flat Network
Create two VM instances by using the IPv6 flat network.
On the main menu of ZStack Cloud, choose Resource Center > Resource Pool > Virtual Resource > VM Instance. On the VM Instance page, click
Create VM Instance. Then, the Create VM
Instance page is displayed. On the displayed page, create two
VM instances by using the IPv6 flat network, for example, VM-1 and VM-2.
Obtain IPv6 addresses of the VM instances.
By default, ZStack Cloud can automatically obtain IP
addresses for the IPv4 network, while you must manually configure IP
addresses for VM instances that use the IPv6 network. Launch the consoles of
these two VM instances respectively, and run the following commands to
obtain IPv6
addresses:
[root@loaclhost~]# dhclient -6 eth0 //eth0 indicates the NIC name.
Note: The address that begins with FE80 is the link-local address instead of the
expected address.
Figure 8. Obtain IPv6 Address In this scenario, you will obtain the following IPv6 addresses:
VM-1 IP address: 234e:0:4567::63:ab4d
VM-2 IP address: 234e:0:4567::31:3c6e
Validate the connectivity of the IPv6 flat network.
Expected result: The two VM instances (VM-1 and VM-2) on the same network
range can communicate with each other.
Validate the connectivity:
Log in to VM-1 and validate whether VM-1 can ping
VM-2.Figure 9. VM-1 Pings VM-2
Log in to VM-2 and validate whether VM-2 can ping
VM-1.Figure 10. VM-2 Pings VM-1
So far, we have introduced the basic deployments of the IPv6 flat
network.
Deploy a Flat Network Disabled with IP Address
Management
About this task
IP Address Management (IPAM) is a service for the allocation and management of IP
addresses on an L3 network. Enabling IPAM for an L3 network requires you to add
network ranges from which IP addresses are allocated to the resources on this L3
network automatically. ZStack Cloud allows you to disable
IPAM when creating a flat network which does not need network ranges and other
relevant parameters. You can allocate and manage IP addresses of resources on this
flat network by yourself without the restriction of network ranges. This topic
describes the deployment of a flat network disabled with IPAM.
The following table lists the assumed environment configurations.
Flat Network
Configurations
NIC
eth0
VLAN ID
2002
Flat Network
Configurations
IP address
172.20.60.107
Netmask
255.255.0.0
Gateway
172.20.0.1
To create a flat network disabled with IPAM, follow these steps:
Prepare an L2 network for the flat network, and attach this L2 network to
the corresponding cluster.
Create a flat network and disable IP Address Management.
Create a VM instance based on the no-IPAM flat network.
Install GuestTools for the VM instance.
Sync VM NIC configurations.
Validate the IP configuration of the VM NIC.
Procedure
Prepare an L2 network for the flat network, and attach this L2 network to the
corresponding cluster.
On the main menu of ZStack Cloud, choose Resource Center > Network Resource > L2 Network Resources > L2 Network. On the L2 Network page, click
Create L2 Network. Then, the Create L2
Network page is displayed. On the displayed Create
L2 Network page, set the following parameters by referring to
Flat
Network Configuration:
Zone: By default, the current zone is
displayed.
Name: Enter a name for the L2 flat network,
for example, L2-No-IPAM-Flat.
Description: Optional. Enter a description
for the L2 flat network.
Type: Select
L2VlanNetwork.
Cluster: Optional. Select the cluster to be
attached, for example, Cluster-1.
Network Acceleration
Mode: You can use different technologies to improve
network performance of the L2 network, including Standard, SR-IOV,
and Smart NIC. Here, select Standard.
VLAN ID: Enter a VLAN ID, for example,
2002.
NIC Name: Select or enter an NIC name for the
L2 network. For example, eth0.
Figure 11. Create L2-No-IPAM-Flat Network
Create a Flat Network and disable IP Address Management.
On the main menu of ZStack Cloud, choose Resource Center > Network Resource > L3 Network Resources > Flat Network. On the Flat Network page, click
Create Flat Network. The Create Flat
Network page appears. On the displayed Create
Private Network page, set the following parameters:
Name: Enter a name for the L3 network, such
as L3-No-IPAM-Flat.
Description: Optional. Enter a description
for the L3 flat network.
L2 Network: Select an L2 flat network that
you created, such as L2-No-IPAM-Flat.
IP Address Management: Select whether to
enable IP address management (IPAM) service for the 3 network.
Disable IPAM in this scenario. After the disabling, you do not need
to set network ranges, gateway netmask, and IP allocation policy for
the L3 network.
DHCP Service: After disabling IPAM, the DHCP
service is disabled by default and cannot be enabled.
DNS: Set a DNS address for the L3 network.
You can leave this parameter as blank in this scenario.
Figure 12. Create L3-No-IPAM-Flat Network
Create a VM instance based on the no-IPAM flate network.
On the main menu of ZStack Cloud, choose Resource Center > Resource Pool > Virtual Resource > VM Instance. On the VM Instance page, click
Create VM Instance. Then, the Create VM
Instance page is displayed. On the displayed page, create a
VM instances by using the no-IPAM flat network you created. You can set the
network configuration according to Table 2.
Network: Select the flat network disabled
with IPAM you create.
Make Default: Select whether to set the flat
network as the default network of the VM instance. In this scenario,
set the flat network as the default network.
Enable SR-IOV: Do not enable SR-IOV in this
scenario.
Assign IPv4: The system does not allocate an
IP address to a VM NIC created on an L3 network disabled with IPAM.
To configure the NIC IP address, you can either manually assign one
on the Cloud or configure one in the VM instance. Assign one on the
Cloud in this scenario.
Note: If you configure an IP address in the
VM instance, the IP address cannot be read or managed by the
Cloud currently.
IPv4 : Manually assign an IP address
for the VM instance. Enter 172.20.60.107 in this scenario.
Note:
Make sure that the IP address has not been
occupied on the Cloud.
Install GuestTools for the VM instance after the
creation and sync NIC configurations to make the
IP address take effect.
Netmask: Set the IPv4 netmask. Enter
255.255.0.0 in this scenario.
IPv4 Gateway: Set the IPv4 gateway.
Enter 172.20.0.1 in this scenario.
Security Group: Associate an existing
security group to the VM instance for network security
services. You can leave this paramater as blank in this
scenario.
Assign IPv6: Select whether to manually
assign an IPv6 address for the VM instance. Do not assign an IPv6
address in this scenario.
MAC Address: Select whether to manually
assign a MAC address for the VM instance. DO not assign a MAC
address in this scenario.
Figure 13. VM Instance Network Configuration
Install GuestTools for the VM Instance.
Follow these steps to install GuestTools for the VM instance:
Install ISO.
On the details page of the VM-Self-Managed-IP, click GuestTools: Install > Next: Install on VM Console.Figure 14. Install GuestTools: Install ISO
Install on VM Console
Run the following commands on the VM console to finish the
installation:
# Create a mount point.
mkdir /mnt/cdrom
# Attach the CD-ROM image.
mount /dev/cdrom /mnt/cdrom
# Install GuestTools.
cd /mnt/cdrom/
bash ./zs-tools-install.sh
# Unmount the CD-ROM image (optional).
cd ~
umount /mnt/cdrom
Figure 15. Install GuestTools: Install on VM Console
Note: If you configure an IP address in the VM instance, you can skip this
step.
Sync VM NIC configurations.
On the details page of VM-Self-Managed-IP, click Configuration > NIC > Synchronize Configurations to deploy the IP address assigned on the Cloud to the NIC
actually.
Note: If you configure an IP address in the VM instance, you can
skip this step.
Validate the IP address of the VM NIC.
Expected result: The IP address assigned on the Cloud can be queried in the
VM instance.
Log in to the VM-Self-Managed-IP and check the VM IP address.
Figure 16. Validate the IP Address of the VM NIC
Note: If you configure the IP address in the VM instance, you can skip this
validation.
What to do next
So far, you have deployed a flat network disabled with IP
Address Management.
Typical Scenarios
IPv4+IPv6 Dual Stack
An IPv4+IPv6 dual stack is one NIC with two types of IP addresses: IPv4 and IPv6, and
takes full advantage of both IPv4 and IPv6. With the IPv4+IPv6 dual stack, you can meet the
needs of different business scenarios.
About this task
The following tables list the assumed environment configurations.
IPv4 Network Range
Flat Network
Configurations
NIC
em1
VLAN ID
2002
IP Range
192.168.2.2-192.168.2.254
Netmask
255.255.255.0
Gateway
192.168.2.1
DHCP IP
192.168.2.3
DNS
223.5.5.5
IPv6 Network Range
Flat Network
Configurations
IP Range
234e:0:4568::2-234e:0:4568:0:ffff:ffff:ffff:ffff
Prefix Length
64
Gateway
234e:0:4568::1
DHCP IP
234e:0:4567::3
DNS
240c::6644
To create an IPv4+IPv6 dual stack, follow these steps:
Create an IPv4 networking environment.
Add an IPv6 range.
Add an IPv6 DNS address.
Create VM instances by using the dual-stack network.
Obtain IPv6 addresses of the VM instances.
Validate the network connectivity.
Procedure
Create an IPv4 networking environment.
Create a flat network with an IPv4 address, for example, L3-Flat
Network. At this time, this network is an IPv4 network. For network
configuration information, see IPv4
Network Configuration and IPv6
Network Configuration.
Note: You can also create an IPv6 flat
network first, and then add an IPv4 range to a flat network.
Add an IPv6 range.
Add an IPv6 range to the existing IPv4 network to form an IPv4+IPv6
dual-stack network.
On the Flat Network page, locate the IPv4 network and
click Actions > Add IPv6 Range. On the displayed Add Network Range
page, set the following parameters:
Network Range Method: Select a method to add
a network range for the VPC network. You can select IP Range or
CIDR. Here, select IP Range.
IP Configuration Mode: Select
Stateful-DHCP.
Note:
Stateful-DHCP: The interface address and other
parameters are all configured through DHCP. The IP range
method supports stateful DHCP.
Stateless-DHCP: The interface address is automatically
derived from the route advertisement prefix and the
interface Mac address. Other parameters are configured
through DHCP.
SLAAC: The interface address is automatically derived
from the prefix of the route advertisement that also
contains other parameters.
Start IP: Set a start IP address for the
network range, for example, 234e:0:4568::2.
End IP: Set an end IP address for the network
range, for example, 234e:0:4568:0:ffff:ffff:ffff:ffff.
Prefix Length: Set a prefix length for the
network range, for example, 64. Range: 64-126.
Gateway: Set a gateway for the network range,
for example, 234e:0:4568::1.
DHCP IP: Optional. Set an IP address for the
DHCP server, for example, 234e:0:4568::3.
Note:
When you create an L3 network and enable the DHCP
service for the first time, or when you add the first
network range for an L3 network that has the DHCP
service enabled, you can specify an IP address for the
DHCP server.
If a DHCP IP is specified for an L3 network, you cannot
specify another DHCP IP when you add a network range for
the network.
The DHCP IP can be within or out of the added IP range.
However, the IP address must be within the CIDR block to
which the added IP range belongs and must not be in
use.
The IP range determined by the start IP and end IP
cannot contain the link-local address fe80::/10.
If not specified, the system would randomly specify a
DHCP IP within the added IP range for the DHCP
server.
Figure 17. Add IPv6 Range
Add an IPv6 DNS address.
On the DNS tab page of the flat network, click
Add DNS. On the Add DNS
dialogue box, set the following parameters:
Network Address Type: Select
IPv6.
DNS: Specify a DNS address, for example,
240c::6644.
Figure 18. Add IPv6 DNS Address
Create VM instances by using the dual-stack network.
On the main menu of ZStack Cloud, choose Resource Center > Resource Pool > Virtual Resource > VM Instance. On the VM Instance page, click
Create VM Instance. Then, the Create VM
Instance page is displayed. On the displayed page, create two
VM instances by using the IPv4 flat network, for example, VM-Dual Stack-1
and VM-Dual Stack-2.
Obtain IPv6 addresses of the VM instances.
By default, ZStack Cloud can automatically obtain IP
addresses for the IPv4 network, while you must manually configure IP
addresses for VM instances that use the IPv6 network. Launch the consoles of
these two VM instances respectively, and run the following commands to
obtain IPv6
addresses:
[root@loaclhost~]# dhclient -6 eth0 //eth0 indicates the NIC name.
Note: The address that begins with FE80 is the link-local address instead of the
expected address.
Figure 19. Obtain IP Address In this scenario, after running ifconfig, you will
obtain the following addresses:
Log in to the VM-Dual Stack-1. Use the IPv4 address and the IPv6
address respectively to validate whether these two IP addresses can
ping VM-Dual Stack-2.
Log in to the VM-Dual Stack-2. Use the IPv4 address and the IPv6
address respectively to validate whether these two IP addresses can
ping VM-Dual Stack-1.
Figure 20. Validate Network Connectivity Similarly, log in to the VM-Dual Stack-2. Use the IPv4 address and the
IPv6 address to validate whether these two IP addresses
ping VM-Dual Stack-1.
So far, we have introduced how to use a Dual stack (IPv4+IPv6) flat
network.
Load Balancing
Prerequisites
Typical scenario: Assume that the user has a high number of application access in the
VPC network. The user wants to use a dedicated performance load balancer to
distribute traffic flows to a group of backend servers to improve the service
capbility of the business. According to the business needs, the load balancer needs
to adopt a HTTPS protocol to monitor traffic flows. Assume the user has met the
following requirements:
The user has deployed the latest version of ZStack Cloud.
The user has deployed a public network, VPC network, and management
network.
The user has created 3 business VMs.
About this task
To create a private flat network load balancing, follow these steps:
Add a dedicated-performance LB image.
Create a load balancer instance offering.
Create a dedicated-performance load balancer.
Create a listener.
Add a backend server and assign a weighted value.
Validate the scenario.
Procedure
Add a dedicated-performance LB image.
On the main menu of ZStack Cloud,
choose Resource Center > Network Resource > vRouter > vRouter Image. On the vRouter Image page, click
Add vRouter Image. Then, the Add
vRouter Image page is displayed.
On the displayed page, set the following parameters:
Name: Enter a name for the image.
Description: Optional. Enter a description
for the vRouter image.
Image Usage: Specify what the vRouter image
is used for. Here, select Dedicated-Performance LB.
CPU Architecture: Select a CPU architecture
for the vRouter image. LB instances created from the vRouter image
inherit this CPU architecture.
Backup Storage: Select a backup storage to
store the vRouter image.
Image Path: Enter a URL or upload a local file.
Note:
ZStack Cloud provides you with
dedicated-performance LB images (KVM). You can download the
latest vRouter images from the official website.
On the main menu of ZStack Cloud, choose Resource Center > Network Service > Basic Network Service > Load Balancing > Configuration. On the Configuration tab, click
Create Load Balancer Instance Offering. The
Create Load Balancer Instance Offering page is
displayed.
On the displayed page, set the following parameters:
Zone: By default, the current zone is
displayed.
Name: Enter a name for the load balancer (LB)
instance offering.
Description: Optional. Enter a description
for the LB instance offering.
CPU: Specify the number of CPU cores for the
LB instance offering, for example, specify 2 Core.
Memory: Specify the memory size for the LB
instance offering, for example, specify 8GB.
Image: Select a
dedicated-performance LB image that you added.
Management Network: Select a management
network that you created.
Figure 22. Create Load Balancer Instance Offering
Create a dedicated-performance load balancer.
On the main menu of ZStack Cloud, choose Resource Center > Network Service > Basic Network Service > Load Balancing. On the Load Balancer page, click
Create Load Balancer. The Create Load
Balancer page appears.
On the displayed page, set the following parameters:
Name: Enter a name for the LB.
Description: Optional. Enter a description
for the LB.
LB Type: Select Dedicated Performance.
Network: Select a network
as the frontend network of the LB. Here, select a flat network.
VIP: You can
create a VIP or use an existing VIP to provide load balancing
services. Here, select New VIP. Set the
following parameters:
Network Range: Optional. Select an IP
range.
Assign IP: Optional. Specify a VIP.
This parameter is available only after you select an IP
range.
Backend Network: Select a network as the
backend network. Here, specify the same flat network.
LB Instance Name: Enter a name for the LB
instance.
On the details page of the load balancer, click the
Listener tab. On the tab, click Create
Listener. The Create Listener page is
displayed.
On the displayed page, set the following parameters:
Name: Enter a name for the listener.
Description: Optional. Enter a description
for the listener.
Protocol: Select a listening protocol. Here,
select TCP.
Load Balancer Port: Specify a port for load
balancing. Valid values: 1 to 65535. Here, specify100.
Backend Server Port: Specify a backend server
port. Valid values: 1 to 65535. Here, specify 80.
Load Balancer Algorithm: Set a routing rule
for data packets. Here, select Weighted Round
Robin.
Session Persistence: An innate mechanism of
the load balancing service. It identifies the association of the
interactions between a client and backend servers based on which a
load balancer can direct the client's requests to a specific backend
server and achieve business continuity.
Backend Server Group: Optional. Select a
backend server group. Here, select the default backend server
group.
Advanced: Configure advanced settings for the
listener. Here, use default settings.
Figure 24. Create Listener
Add a backend server and assign a weighted value.
Add a backend server.
On the details page of the load balancer, click Backend
Server Group. On the tab, enter the details page of
the backend server group. On the details page, click Add
Backend Server. Then, the Add Backend
Server page is displayed.
On the displayed page, set the following parameters:
Backend
Server: You can add a VM instance or other
servers outside of the Cloud as a backend server. Here,
select By Instance NIC.
Network:
By default, the flat network is displayed.
NIC: Specify 3 VM instances
NICs.
Figure 25. Add Backend Server
Assign a weighted value.
On the Add Backend Server page, assign a
weighted value to the 3 VM instances respectively. Requests are more
likely to be distributed to VM instances with a higher weight.
Figure 26. Assign Weighted Value
Validate the scenario.
In this scenario, we will run the curl command in the port 100 of the VIP
address (192.168.0.249) of
the load balancer: for i in {1..20}; do curl
192.168.0.249:100; done.
Expected result:
VM-1 (Weighted value: 80): The number (probability) of distributed
requests is relatively high.
VM-2 (Weighted value: 40): The number (probability) of distributed
requests is relatively medium.
VM-3 (Weighted value: 20): The number (probability) of distributed
requests is relatively low.
Actual result:
VM-1: being polled for 11 times.
VM-2: being polled for 6 times.
VM-3: being polled for 3 times.
Figure 27. Scenario Validation
So far, we have introduced how to use the load balancing service based on a
flat network.