Routers and switches

Source: Internet
Author: User

Routers and switches

Computer networks are often connected by a number of different types of network interconnection. If several computer networks are physically connected and not able to communicate between them, then this "interconnection" is of little practical significance. So often when it comes to "interconnection", it has been hinted that these interconnected computers can communicate, that is to say, functionally and logically, these computer networks have formed a large computer network, or the Internet.

Connecting networks to each other to use some intermediate devices (or intermediate systems), the term ISO is called a trunking system (relay). Depending on the hierarchy of the trunking system, there are five types of relay systems available:

    1. The physical layer (that is, the first layer, the layer L1) relay system, namely the transponder (repeater);
    2. The data link layer (i.e. the second layer, layer L2), which is the bridge or bridge;
    3. Network layer (third layer, layer L3) relay system, namely router (router);
    4. The mixture of bridges and routers (Brouter) has the function of bridge and router;
    5. A relay system above the network layer, which is the gateway .

When a relay system is a forwarder, it is generally not called a network interconnection, because it is just a network expansion, and this is still a network. High-level gateways are more complex and are currently used less. Therefore, the general discussion of network interconnection refers to the use of switches and routers to interconnect the network, this paper mainly describes the switch and routers and their differences.

"Switching" is one of the most frequently occurring words in the network today, from bridging to routing to ATM to telephone systems, and can be applied in any situation, making it unclear what the real exchange is. In fact, the word Exchange first appeared in the telephone system, specifically to achieve the two different telephones between the voice signal exchange, the completion of the work of the device is a telephone switch. Therefore, in the original sense, Exchange is only a technical concept, that is, the completion of the signal from the device inlet to exit forwarding. As a result, a device that conforms to that definition can be called a switching device . Thus, "Exchange" is a broad term, when it is used to describe the data link layer (L2) device, actually refers to a bridge device, and when it is used to describe the network layer (L3) of the device, but also refers to a routing device.

The Ethernet switch that we often talk about is actually a multi-port data Link layer network device based on bridge technology, which provides low-latency, low-overhead access to the forwarding of data frames from one port to another. The switch has a very high bandwidth back bus and an internal switching matrix. All the ports on the switch are hooked up on the back bus, and after the control circuit receives the packet, the processing port looks in the in-memory address table to determine which port the NIC (NIC) of the destination Mac (the hardware address of the network card) is hooked on, and the internal switch fabric quickly transmits the packet to the destination port. The destination MAC broadcasts to all ports (ARP protocol) if it does not exist, and after the receive Port responds the switch "learns" the new address and adds it to the internal MAC address table. using a switch can also "segment" The network, by comparing the MAC Address table, the switch only allows the necessary network traffic through the switch. Through the filtering and forwarding of the switch, it can effectively isolate the broadcast storm, reduce the occurrence of the mistake packet and the error packet, avoid the sharing conflict.

The switch can transmit data between multiple port pairs at the same time. Each port can be treated as a separate network segment, and the network devices connected to it enjoy full bandwidth on their own without competing with other devices. When node A sends data to node D, node B can send data to node C at the same time, and the two transports all have their own virtual connection with all the bandwidth of the network. If this is a 10Mbps Ethernet switch, then the total flow of the switch is equal to 2x10mbps=20mbps, and the total flow of a hub will not exceed 10Mbps when using the 10Mbps shared hub.

In a word, the switch is a kind of network device which can complete the packet forwarding function based on MAC address recognition. The switch can "learn" the MAC address and store it in the internal Address table, by establishing a temporary switching path between the originator of the data frame and the target receiver, so that the data frame is directly from the source address to the destination site.

Routers are packet switching devices (or network layer relay devices) in the network layer of the OSI protocol model, and the basic function of routers is to transmit data (IP packets) to the correct network, including:

    1. The forwarding of IP datagrams, including the search and transmission of datagrams;
    2. Subnet isolation, suppress broadcast storms;
    3. The maintenance route is based on the table, and the routing information is exchanged with other routers, which is the basis of IP message forwarding;
    4. Error handling of IP datagram and simple congestion control;
    5. Realize the filtering and accounting of IP datagram;

In general, information passes through at least one or more intermediate nodes during routing. Typically, people compare routes and exchanges, mainly because the functions that the two have implemented are identical to those of ordinary users. In fact, the main difference between routing and switching is that the interchange takes place in the L2 layer (the Data link layer) of the OSI Reference Model, and the routing occurs at the L3 layer (the network layer). This difference determines that routing and switching need to use different control information in the process of moving information, so the two ways of implementing their respective functions are different.

Inside the router, there is a routing table indicating where to go next if you are going somewhere. The router receives a packet from a port, it first removes the header of the link layer (unpacking), reads the destination IP address, and then finds the routing table, and if it can determine where to send the next step, add the packet header (package) to the link layer and forward it, if the next address is not determined, Returns a message (ICMP message) to the source address and discards the packet.

