Computer networks are often made up of many different types of network interconnections. If several computer networks are just physically connected together and cannot communicate between them, then this "interconnection" has little practical significance. Therefore, when talking about "interconnection", it is generally implied that these interconnected computers can communicate, that is, from a functional and logical perspective, these computer networks have formed a large computer network, or called the Internet, or simply called the Internet or the Internet.
Connecting the networks to each other requires some intermediate devices (or intermediate systems), which is called relay systems in ISO. Depending on the level where the relay system is located, there can be the following five relay systems:
1. The physical layer (that is, the first layer, layer L1) relay system, that is, the repeater.
2. Data link layer (i.e. the second layer, layer L2), that is, bridge or bridge.
3. Network layer (third layer, layer L3) relay system, that is, router.
4. The hybrid bridge and router bridge (brouter) has the functions of bridge and router.
5. A relay system above the network layer, that is, a gateway.
When the relay system is a forwarder, it is generally not called network interconnection, because this is just expanding a network, and this is still a network. High-level gateways are currently used less due to their complexity. Therefore, when discussing network interconnection, it refers to a network that uses switches and routers to interconnect. This article mainly explains the differences between switches and routers.
2. Switches and routers
"Switch" is the most frequently seen word in the network today. From bridge to routing to ATM to telephone system, it can be applied in any occasion, and it is hard to figure out what the real exchange is. In fact, the term exchange first appeared in the telephone system, specifically refers to the exchange of voice signals between two different telephones. The device that completes the work is the telephone switch. Therefore, in its original meaning, exchange is just a technical concept, that is, the forwarding of signals from the inlet to the outlet of the equipment is completed. Therefore, all devices that are and comply with this definition can be referred to as switching devices. It can be seen that "switch" is a broad term. When it is used to describe the device in the second layer of the data network, it actually refers to a bridge device; when it is used to describe the device in the third layer of the data network, it also refers to a routing device.
The Ethernet switch we often talk about is actually a multi-port layer 2 network device based on bridge technology, which provides low latency and low overhead paths for forwarding data frames from one port to another.
It can be seen that there should be a switching matrix at the core of the switch, which provides a path for communication between any two ports, or a fast switching bus to enable data frames received by any port to be sent out from other ports. In actual devices, the function of the matrix is often accomplished by a dedicated chip (ASIC). In addition, there is an important assumption in the design idea of Ethernet switches, that is, the speed of the exchange core is so fast that the usual large-traffic data will not cause it to be congested. In other words, the switching capability is infinite relative to the amount of information transmitted (in contrast, the design idea of ATM switches is that the switching capability is limited compared to the amount of information transmitted).
Although Ethernet Layer 2 switches are developed based on multi-port bridges, switches have richer features, which not only make them the best way to obtain more bandwidth, but also make the network easier to manage.
The router is a packet switching device (or network layer relay device) in the network layer of the OSI protocol model. The basic function of the router is to transmit data (IP packets) to the correct network, including:
1. Forwarding of IP datagrams, including path search and transmission of datagrams;
2. Subnet isolation to curb broadcast storms;
3. Maintain the routing table and exchange routing information with other routers, which is the basis for IP message forwarding.
4. Error processing and simple congestion control of IP datagrams;
5. Implement filtering and accounting of IP datagrams.
For networks of different sizes, the focus of the role of routers varies.
On the backbone network, the main function of a router is routing. The router on the backbone network must know the path to all lower-layer networks. This requires maintaining a huge routing table and responding as quickly as possible to changes in connection states. A router failure will lead to serious information transmission problems.
In regional networks, the main function of routers is network connection and routing, that is, connecting to each lower-level grassroots network unit - the park network, and at the same time being responsible for data forwarding between lower-level networks.
Within the campus network, the main function of the router is to separate the subnets. The early grassroots units of the Internet were local area networks (LAN), where all hosts were in the same logical network. As the network scale continues to expand, the local area network has evolved into a campus network composed of multiple subnets connected by high-speed backbone and router. Among them, the subnet is logically independent, and the router is the only device that can separate them. It is responsible for packet forwarding and broadcast isolation between subnets, and the router on the boundary is responsible for connecting to the upper-layer network.
3. The difference between a second layer switch and a router
Traditional switches developed from bridges and belong to the second layer of OSI, namely the data link layer equipment. It is addressed according to the MAC address, and the route is selected through the station table, and the establishment and maintenance of the station table are automatically carried out by the switch. The router belongs to the third layer of OSI, namely the network layer device. It is addressed according to the IP address and is generated through the routing table routing protocol. The biggest advantage of a switch is its fastness. Since the switch only needs to identify the MAC address in the frame, it directly generates the selection forwarding port based on the MAC address. The algorithm is simple and easy to implement ASIC, so the forwarding speed is extremely high. But the working mechanism of the switch also brings some problems.
1. Loop: Based on the switch address learning and station table establishment algorithm, loops are not allowed between switches. Once a loop exists, the spanning tree algorithm must be started to block the port of the generating loop. The router's routing protocol does not have this problem. There can be multiple channels between routers to balance the load and improve reliability.
2. Load concentration: There can only be one path between switches, so that the information is concentrated on a communication link and cannot be dynamically allocated to balance the load. The router's routing protocol algorithm can avoid this. The OSPF routing protocol algorithm can not only generate multiple routes, but also select different optimal routes for different network applications.
3. Broadcast Control: The switch can only narrow the conflict domain, but cannot narrow the broadcast domain. The entire switched network is a large broadcast domain, and broadcast messages are scattered across the entire switched network. The router can isolate the broadcast domain, and broadcast messages cannot be broadcasted through the router.
4. Subnet division: The switch can only recognize MAC addresses. MAC addresses are physical addresses and adopt flat address structures, so molecular networking cannot be divided according to MAC addresses. The router recognizes the IP address. The IP address is assigned by the network administrator. It is a logical address and the IP address has a hierarchical structure, divided into network numbers and host numbers, which can be easily used for dividing the network. The main function of the router is to connect to different networks.
5. Confidentiality issue: Although the switch can filter frames based on the source MAC address, destination MAC address and other contents of the frame, the router filters the packets based on the source MAC address, destination IP address, TCP port address and other contents of the packet, which is more intuitive and convenient.
6. Media Relevance: As a bridge device, a switch can also complete the conversion between different link layers and physical layers, but this conversion process is relatively complicated and is not suitable for ASIC implementation, which will inevitably reduce the forwarding speed of the switch. Therefore, currently, switches mainly complete network interconnection of the same or similar physical media and link protocols, and will not be used to interconnect between networks with very different physical media and link layer protocols. The router is different. It is mainly used to interconnect between different networks, so it can connect networks with different physical media, link layer protocols and network layer protocols. Although routers have an advantage in function, they are expensive and have low packet forwarding speed.
In recent years, switches have made many improvements to improve performance, the most prominent of which are virtual networks and layer three switching.
Demarcation networks can narrow the broadcast domain and reduce the impact of broadcast storms on the network. Each interface of the router is connected to a subnet, and broadcast packets cannot be broadcasted through the router. Subnets connected to different interfaces of the router belong to different subnets, and the subnet range is physically divided by the router. For switches, each port corresponds to a network segment. Since the subnet is composed of several network segments, the combination of switch ports can be logically divided into the network. Broadcast messages can only be broadcast within the subnet and cannot be spread to other subnets. By reasonably dividing logical subnets, the purpose of controlling broadcasting is achieved. Since the logical subnet is arbitrarily combined by switch ports and has no physical correlation, it is called a virtual subnet, or a virtual network. Virtual network technology solves the problem of isolation of broadcast packets without a router, and the network segments in the virtual network have nothing to do with their physical location, that is, adjacent network segments can belong to different virtual networks, while two network segments that are far apart may belong to different virtual networks, while two network segments that are far apart may belong to the same virtual network. Terminals in different virtual networks cannot communicate with each other, which enhances access control of data within the network.
Switches and routers are the contradiction between performance and function. Switches switches are fast, but their control functions are weak, and routers have strong control performance, but their packet forwarding speed is slow. The latest technology to solve this contradiction is layer three switching, which has both the switch's linear-speed forwarding capabilities and the router's good control functions.
4. The difference between a third-layer switch and a router
Before the advent of Layer 3 switching technology, it was almost unnecessary to distinguish routing functional devices from routers. They were exactly the same: providing routing functionality is working on routers, however, Layer 3 switches are now fully capable of performing most of the functions of traditional routers. As a network interconnect device, the third layer switch has the following characteristics:
1. Forwarding service flow based on layer 3 addresses;
2. Fully exchange function;
3. Special services can be completed, such as message filtering or authentication;
4. Execute or not perform routing processing.
Compared with traditional routers, the third layer switch has the following advantages.:
1. The transmission bandwidth between subnets can be arbitrarily allocated: each interface of a traditional router is connected to a subnet, and the rate at which the subnet transmits through the router is limited by the bandwidth of the interface. Layer 3 switches are different. They can define multiple ports as a virtual network, and use a virtual network composed of multiple ports as a virtual network interface. The information in the virtual network can be sent to the Layer 3 switch through the ports that make up the virtual network. Since the number of ports can be specified arbitrarily, there is no limit on the transmission bandwidth between subnets.
2. Rationally configure information resources: Since there is no difference between accessing resource rates in the subnet and accessing resource rates in the global network, setting up a separate server in the subnet is not very meaningful. By setting up a server group in the global network, it not only saves costs, but also allows you to reasonably configure information resources.
3. Reduce costs: Usually, network design uses switching mechanisms to form subnets and uses routers to interconnect subnets. Currently, the network design of the three-layer switch can be used, which can not only divide any virtual subnets, but also complete inter-subnet communication through the switch's layer three-layer routing function, saving expensive routers.
4. Flexible connection between switches: As switches, there are no loops allowed between them. As routers, there are multiple paths to improve reliability and balance load. Layer 3 switches use spanning tree algorithm to block the ports of the loop, but when routing, they still use the blocked path as optional paths to participate in routing selection.
5 Conclusion
To sum up, switches are generally used for LATAN-WAN connections. The switch belongs to the bridge and is a device in the data link layer. Some switches can also realize the third layer switching. Routers are used for connections between WAN-WAN, which can solve the forwarding of packets between opposite-sex networks and act on the network layer. They just accept input packets from one line and forward them to the other. These two lines may belong to different networks and adopt different protocols. In comparison, the functions of the router are more powerful than those of the switch, but the speed is relatively slow and expensive. The third-layer switch has both the switch's linear-speed forwarding capabilities and the router's good control functions, so it can be broadcasted.
Connecting the networks to each other requires some intermediate devices (or intermediate systems), which is called relay systems in ISO. Depending on the level where the relay system is located, there can be the following five relay systems:
1. The physical layer (that is, the first layer, layer L1) relay system, that is, the repeater.
2. Data link layer (i.e. the second layer, layer L2), that is, bridge or bridge.
3. Network layer (third layer, layer L3) relay system, that is, router.
4. The hybrid bridge and router bridge (brouter) has the functions of bridge and router.
5. A relay system above the network layer, that is, a gateway.
When the relay system is a forwarder, it is generally not called network interconnection, because this is just expanding a network, and this is still a network. High-level gateways are currently used less due to their complexity. Therefore, when discussing network interconnection, it refers to a network that uses switches and routers to interconnect. This article mainly explains the differences between switches and routers.
2. Switches and routers
"Switch" is the most frequently seen word in the network today. From bridge to routing to ATM to telephone system, it can be applied in any occasion, and it is hard to figure out what the real exchange is. In fact, the term exchange first appeared in the telephone system, specifically refers to the exchange of voice signals between two different telephones. The device that completes the work is the telephone switch. Therefore, in its original meaning, exchange is just a technical concept, that is, the forwarding of signals from the inlet to the outlet of the equipment is completed. Therefore, all devices that are and comply with this definition can be referred to as switching devices. It can be seen that "switch" is a broad term. When it is used to describe the device in the second layer of the data network, it actually refers to a bridge device; when it is used to describe the device in the third layer of the data network, it also refers to a routing device.
The Ethernet switch we often talk about is actually a multi-port layer 2 network device based on bridge technology, which provides low latency and low overhead paths for forwarding data frames from one port to another.
It can be seen that there should be a switching matrix at the core of the switch, which provides a path for communication between any two ports, or a fast switching bus to enable data frames received by any port to be sent out from other ports. In actual devices, the function of the matrix is often accomplished by a dedicated chip (ASIC). In addition, there is an important assumption in the design idea of Ethernet switches, that is, the speed of the exchange core is so fast that the usual large-traffic data will not cause it to be congested. In other words, the switching capability is infinite relative to the amount of information transmitted (in contrast, the design idea of ATM switches is that the switching capability is limited compared to the amount of information transmitted).
Although Ethernet Layer 2 switches are developed based on multi-port bridges, switches have richer features, which not only make them the best way to obtain more bandwidth, but also make the network easier to manage.
The router is a packet switching device (or network layer relay device) in the network layer of the OSI protocol model. The basic function of the router is to transmit data (IP packets) to the correct network, including:
1. Forwarding of IP datagrams, including path search and transmission of datagrams;
2. Subnet isolation to curb broadcast storms;
3. Maintain the routing table and exchange routing information with other routers, which is the basis for IP message forwarding.
4. Error processing and simple congestion control of IP datagrams;
5. Implement filtering and accounting of IP datagrams.
For networks of different sizes, the focus of the role of routers varies.
On the backbone network, the main function of a router is routing. The router on the backbone network must know the path to all lower-layer networks. This requires maintaining a huge routing table and responding as quickly as possible to changes in connection states. A router failure will lead to serious information transmission problems.
In regional networks, the main function of routers is network connection and routing, that is, connecting to each lower-level grassroots network unit - the park network, and at the same time being responsible for data forwarding between lower-level networks.
Within the campus network, the main function of the router is to separate the subnets. The early grassroots units of the Internet were local area networks (LAN), where all hosts were in the same logical network. As the network scale continues to expand, the local area network has evolved into a campus network composed of multiple subnets connected by high-speed backbone and router. Among them, the subnet is logically independent, and the router is the only device that can separate them. It is responsible for packet forwarding and broadcast isolation between subnets, and the router on the boundary is responsible for connecting to the upper-layer network.
3. The difference between a second layer switch and a router
Traditional switches developed from bridges and belong to the second layer of OSI, namely the data link layer equipment. It is addressed according to the MAC address, and the route is selected through the station table, and the establishment and maintenance of the station table are automatically carried out by the switch. The router belongs to the third layer of OSI, namely the network layer device. It is addressed according to the IP address and is generated through the routing table routing protocol. The biggest advantage of a switch is its fastness. Since the switch only needs to identify the MAC address in the frame, it directly generates the selection forwarding port based on the MAC address. The algorithm is simple and easy to implement ASIC, so the forwarding speed is extremely high. But the working mechanism of the switch also brings some problems.
1. Loop: Based on the switch address learning and station table establishment algorithm, loops are not allowed between switches. Once a loop exists, the spanning tree algorithm must be started to block the port of the generating loop. The router's routing protocol does not have this problem. There can be multiple channels between routers to balance the load and improve reliability.
2. Load concentration: There can only be one path between switches, so that the information is concentrated on a communication link and cannot be dynamically allocated to balance the load. The router's routing protocol algorithm can avoid this. The OSPF routing protocol algorithm can not only generate multiple routes, but also select different optimal routes for different network applications.
3. Broadcast Control: The switch can only narrow the conflict domain, but cannot narrow the broadcast domain. The entire switched network is a large broadcast domain, and broadcast messages are scattered across the entire switched network. The router can isolate the broadcast domain, and broadcast messages cannot be broadcasted through the router.
4. Subnet division: The switch can only recognize MAC addresses. MAC addresses are physical addresses and adopt flat address structures, so molecular networking cannot be divided according to MAC addresses. The router recognizes the IP address. The IP address is assigned by the network administrator. It is a logical address and the IP address has a hierarchical structure, divided into network numbers and host numbers, which can be easily used for dividing the network. The main function of the router is to connect to different networks.
5. Confidentiality issue: Although the switch can filter frames based on the source MAC address, destination MAC address and other contents of the frame, the router filters the packets based on the source MAC address, destination IP address, TCP port address and other contents of the packet, which is more intuitive and convenient.
6. Media Relevance: As a bridge device, a switch can also complete the conversion between different link layers and physical layers, but this conversion process is relatively complicated and is not suitable for ASIC implementation, which will inevitably reduce the forwarding speed of the switch. Therefore, currently, switches mainly complete network interconnection of the same or similar physical media and link protocols, and will not be used to interconnect between networks with very different physical media and link layer protocols. The router is different. It is mainly used to interconnect between different networks, so it can connect networks with different physical media, link layer protocols and network layer protocols. Although routers have an advantage in function, they are expensive and have low packet forwarding speed.
In recent years, switches have made many improvements to improve performance, the most prominent of which are virtual networks and layer three switching.
Demarcation networks can narrow the broadcast domain and reduce the impact of broadcast storms on the network. Each interface of the router is connected to a subnet, and broadcast packets cannot be broadcasted through the router. Subnets connected to different interfaces of the router belong to different subnets, and the subnet range is physically divided by the router. For switches, each port corresponds to a network segment. Since the subnet is composed of several network segments, the combination of switch ports can be logically divided into the network. Broadcast messages can only be broadcast within the subnet and cannot be spread to other subnets. By reasonably dividing logical subnets, the purpose of controlling broadcasting is achieved. Since the logical subnet is arbitrarily combined by switch ports and has no physical correlation, it is called a virtual subnet, or a virtual network. Virtual network technology solves the problem of isolation of broadcast packets without a router, and the network segments in the virtual network have nothing to do with their physical location, that is, adjacent network segments can belong to different virtual networks, while two network segments that are far apart may belong to different virtual networks, while two network segments that are far apart may belong to the same virtual network. Terminals in different virtual networks cannot communicate with each other, which enhances access control of data within the network.
Switches and routers are the contradiction between performance and function. Switches switches are fast, but their control functions are weak, and routers have strong control performance, but their packet forwarding speed is slow. The latest technology to solve this contradiction is layer three switching, which has both the switch's linear-speed forwarding capabilities and the router's good control functions.
4. The difference between a third-layer switch and a router
Before the advent of Layer 3 switching technology, it was almost unnecessary to distinguish routing functional devices from routers. They were exactly the same: providing routing functionality is working on routers, however, Layer 3 switches are now fully capable of performing most of the functions of traditional routers. As a network interconnect device, the third layer switch has the following characteristics:
1. Forwarding service flow based on layer 3 addresses;
2. Fully exchange function;
3. Special services can be completed, such as message filtering or authentication;
4. Execute or not perform routing processing.
Compared with traditional routers, the third layer switch has the following advantages.:
1. The transmission bandwidth between subnets can be arbitrarily allocated: each interface of a traditional router is connected to a subnet, and the rate at which the subnet transmits through the router is limited by the bandwidth of the interface. Layer 3 switches are different. They can define multiple ports as a virtual network, and use a virtual network composed of multiple ports as a virtual network interface. The information in the virtual network can be sent to the Layer 3 switch through the ports that make up the virtual network. Since the number of ports can be specified arbitrarily, there is no limit on the transmission bandwidth between subnets.
2. Rationally configure information resources: Since there is no difference between accessing resource rates in the subnet and accessing resource rates in the global network, setting up a separate server in the subnet is not very meaningful. By setting up a server group in the global network, it not only saves costs, but also allows you to reasonably configure information resources.
3. Reduce costs: Usually, network design uses switching mechanisms to form subnets and uses routers to interconnect subnets. Currently, the network design of the three-layer switch can be used, which can not only divide any virtual subnets, but also complete inter-subnet communication through the switch's layer three-layer routing function, saving expensive routers.
4. Flexible connection between switches: As switches, there are no loops allowed between them. As routers, there are multiple paths to improve reliability and balance load. Layer 3 switches use spanning tree algorithm to block the ports of the loop, but when routing, they still use the blocked path as optional paths to participate in routing selection.
5 Conclusion
To sum up, switches are generally used for LATAN-WAN connections. The switch belongs to the bridge and is a device in the data link layer. Some switches can also realize the third layer switching. Routers are used for connections between WAN-WAN, which can solve the forwarding of packets between opposite-sex networks and act on the network layer. They just accept input packets from one line and forward them to the other. These two lines may belong to different networks and adopt different protocols. In comparison, the functions of the router are more powerful than those of the switch, but the speed is relatively slow and expensive. The third-layer switch has both the switch's linear-speed forwarding capabilities and the router's good control functions, so it can be broadcasted.