Question: how a network switch works?
Answer: Network switches create a network while routers connect networks. In other words, network switches allow different devices on a network to communicate, but routers allow different networks to communicate. In a nutshell, a network switch is typically a Layer-2 device of the OSI model while a router is a Layer-3 device.