We all know that a switch is a network device used to forward electrical (optical) signals, while a router is a hardware device that connects two or more networks.
First of all, their working scenarios are different. Routers are used in the network layer, while switches are used in the link layer. The main work of the two is to forward data, but the difference is that they rely on different addresses. Routers rely on IP addresses to forward datagrams to the next station, while switches rely on MAC addresses. Switches search in their own tables according to the MAC addresses in the header information of the received data frames. If they have, they forward them, if not, they give up.
In addition, the switch is used for data forwarding in LAN, while the router is used to connect LAN and extranet. The function of switch is integrated in the router, and data forwarding can be realized when the host is connected with the router, but the disadvantage is that there are not as many scalable interfaces as switches.
Although they are different in internal structure, the optical interconnection products used are almost the same. Routers and switches need to use optical modules and fiber patch cord to realize the interconnection between network devices. Usually, Gigabit switch can be matched with gigabit optical module and 10 Gigabit optical module. According to the distance between network devices, we need to select the optical module corresponding to the transmission distance.