The difference of layer four switch of three layer switch of two layer switch _ network communication

Source: Internet
Author: User
Tags switches domain name server
Two-layer switching technology is a mature development, two-layer switch is a data link layer device, can identify the Mac in the packet
Address information, forwarding based on MAC addresses, and recording these MAC addresses with corresponding ports in one of their own.
Address table. The specific work flow is as follows:

(1) When the switch receives a packet from a port, it first reads the source MAC address in the header so that it knows
The source MAC address of the machine is connected to which port;

(2) to read the destination MAC address in the header and find the corresponding port in the Address table;

(3) If there is a port corresponding to the MAC address in the table, copy the packet directly onto the port;

(4) If the table can not find the corresponding port, the packet broadcast to all ports, when the purpose of the machine to the source machine response
, the switch can learn a destination MAC address and which port corresponds to, the next time the data transfer will no longer need to
There's a port to broadcast.

The continuous cycle of this process, for the whole network of MAC address information can be learned, the two-tier switch is to build and
Maintain its own Address table.

The following three points can be inferred from the working principle of the two-layer switch:

(1) because the switch to the majority of port data exchange, this requires a very wide exchange bus bandwidth,
If the two-tier switch has n ports, the bandwidth of each port is M, and the switch bus bandwidth is over NXM, then this exchange
Machine can be achieved wire speed exchange;

