The difference between switching and routing

Source: Internet
Author: User

Simply put: The switch is used to share a network cable and the router is used to share an IP.
In other words, if you want to pick up a few computers on a network cable, you must use the switch; if you have only one IP, think of a few computers on the Internet, you need to use a router to solve.
For example, broadband routers can let the home of several computers share the same account online;
In the case of sharing the Internet, a room has only one cable, there are many computers to surf the internet, with the switch
The primary function of routers is to separate subnets.

1. The Ethernet switch we often talk about is actually a multi-port second-tier 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 internal core of the switch has a switch matrix that provides a path for communication between any two ports, or a fast switching bus to allow data frames received by any port to be sent from other ports.

2. While routers are packet switching devices (or network layer relay devices) in the network layer of the OSI protocol model, the basic function of routers is to transmit data (IP packets) to the correct network.

On the backbone, the main function of routers is routing. The router on the backbone network must know the path to reach all the downlevel networks. This requires maintaining a large routing table and responding as quickly as possible to changes in the state of the connection. The failure of the router will cause serious information transmission problems.

In the regional network, the main role of routers is network connectivity and routing, that is, connecting the lower layers of the basic network units-campus network, but also responsible for data transmission between the lower layer network.

Within the campus network, the main function of routers is to separate subnets. The early interconnection base unit was the local area network (LAN), where all the hosts were in the same logical network. With the expansion of network scale, the LAN is transformed into a campus network composed of multiple subnets connected by high-speed backbone and routers. Where subnets are logically independent, and routers are the only devices that can separate them, it is responsible for message forwarding and broadcast isolation between subnets, and routers on the border are responsible for connecting to the upper-level network.

3. The main difference between the two is:

1. Different levels of work

The initial switch is the data link layer that works in the OSI/RM open architecture, which is the second tier, and the router is designed to work at the network layer of the OSI model at the outset. Since the switch works in the second layer of the OSI (data link layer), it works relatively simple, and the router works in the third layer of the OSI (Network layer), can get more protocol information, the router can make a more intelligent forwarding decision.

2, Loop: Based on the switch address learning and station table establishment algorithm, the switch does not allow the existence of loops. Once the loop is present, the spanning tree algorithm must be started to block the port that generated the loop. The router's routing protocol does not have this problem, there can be multiple paths between routers to balance the load, improve reliability.

3, subnetting: The switch can only recognize the MAC address. The MAC address is a physical address and has a flat address structure, so you can't divide subnets by MAC addresses. While the router recognizes the IP address, the IP address is assigned by the network administrator, is the logical address and the IP address has a hierarchy, is divided into network number and host number, can be easily used to divide the subnet, the main function of the router is to connect to different networks.

4. Load concentration: There can only be one path between the switches, so that the information is concentrated on a communication link and cannot be dynamically allocated to balance the load. While the router routing protocol algorithm can avoid this, the OSPF routing protocol algorithm can not only produce multiple routes, but also can choose the best route for different network applications.

5, broadcast control: The switch can only narrow the conflict domain, but not to narrow the broadcast domain. The entire switched network is a large broadcast domain, broadcast messages scattered over the entire switched network. While routers can isolate broadcast domains, broadcast messages cannot continue to be broadcast through the router.

6, media-Related: The switch as a bridge device can also complete the transformation between the different link layer and the physical layer, but this conversion process is more complex, not suitable for ASIC implementation, it is bound to reduce the switch forwarding speed. As a result, the switch mainly accomplishes the network interconnection of the same or similar physical media and link protocol, and it is not used to interconnect between the physical media and the network of the link layer protocol. Routers are different, it is mainly used for interconnection between different networks, so can connect different physical media, Link layer Protocol and Network Layer protocol network. Although the router occupies the advantage in function, it is expensive and the message forwarding speed is low.

7, security issues: Although the switch can also be based on the source MAC address of the frame, the destination MAC address and other frames to filter the frame, but the router based on the source IP address of the message, Destination IP address, TCP port address and other content to filter the message, more intuitive and convenient.

The difference between switching and routing

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.