In the IP world, the service type is determined by the terminal TCP or UDP port address, and the application interval in Layer 4 switching is determined by the source and terminal IP addresses, TCP and UDP ports. A virtual IP address (VIP) is set for each server group used for searching in Layer 4 switching, and each server group supports some applications. Every application server address stored in the domain name server (DNS) is a VIP, not a real server address. When a user applies for an application, a VIP connection request (such as TCP SYN packet) with the target server group is sent to the server switch. The server switch selects the best server in the group, replaces the VIP in the terminal address with the IP of the actual server, and sends a connection request to the server. In this way, all data packets in the same interval are mapped by the server switch and transmitted between the user and the same server.
Principle of Layer 4 switching: The fourth layer of OSI model is the transport layer. The transport layer is responsible for end-to-end communication, that is, coordinating the communication between the network source and the target system. In the IP protocol stack, this is the protocol layer where TCP (a transport protocol) and UDP (user datagram protocol) are located.
In the fourth layer, TCP and UDP headers contain port numbers, which can uniquely distinguish which application protocols (such as HTTP and FTP). ) Each package contains. The endpoint system uses this information to distinguish the data in the packet, especially the port number, so that the receiving computer system can determine the type of IP packet it receives and hand it over to the appropriate advanced software. The combination of port number and device IP address is usually called socket. The port numbers between 1 and 255 are reserved, and they are called well-known ports, that is, these port numbers are the same in all host TCP/I P protocol stack implementations. In addition to well-known ports, standard UNIX services are allocated in the range of 256 to 1024, and custom applications generally allocate port numbers above 1024. The list of assigned port numbers can be found on the numbers assigned by RFC 1700.
Additional information provided by TCP/UDP port numbers can be used by network switches, which is the basis of Layer 4 switching. A switch with Layer 4 functionality can act as a virtual IP(VIP) front end connected to a server. Each server and server group that supports a single or public application is configured with a VIP address. This VIP address is sent out and registered in the domain name system. When sending a service request, the Layer 4 switch identifies the beginning of the session by judging the beginning of TCP. Then, it uses complex algorithms to determine the best server to handle the request. After making this decision, the switch associates the session with a specific IP address and replaces the VIP address on the server with the real IP address of the server.
Each Layer 4 switch keeps a connection table of source IP addresses and source TCP ports that match the selected server. The Layer 4 switch then forwards the connection request to the server. All subsequent packets will be remapped and forwarded between the client and the server until the switch discovers the session. In the case of using Layer 4 switching, access can be connected with real servers to meet the rules set by users, such as making each server have equal access times or allocating transport streams according to the capacity of different servers.
How to choose the right Layer 4 switch?
1) speed
In order to play a role in an enterprise network, Layer 4 switching must provide performance comparable to that of Layer 3 wire-speed routers. That is, Layer 4 switching must run at full speed on all ports, even on multiple Gigabit Ethernet connections. Gigabit Ethernet speed is equal to the maximum speed of 1488000 packets per second (assuming the worst case, that is, all packets are the minimum size defined by Ethernet and the length is 64 bytes).
2) Server capacity balancing algorithm
According to the expected size of the capacity balancing interval, there are many algorithms for the Layer 4 switch to allocate applications to the server, such as simply detecting the nearest connection of the loop, detecting the loop delay or detecting the closed-loop feedback of the server itself. Among all the predictions, closed-loop feedback provides the most accurate detection reflecting the existing traffic of the server.
3) Table capacity
It should be noted that switches used for Layer 4 switching need to have the ability to distinguish and store a large number of sent items. This is especially true when the switch is at the core of the enterprise network. Many Layer 2/Layer 3 switches tend to send tables that are proportional to the number of network devices. For Layer 4 switches, this number must be multiplied by the number of different application protocols and sessions used in the network. Therefore, the size of the sending table increases rapidly with the increase of the number of endpoint devices and application types. Designers of Layer 4 switches need to consider the addition of this table when designing their products. Large table capacity is very important for manufacturing high-performance switches that can send Layer 4 traffic at line speed.
4) Redundancy
Layer 4 switch has the function of supporting redundant topology. When the network card with dual links is fault-tolerant, a completely redundant system can be established from the server to the network card, link and server switch.
Management mode of network management switch
Network management switches can be managed in the following ways: through RS-232 serial port (or parallel port), through web browser and through network management software.
1. Management through serial port
Network management switches have serial cables for switch management. First, insert one end of the serial cable into the serial port on the back of the switch, and the other end into the serial port of an ordinary computer. Then turn on the switch and the computer power. "HyperTerminal" program is provided in Windows 98 and Windows 2000. After opening the HyperTerminal and setting the connection parameters, you can interact with the switch through the serial cable, as shown in figure 1. This method does not occupy the bandwidth of the switch, so it is called "out of band".
In this management mode, the switch provides a menu-driven console interface or a command line interface. You can use the "Tab" key or arrow keys to browse menus and submenus, press Enter to execute corresponding commands, or use a dedicated switch management command set to manage switches. Different brands of switches have different command sets, and even switches of the same brand have different commands. Using menu commands is more convenient in operation.
2. Manage through the network
Switches managed by the network can be managed through the Web (web browser), but IP addresses must be assigned to the switches. This IP address has no other purpose than managing the switch. By default, the switch does not have an IP address, and you must specify an IP address through a serial port or other means before you can enable this management mode.
When using a Web browser to manage a switch, the switch is equivalent to a Web server, but the web pages are not stored in the hard disk, but in the NVRAM of the switch, and the web programs in NVRAM can be upgraded through programs. When the administrator enters the IP address of the switch in the browser, the switch sends the web page to the computer like a server, giving you a feeling of visiting the website, as shown in Figure 2. This method occupies the bandwidth of the switch, so it is called "in-band management".
If you want to manage the switch, just click the corresponding function item in the webpage and change the switch parameters in the text box or drop-down list. Web management can be carried out on local area network, so remote management can be realized.
3. Manage through network management software
Network management switches all follow SNMP (Simple Network Management Protocol), which is a set of network equipment management specifications in line with international standards. All devices following SNMP protocol can be managed by network management software. You only need to install a set of SNMP network management software on a network management workstation, and you can easily manage switches, routers, servers and so on on the network through the LAN. The interface of network management software through SNMP is shown in Figure 3, which is also an in-band management mode.
Network management switches can be managed in the above three ways. Which way should we adopt? When the switch is initially set up, it must usually be managed out of band; After setting the IP address, you can use the in-band management mode. In-band management can realize remote management because the management data is transmitted through the local area network used by the public, but the security is not strong. Out-of-band management is through serial communication, and data is only transmitted between the switch and the management computer, so it is very safe. However, due to the limitation of serial cable length, remote management cannot be realized. Therefore, which method to adopt depends on your requirements for security and manageability.