Difference Between a Router, Switch and a Gateway
1. What are the differences between Bridges, Routers, and Gateways?
Bridges are OSI layer 2 devices where all traffic forwarded through the bridge resides on the same collision domain. Bridges make forwarding decisions based upon the hardware or MAC address of the destination devices and generally support MAC address tables in order to track MAC addresses of each device connected to the bridge for more efficient forwarding. Bridges forward frames that encapsulate data.
Routers are OSI layer 3 devices where traffic forwarded through the device can be forwarded or “routed” from one broadcast domain to another. Routers support tables that manage routes for forwarding traffic along the correct network paths between networks (subnets) and VLANs ( virtual networks). Routers generally also support routing protocols such as OSPF and RIP or RIPv2 that enables routers to share routing maps with neighboring routing and the ability to determine the best network path for forwarding each data packet. Routers determine source and destination based upon logical address (most often IP addresses) and also forward based upon destination MAC address on local networks for traffic that does not require routing (using the ARP protocol and ARP or MAC address caching).
A gateway is a device that forwards traffic from one network to another across network boundaries. A router most often serves as a gateway especially for LAN hosts that it serves. When hosts are forwarding traffic to destinations that are outside the local network and in a different subnet, or use a different network protocol, or use different network medium for transport, a gateway device must be present on the network to route between the different networks (such as between subnets), to forward between physical network types (such as between Ethernet and Token Ring) and also between different protocols (such as between TCP/IP and Apple Talk). Certain specialized gateways may also operate on network application layers in some cases for forwarding decisions.
When would you use one over the other? What OSI layer does each of those devices work in?
Bridges can be used on small networks of 10 or less devices. Bridges are limited by collision domains in that the more hosts on the network the less efficient the network traffic flow due to increased collisions within the collision domain. A switch resolves the collision issue to some degree by providing full duplex capability per port and separate collision domains per port. Bridges cannot forward to layer 3 networks outside its layer 2 network.
When a over 10 hosts are connecting to the network, or there is an excess amount of broadcast traffic within a network, or there is a need to forward to other layer 3 networks and/or subnets, a router is required. A router operates primarily on OSI layer 3.
A gateway (which can be a router) is required to forward to other networks that support different layer 3 addressing or protocols, different physical medium, different layer 2 protocols, and in some cases different application layer protocols. For example, a gateway is needed to forward between a LAN with Ethernet protocol at layer 2 and CAT 5 cable at layer 1 of the OSI, and a network supporting fiber optic connection with ATM protocol at layer 2 of the OSI.
2. What is the difference between a router and a layer-3-switch?
A router usually has less ports than a switch and is designed primarily to forward traffic between networks. A layer 3 switch has more ports, usually equipped with a more capable backplane and switch fabric to handle a greater amount of traffic, and has router services for forwarding between VLANs. A router however includes security features such as ACLs, support for routing protocols such as multicast using DVMRP or PIM whereas for the same protocols a layer 3 switch may only support IGMP at layer 2 and require a router on the network to handle layer 3 PIM responsibilities.
When would you use one over the other?
There is not much difference between a router and a high end layer three switch. If a large number of ports (over 16) are required, or the purpose is primarily LAN focused, a layer three switch with VLAN and routing protocol support would be best. When the requirement is to route between different mediums such as CAT 6 and fiber, or less that 16 connections to the device are required, or the device must support firewall security and filters such as ACLs, a router would be the better choice.
Leave a Reply