Routers and switches for example can be classed as network devices.
What is a Router?:
Routers operate at Layer3 of the OSI Layer and is categorized in the Network Layer. A router can be programmed to find the best routes between networks. The router can traverse many networks and is capable of choosing the best route to the destination. Offices in different and remote locations can be connected together using routers using dedicated or switched lines. The lines are usually provided by telephone companies or Internet Service Providers (ISPs). The routers connect to lines using serial interfaces which usually come installed in the device. Connecting the lines to the serial interfaces on the router allow for a Wider Area Network (WAN) connection. For example, if you have one office in New York and other in London then connecting in the above way will allow for the sending of data and voice transmissions. The Internet is made up of thousands of routers and this allows people all over the globe to communicate using for example, email. Routers by default do not send broadcasts as it is routing data.
What is a Switch?:
Look at a switch as a device that allows PCs to connect to it. For example, a switch could have say 24 connections which will allow 24 PCs to connect to it. Each PC would connect to what is called a switchport on the switch using a (Ethernet) cable. Now look visualize an office environment on one floor. Say there are 16 people on the office floor and each person’s PC connects to a switchport. The switch setup in this way allow the sixteen people to communicate with each other. You can also connect a printer to one of the switchports thereby enabling everyone to access to print documents.
You can also connect switches to each other using a (crossover Ethernet) cable. So for example, a office block had 6 floors with 20 people each. Each switch on the floor could connect to each other (trunking) thereby allowing everybody in the building to communicate with each other. switches traditionally operates at Layer2 of the OSI Layer (Datalink layer) but is common these days to see hybrid ones with Layer 3 functionality. Where routers prevent broadcasts, switches allow broadcasting of packets so that every switchports can learn if data is destined for them. You can contain broadcasts by turning on Layer3 features using VLANs. A switch stores the MAC Address of every device which is connected to it.
The switch will then evaluate every frame that passes through it. The switch will examine the destination MAC Address in each frame. Based upon the destination MAC Address, the switch will then decide which port to copy the frame to. If the switch does not recognize the MAC Address, it will not know which port to send the frame to and broadcasts all ports. If the switch does not have layer3 options then it can connect to a router to prevent broadcasts and route packets to different networks.
Routers and switches vary in size and performance to meet differing needs. High performance switches allow modules to be connected or inserted to enable routing, security services and voice over IP (VOIP).