(2) Learning port connected to the MAC address of the machine, write Address table, Address table size (generally two ways:
One is Beffer RAM, one is the Mac table entry value, the Address table size affects the access capacity of the switch;

(3) Another is that a two-tier switch typically contains an ASIC specifically designed to handle packet forwarding (Applicati
On specific integrated circuit) chip, so the forwarding speed can be done very quickly. Due to the various manufacturers
The use of ASIC is different, which directly affects the product performance.

The above three points are also the main technical parameters to evaluate the performance of the two or three-layer switch, please consider the equipment selection
When you pay attention to comparison.

(ii) Routing technology

The router works in the third layer of the OSI model---network layer operation, which is similar to the two-tier exchange, but the router worker
In the third layer, this distinction determines that routing and switching use different control information when delivering packages, and that the implementation of the function
Style is different. The principle is that there is also a table inside the router, which is labeled if you want to go to a certain place
Side, the next step should be to go there, if you can find the packet from the routing table the next step is to take the link layer information
Plus forwarding out; If you don't know where to go next, discard the package and return a message to the source

Routing technology is essentially two functions: determining the optimal Routing and forwarding of packets. Write various information in the routing table
, the routing algorithm calculates the best path to the destination, and then sends the data by a relatively simple and direct forwarding mechanism.
Package. The next router that accepts the data continues forwarding in the same way, and so on until the packet arrives
Destination router.

There are also two different ways to maintain the routing table. One is the update of routing information, which routes some or all of the
Information is released, routers learn the routing information from each other, then they master the topology of the whole network, and this kind of routing
The protocol is called the distance vector routing protocol, and the other is that the router broadcasts its own link state information by
Learn to master the routing information of the whole network, and then calculate the best forwarding path, this kind of routing protocol is called link State Route

Because routers need to do a lot of path computing work, the general processor's ability to work directly determines the quality of its performance.
Of course, this judgment on the middle and low-end routers, because high-end routers often use a distributed processing system system to set

(iii) Three-tier switching technology

In recent years, three-tier technology publicity, ears can play cocoon, shouting three-tier technology everywhere, some people say it is a very
New technology, some people say, three-tier exchange, is not the router and the two-tier switch stack, there is no new
Thing, is that true? Let's start with a simple network to see how the three-tier switch works.

The network is relatively simple

Device a------------------------three-tier switch using IP------------------------IP
Equipment b

For example, a to send data to B, known destination IP, then a subnet mask to obtain the network address, determine whether the destination IP and
Himself on the same network segment.

If you are on the same network segment but do not know the MAC address required to forward the data, a sends an ARP request and B returns to its Mac
Address, a with this MAC package packet sent to the switch, switch to use the two-tier switching module, look up the Mac table, will
The packet is forwarded to the appropriate port.

If the destination IP address is not the same network segment, then a to implement communication with B, there is no corresponding in the stream cache entry
MAC address entry, the first normal packet is sent to a default gateway, which is typically in the operating system
has been set up, corresponding to the third-tier routing module, so it is visible for data that is not the same subnet, first in the Mac table
is the MAC address of the default gateway, and then the three-tier module receives the packet and queries the routing table to determine the
Route, a new frame header is constructed, where the MAC address of the default gateway is the source MAC address, and the MAC address of Host B
As the destination MAC address. The corresponding relation between the MAC address of host A and B and the port of the transmitter is established by certain trigger mechanism.
, and record the Entry table of the stream cache, then the data from A to B will be directly handed over to the two-layer switching module. It's going to make sense.
It is often said that a route is forwarded more than once.

The above is a simple summary of the working process of the three-layer switch, you can see the characteristics of the three-layer exchange:

High-speed forwarding of data is realized by hardware combination.

This is not a simple two-tier switch and router overlay, three-tier routing module directly superimposed on the two-layer switched high-speed back
On board bus, the interface rate limit of traditional router is broken, and the rate is up to dozens of gbit/s. Calculate the back plate bandwidth, which
Some are two important parameters for three-layer switch performance.

Simple routing software simplifies the routing process.

Most of the data forwarding, in addition to the necessary routing options to the Routing software processing, are two-tier module high-speed forwarding,
Most of the routing software is processed and efficient optimization software, not simply copying the software in the router.


A two-tier switch is used for small local area networks. This is needless to say, in a small LAN, the broadcast packet has little impact
, the fast switching function of the two-layer switch, multiple access ports and low modest price provide a perfect

The advantage of the router is that it is rich in interface type, powerful in three layers, powerful in routing, and suitable for large
Routing between networks, which has the advantage of choosing the best route, load sharing, link backup and routing with other networks
The exchange of information and so on routers have functions.

The most important function of the three-layer switch is to speed up the rapid forwarding of data within the large local area network, and to join the routing function
is served for this purpose. If the large network according to the Department, geographical and other factors into a small LAN,
This will lead to a large number of Internet exchange visits, the simple use of two-tier switches can not achieve Internet access; such as simple use of routing
, due to the limited number of interfaces and slow forwarding speed, the speed and network size of the network will be limited, with routing
Features fast forwarding of the three-tier switch becomes preferred.

In general, in the intranet data flow is large, require fast forwarding response network, such as all by the three-tier switch to do this
Work, the three-tier switch will be overloaded, the response speed will be affected, routing between the network to the router to complete
, give full play to the advantages of different equipment, is a good networking strategy, of course, if the customer's purse is very drum,
Otherwise, the next step, let the three-tier switch also for the Internet interconnection.

A simple definition of the fourth-tier exchange is that it is a function that determines that the transmission is not based solely on the MAC address (the second-tier network
Bridge) or source/destination IP address (third-tier routing), and the port number is applied based on TCP/UDP (layer fourth). Layer Fourth Exchange work
Can be like a virtual IP, pointing to the physical server. It transmits a variety of business compliance protocols, with HTTP, FTP, NFS
, Telnet, or other protocol. These services require a complex load balancing algorithm based on the physical server. In the IP world
Domain, the service type is determined by the terminal TCP or UDP port address, and the application interval in the fourth layer exchange is determined by the source and end
The End-to-end IP address, TCP, and UDP ports are collectively determined.
A virtual IP address (VIP) is set up for each server group for search in layer fourth exchange, with each group of servers supporting
Some kind of application. Each application server address stored in the Domain name server (DNS) is a VIP, not a real service
The address of the device.
When a user applies for an application, a VIP connection request (such as a TCP SYN packet) with the target server group is sent
to the server switch. The server switch selects the best server in the group, and the VIP in the terminal address is served by the actual service
IP, and pass the connection request to the server. In this way, all packets in the same interval are mirrored by the server switch
, and transmits between the user and the same server.
The principle of layer fourth exchange
The fourth layer of the OSI model is the transport layer. The transport layer is responsible for end-to-end communication, that is, coordination between the network source and the target system
Communication. In the IP protocol stack, this is the protocol layer where TCP (a transport Protocol) and UDP (User Packet protocol) reside.

In layer fourth, the TCP and UDP headers contain the port number (portnumber), which can uniquely differentiate each packet
which application protocols (such as HTTP, FTP, and so on) are included. The endpoint system uses this information to differentiate the data in the packet, especially
is a port number that enables a receiving computer to determine the type of IP packet it receives and hand it over to the appropriate high-level
Software. The combination of port number and device IP address is often referred to as "socket".
The port number between 1 and 255 is reserved, they are called "familiar" ports, that is, in all hosts tcp/i

In the P protocol stack implementation, these port numbers are the same. In addition to the "familiar" port, standard UNIX services are allocated at 256 to
1024-port range, custom applications typically allocate port numbers above 1024.
The most recent list of allocation port numbers can be found on the RFc1700 "Assigned Numbers". TCP/UDP End

The additional information provided by the slogan can be used by the network switch, which is the basis of layer 4th exchange.
Examples of "familiar" port numbers:

Apply Protocol port number
FTP 20 (data)
21 (Control)
NNTP 119
162 (SNMP traps)
The additional information provided by the TCP/UDP port number can be used by the network switch, which is the basis of layer fourth exchange.

A switch with layer fourth functionality can function as a front-end to the "Virtual IP" (VIP) connected to the server.

Each server and server group that supports a single or universal application is configured with a VIP address. This VIP address is sent out
Go and register on the domain Name System.
When a service request is issued, layer fourth switches to identify the start of a session by determining TCP start. and
It uses complex algorithms to determine the best server to process this request. Once this decision is made, the switch will
The session is associated with a specific IP address and replaces the VIP location on the server with the server's real IP address

Each layer fourth switch saves a source IP address that matches the selected server and the source TCP port phase

The associated table of connections. Then layer fourth switches forward the connection request to this server. All subsequent packages in the client with the suit
, until the switch discovers the session.
In the case of layer fourth exchange, access can be connected to a real server to meet user-made rules
, such as having an equal number of accesses on each server or allocating a transport stream based on the capacity of different servers.

How to choose the right layer fourth exchange
A, speed
In order to be effective in the enterprise network, layer fourth Exchange must provide performance comparable to the third-tier wire-speed routers. Also
That is, layer fourth Exchange must operate at full media speed on all ports, even on multiple gigabit Ethernet connections
So. Gigabit Ethernet speeds are equal to the maximum speed of 1.488 million packets per second (assuming the worst-case scenario, that is,
The minimum size for all packets, and the net definition, is 64 bytes long.
b, server capacity balance algorithm

Depending on the size of the desired capacity balance interval, layer fourth switches will apply many of the algorithms assigned to the server.
There is a simple detection loop of the nearest connection, detection of loop delay or detection of the server itself closed loop feedback. In all the pre
In the survey, closed-loop feedback provides the most accurate detection of the server's existing business volume.
C, table capacity
It should be noted that switches for layer fourth Exchange require the ability to differentiate and store a large number of send table entries. Switch
This is especially true at the heart of an enterprise network. Many second/three-tier switches tend to send table sizes with network device
Quantity is proportional. For layer fourth switches, this number must be multiplied by the number of different application protocols and sessions used in the network
Amount As a result, the size of the sending table grows rapidly as the number of endpoint devices and application types grows. Layer Fourth Switch design
You need to consider this growth of the table when designing its products. Large table capacity to send fourth level traffic to manufacturing support wire speed
High-performance switches are critical.
D, redundancy
The layer fourth switch has the capability to support redundant topologies internally. When you have a De Chinglu network card Fault-tolerant connection, you can
can establish a complete redundancy system from a server to a network adapter, link, and server exchanger.

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: 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.