Server Load balancer principles and practices 16th Server Load balancer Network Design regards Server Load balancer as a layer-2 switch or a layer-3 Router

Source: Internet
Author: User

SeriesArticle:

Server Load balancer: requirements of Server Load balancer

Server Load balancer details Article 2: Basic concepts of Server Load balancer-Network Basics

Server Load balancer Part 3: basic concepts of Server Load balancer-Server group using Server Load balancer

Server Load balancer details Article 4: basic concepts of Server Load balancer-Data Packet Flow During Server Load balancer

Server Load balancer details Article 5: basic concepts of Server Load balancer-Health Check

Server Load balancer details Article 6: basic concepts of Server Load balancer-Network Address Translation (NAT)

Server Load balancer Article 7: basic concepts of Server Load balancer-Direct server return

Server Load balancer details Article 8: Server Load balancer Advanced Technology-Session persistence (upper)

Server Load balancer (Advanced Server Load balancer Technology)-Session persistence (medium)

Server Load balancer details Article 10: Server Load balancer Advanced Technology-Session persistence (lower)

 

So far, we have discussed in detail several features and features of using Server Load balancer to improve the scalability, availability, and manageability of Server clusters. This chapter mainly discusses the deployment of Server Load balancer and several solutions for deploying Server Load balancer in the existing network. We will also discuss how to design highly available solutions to implement fault tolerance for different network components throughout the network, including Load balancer.

 

Before discussing the network structure, we need to understand some basic concepts. First, we will discuss whether to use the Server Load balancer as a layer-2 switch or layer-3 router. This is critical in network design. Then, starting with a simple network structure that never involves high availability, it extends to how the Server Load balancer achieves high availability, and discusses different high availability designs and necessary conditions. This chapter describes in detail the process of changing the network structure from simple to complex, rather than simply providing a specific network design solution.

 

1Use Server Load balancer as a layer-2 switch or a layer-3 Router

 

The basic function of a vswitch is to receive data packets on the receiving port, select the output port, and send the data packets. How to select an output port depends on the type of the switch.

The L2 Switch uses the MAC address of the data link layer to determine the output port of the data packet. A layer-3 Switch, that is, a router, uses network layer information to determine the output port of a data packet. When the IP protocol is used, the layer-3 Switch uses the IP address in the data packet to determine the output port of the data packet.

 

The client and server, usually known as a host, set the IP address of the router provided by the Administrator to the default gateway. When a packet is sent to IP addresses of different network segments, the host sends the packet to the default gateway. As the default gateway, the router interface uses the routing protocol to determine how to forward data packets based on the IP address of the data packets.

 

Load balancer generally works on four or more layers, depending on the features we use. After receiving a packet whose destination address is VIP and whose destination MAC address is the MAC address of the Server Load balancer, the Server Load balancer implements the Server Load balancer Function Based on Information above Layer 4 in the packet.

 

The server Load balancer selects a real server to provide services and forward requests to this server by using the information in the packet, the server health check results, and the server load status. At the same time, the Server Load balancer modifies the relevant information in the data packet, such as the destination IP address, TCP or UDP port number. After modifying the data packet, the Server Load balancer needs to determine the output port and send the data packet. The Server Load balancer can forward the data packet as a layer-2 switch or router.

 

The server Load balancer only provides layer-4 or more exchanges for specific data packets, that is, data packets with the VIP address and response from the corresponding server. All other data packets are exchanged at Layer 2 or Layer 3, depending on the server Load balancer configuration.

 

Figure 1 shows the process of packet forwarding and IP address addressing in layer-2 mode.

 

 

The default gateway of the server and Server Load balancer points to the router. All servers are in the same network segment. In this way, servers can communicate directly through the Server Load balancer without going through the router. Note that the destination MAC address of the packet returned from the server is M1, that is, the MAC address of the router. However, because the server uses a public IP address, it cannot save IP Address resources, so this solution is not attractive.

 

In this way, users cannot access the server directly, unless the access control list is set on the vro or Server Load balancer. This allows the server to use a private IP address, but you need to configure two CIDR blocks on the same interface of the router.

 

The server Load balancer uses a public IP address in one CIDR block, and the server uses a private IP address in another CIDR block. We need to define two IP addresses on the interface connecting the router to the Server Load balancer: one IP address is in the VIP network segment, and the other IP address is in the server network segment. Some SLB products provide some special functions to avoid setting multiple IP addresses on the router interface.

 

When the default gateway of the server points to the Server Load balancer, the packet flow and IP addressing process 2 are shown. The Server Load balancer forwards packets like a router. The default gateway address is 10.10.10.1, which is defined on the interface connecting the Server Load balancer to the server. In this article, the gateway IP address is used to represent the IP address of the default gateway of the server. 

 

Because the default gateway points to the Server Load balancer, the destination MAC address of the server response packet is m2, that is, the MAC address of the Server Load balancer, as shown in figure 2.

 

Some people may ask why VIP is not used as the default gateway of the server? Yes, but there may be multiple VIPs. Each VIP provides services for different customers and applications, and the default gateway of the server can only have one. Therefore, it is reasonable to separate the IP address from the VIP address by using a separate IP address as the default gateway. In addition, the gateway IP address must be in the same network segment as the server. If the server is distributed in different CIDR blocks, a default gateway must be defined for each CIDR block. Therefore, it is easier to separate the VIP from the default gateway.

 

The routing and switching functions are separated from the Server Load balancer functions. The routing and switching functions determine the next hop and output ports based on the IP address or MAC address, server Load balancer is working at a higher level in the OSI model. If the real server and the Server Load balancer are in the same network segment or broadcast domain, the Server Load balancer can send packets to the Real Server through Layer 2 switching. If the server and Server Load balancer are not in the same broadcast domain, how to forward data packets depends on whether the Server Load balancer is working on Layer 2 or Layer 3. If the server Load balancer is a layer-3 switch, it determines the next hop address based on the route table. If the server Load balancer is a layer 2 switch, the Server Load balancer sends data packets to the default gateway, which routes data packets to the Real Server.

 

If the server Load balancer works in a layer-3 router mode, the server can point the default gateway to the Server Load balancer. This ensures that the server response data in a specific network environment passes through the Server Load balancer, for example, in a single-arm network environment.

 

This function will be used in some network designs we will discuss next. In addition, the Server Load balancer can hide the private IP addresses of servers from external switches and routers. If servers are in different network segments, they can communicate with each other through the Load balancer. However, Server Load balancer is slightly more complex in configuration and management than in layer-2 routing. Generally, Server Load balancer is only required to perform simple routing and does not run complicated routing protocols such as BGP.

 

in the subsequent sections, assume that the Server Load balancer works in layer-3 routing mode, so the default gateway of the server points to the Server Load balancer.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.