how-to block ads
Switches operate at ISO Layer 2 - Data Link Layer
Routers operate at ISO Layer 3 - Network Layer
Hubs is the most basic of connections, providing nothing more than a shared wire or backbone. When Ethernet was originally designed it used a single fat coax called a backbone. Individual hosts were all physically connected to the single backbone. This created a party line. Each host has to listen for the backbone to be idle before it started talking. It is possible more then one host will start talking at the same time, in that case the messages collide making them unintelligible. If this condition is detected each transmitter stops talking and waits a variable interval before attempting to talk again. The Ethernet network is called a collision domain, since all devices must wait until the line is clear, and may inadvertently interfere with one another. The analogy of an old party line telephone is a good one. You would have to pick up the receiver and see if anyone was talking; if they were using the telephone you would have to wait till they were finished. If you tried to talk over the other party your message would be going to the wrong place and be mixed up with the other message.
When Ethernet was modified to run over Unshielded Twisted Pair (UTP) Category rated wiring the original coax backbone was shrunk within the hub, called a collapsed backbone. Functionally a hub operates exactly as the old coax backbone and sends any packets to all connected ports. The ports on the hub provide a point-to-point connection to the Ethernet interface in each computer. With a hub each node must wait for the network to be idle and detect collisions between multiple nodes.
As Ethernet networks grew in speed and size the party line nature was recognized as a performance limitation. Switches eliminate the collision domain and work much like the modern telephone switching system.
When an Ethernet packet arrives at the switch the destination MAC address is examined and the packet is switched to the proper port. Each Ethernet interface has a Media Access Controller (MAC) 48-bit address assigned by the hardware vendor. The switch remembers which MAC addresses are connected to each port. If the Switch does not know which port to use it floods the packet to all ports. When it gets a response it updates its internal MAC address table.
This means Port A can talk to C at the same time F is taking to B. This greatly increases overall performance even though it does not change the speed of individual connections. Because the collision domain is eliminated, connections are able to use full duplex. Hosts can transmit and receive at the same time improving performance even more.
Hub versus Switch Summary:
The functional difference between a hub and switch is that all devices connected to a hub share the bandwidth, while any device connected to a switch port has the full bandwidth all to itself. For example, if 10 devices are communicating using a hub on a 100Mbps network, then each device only gets a portion of the 100 Mbps and there will be traffic jams. But with a switch, each device could possibly communicate at the full 100 Mbps with a traffic cop ensuring no traffic jams happen.
A router is used to interconnect multiple networks. The Internet is literally Internetwork -- a network of networks. Internet routers work on IP addresses to determine how best to interconnect the sender to the destination. Because routers work at the IP layer different physical networks can be interconnected, Ethernet, Token Ring, Sonet, even RS232 serial used for dialup can carry IP packets.
Routers intended for home use include Network Address Translation (NAT). This allows a single address assigned by the ISP to be shared by multiple hosts connected to the local area network (LAN) using local "non routable" IPs. LAN routers with multiple ports also incorporate a built in switch to establish Layer 2 connectivity to multiple endpoints.