Routers and Switches
A router is a device that forwards data packets between computer networks and creates an overlay internetwork. A router is usually connected to two or sometimes more data lines from different networks. When a data packet is received on one of the lines, the router decodes the address information in the packet to determine which data line to forward it to, using information stored in its routing table, and transmits it through the networks that constitute the internetwork until it gets to its destination node. Thus, routers basically function as the traffic controllers of the internet world.
The most common type of routers are home and small office routers that pass small amounts of data between the home computers and a DSL modem, which connects to the Internet through an Internet Service Provider (ISP). There are also more sophisticated routers available, which range from enterprise routers that are used by large businesses or ISP networks to the powerful core routers that transmit data at very high speeds along the optical fiber lines of the Internet “backbone” of the nation.
A switch on the other hand is an electrical component that can make or break an electrical circuit, interrupting the current or diverting it from one conductor to another. A switch is usually an electromechanical device with one or more sets of electrical contacts, which are connected to external circuits. Depending on the state of the contacts, the circuit can be either “closed” meaning the contacts are touching & electricity can flow between them, or “open”, implying that the contacts are separated and the switch is blocking the flow of electricity.
In network communications, switches are employed to perform similar functions of controlling the flow of data packets, to the destinations that they are intended for. A switch is receives a message from any device connected to it and then transmits the message only to that device for which the message was meant. The network switch plays an integral part in most modern Ethernet local area networks (LANs). Mid-to-large sized LANs contain a number of such linked managed switches. Small office/home office (SOHO) applications typically use a single switch, or an all-purpose converged device such as a residential gateway to access small office/home broadband services such as DSL or cable internet. In most of these cases, additional components such as routers are required to make the final connection to the internet/other networks. In some environments where there is a need for a great deal of analysis of network performance and security, switches may be connected between WAN routers as places for analytic modules. Features such as firewalls, network intrusion detection, and performance analysis modules can be plugged into switch ports. Some of these functions may be on combined modules. In other cases, the switch is used to create a mirror image of data that can go to an external device, for read-only systems, without allowing manipulation of data.
However, in spite of similar functions, switches differ from routers. Switches generally operate at Layer 2 (Data or Datalink) of the OSI Reference Model, making use MAC addresses. On the other hand, routers work at Layer 3 (Network) with Layer 3 addresses (IP, IPX or Appletalk, depending on the type of the protocol being used). The algorithm that is used by switches to decide how to forward packets is different from the algorithms used by routers. One of the differences in the algorithms used between switches and routers is how “broadcasts” are handled. Whenever a device needs to send out information but doesn’t know who it should send it to, it sends out a broadcast. The other nodes such as a domain server can add the computer to their browser list like an address directory and communicate directly with that computer from that point on. Thus, broadcasts are used any time a device needs to make an announcement to the rest of the network or is unsure of who the recipient of the information should be.
A hub or a switch will pass along any broadcast packets they receive to all the other segments in the broadcast domain, but a router will not. Without the specific address of another device or destination, a router will not let the data packet through. This is necessary to keep networks isolated from each other, but becomes problematic when communication is required between different parts of the same network. In such cases, switches can be employed.