Routing technology is actually composed of two most basic activities, that is, determining the optimal path and transmitting packets. The transmission of packets is relatively simple and straightforward, and the routing is more complicated. Routing algorithms write different kinds of information in the routing table, and the router sends the packet to the next router that can reach the destination by selecting the best path according to the destination to which the packet is to arrive. The next time a router receives the packet, it also looks at its destination address and continues to be routed to the rear router using the appropriate path. And so on until the packet reaches the final destination.

Routers can communicate with each other, and they can maintain their own routing tables by transmitting different types of information. Routing update information The main is such a kind of information, generally consists of some or all of the routing table. By analyzing routing update information issued by other routers, routers can master the topology of the entire network. Link state broadcast is another kind of information transmitted between routers, it can send the information to the link state and incoming notification to other routers.

The above mentioned switch works on the L2 layer, the router works on the L3 layer, and the L3 layer switches are described below.

A two-tier switch is a data-link layer device that can read MAC address information from a packet and exchange it based on the MAC address. There is an address table inside the two-tier switch that indicates the correspondence between the MAC address and the switch port. When the switch receives a packet from a port, it first reads the source MAC address in the header so that it knows which port the source MAC address is attached to, and then reads the destination MAC address in the header and finds the appropriate port in the Address table, if the table has a port corresponding to that destination MAC address. The packet is copied directly to the port, if the table can not find the corresponding port to broadcast the packet to all ports, when the destination machine responds to the source machine, the switch may learn the destination MAC address and which port corresponding to the next time the data transfer will not need to broadcast all the ports. This is how a two-tier switch establishes and maintains its own table of addresses. Since the two-layer switch generally has a wide switching bus bandwidth, it is possible to exchange data for many ports at the same time. If the two-tier switch has n ports and the bandwidth of each port is M, and its switch bus bandwidth exceeds NXM, then the switch can implement wire-speed switching. The two-tier switch makes no restrictions on the broadcast packet and copies the broadcast packet to all ports.

a device with a third-layer switching capability is a second-tier switch with a third-tier routing capability , but it is an organic combination of the two, not simply the hardware and software of the router device are simply superimposed on the LAN switch.

From the hardware, the interface module of the second layer switch is the high speed Backplane/bus (up to dozens of gbit/s) Exchange data, in the third layer switch, router-related third-tier routing hardware modules are also plugged in the high-speed backplane/bus, This way, the routing module can exchange data with other modules that need to be routed, thus breaking the traditional interface speed limit of the external router. On the software side, the third layer switch also has the important action, it defines the traditional software-based router software. The practice is to:

    • For packet forwarding: such as IP/IPX packet forwarding, these rules of the process through the hardware to achieve high-speed;
    • For the third layer of routing software: such as routing information update, routing table maintenance, routing calculation, routing determination and other functions, with optimized, efficient software implementation.

Assuming that two machines using the IP protocol communicate through a third-tier switch, machine A has a known destination IP address when it starts sending, but is not yet aware of the required MAC address to send on the LAN. Address Resolution (ARP) is used to determine the destination MAC address. Machine A compares its IP address to the destination IP address and extracts the network address from the subnet mask configured in its software to determine whether the destination machine is within the same subnet as itself. If the destination machine B is in the same subnet as machine A, a broadcasts an ARP request, B returns its MAC address, and a gets the MAC address of the destination machine B, caches the address and forwards the data with this MAC address packet, and the second-level switch module looks for the MAC address table to determine the packet to the destination port. If two machines are not in the same subnet, such as send machine A to communicate with the destination machine C, send machine A to the "default gateway" to issue ARP packets, and "default gateway" IP address has been set in the system software. This IP address actually corresponds to the third layer switch module of the third layer. So when send machine A to the "Default gateway" IP address broadcast an ARP request, if the third switch module in the previous communication process has obtained the MAC address of the destination machine C, then send machine a reply to the MAC address of C; otherwise the third Layer switch module broadcasts an ARP request to the destination machine based on the routing information , the purpose machine C obtains this ARP request to the third Layer Exchange module to reply its MAC address, the third Layer Exchange module saves this address and replies to send machine A. Later, when the packet between A and C is forwarded, it will be encapsulated with the MAC address of the final destination machine, the data forwarding process is all handed to the second layer Exchange processing, the information can be exchanged at high speed. The so-called one-way, multiple exchanges.

The third layer switches have the following outstanding features:

    1. The combination of organic hardware makes data exchange accelerate;
    2. The optimized routing software makes the routing process more efficient.
    3. In addition to the necessary routing decision process, most of the data forwarding process is processed by the second layer;
    4. The interconnection of multiple subnets is only a logical connection with the third Layer switch module, and does not need to increase the port as the traditional external router, which protects the user's investment.

Routers and switches

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.