Bridges operate at the data link layer. They connect two or more network segments that use the same data link and network protocol. They understand only data link layer protocols and MAC addresses. They may connect the same or different types of cable.
Routers operate at the network layer. Routers connect two or more network that use the same or different data link protocols, but the same network protocol. They may connect the same or different types of cable. One major feature of a router is that it can choose the “best” route between networks when there are several possible routes between them. Because a router knows its own location, as well as the packet’s find destination, it looks in a routing table to identify the best route or path. One other important difference between a router and a bridge is that router only processes messages that are specifically addressed to it. Bridges process all messages that appear on the network and forward them to the appropriate network based on their data link layer address. Bridges simply forward the message unchanged onto the other network.
Gateways operate at the network layer and use network layer addresses in processing messages. Gateways are more complex than bridges or routers because they are the interface between two or more dissimilar networks. Gateways connect two or more networks that use the same or different (usually different) data link and network protocols. They may connect the same or different types of cable. Some gateways operate at the application layer as well. Gateways process only those messages explicitly addressed to them (i.e., using their data link layer address) and route those messages that need to go to other networks. Gateways translate one network layer protocol into another, translate data link layer protocols, and open sessions between application programs, thus overcoming both hardware and software incompatibilities.