Devices like hubs, switches, and bridges connect multiple devices to the same network segment. Internetwork devices connect multiple networks or subnets together and enable communication between hosts on different types of networks.
A router is a device that connects two or more network segments or subnets.
• Each subnet has a unique logical network address.
• Routers can be used to connect subnets within a single LAN, or they can be used as gateways to connect multiple LANs together.
• Routers can be used to connect networks with different architectures (for example, connecting an Ethernet network to a token ring network).
Routers maintain information about other networks in a database called a routing table. The routing table typically contains the address of all known networks and the next router in the path used to reach the destination network. The routing table is used in the process of forwarding packets.
A firewall is a router with additional security features. Firewalls can be programmed with security rules to restrict the flow of traffic between networks.
• Firewall rules control the type of traffic allowed into a network and the type of traffic allowed out of a network.
• A firewall can be either hardware devices or software installed onto operating systems.
Layer 3 Switch:
A Layer 3 switch is capable of reading Layer 3 (network) addresses and routing packets between subnets. A Layer 3 switch often provides better performance than a router, but it does not support as many features as a router.
Routers receive packets, read their headers to find addressing information, and send them on to their correct destination on the network or internet. The following process is used to send a message from one host to another on a different network:
1. The sending host prepares a packet to be sent. The host uses its own IP address as the source Network layer address and the IP address of the final receiving device as the destination Network layer address.
2. The sending host creates a frame by adding its own MAC address as the source Physical layer address. For the destination Physical layer address, the host uses the MAC address of the default gateway router.
3. The sending host transmits the frame.
4. The next hop router reads the destination MAC address in the frame. Because the frame is addressed to that router, it processes the frame.
5. The router strips off the frame header and examines the packet destination address. It uses the routing table to identify the next hop router in the path.
6. The router repackages the packet into a new frame. It uses its own MAC address as the source Physical layer address and the MAC address of the next hop router as the destination Physical layer address.
7. The router transmits the frame.
8. The next hop router repeats steps 4 - 7 as necessary until the frame arrives at the last router in the path.
9. The last router in the path receives the frame and checks the destination IP address contained in the packet.
10. Because the destination device is on a directly connected network, the router creates a frame using its own MAC address as the source Physical layer address and the MAC address of the destination device as the destination Physical layer address.
11. The router transmits the frame.
12. The destination device receives the frame. Inside the packet, it finds that the destination Network layer address matches its own IP address, and the source IP address is that of the original sending device.
Note the following:
• Both Data Link layer physical addresses and Network layer logical addresses are used to send packets between hosts on different subnets.
• IP (Network layer) addresses are contained in the IP header; MAC (Data Link layer) addresses are contained in the Ethernet frame header.
• A router uses the logical network address specified at the Network layer to forward messages to the appropriate network segment.
• Data Link addresses in the frame change as the frame is delivered from hop to hop. At any point in the process, the Data Link destination address indicates the physical address of the next hop on the route. The Data Link source address is the physical address of the device sending the frame.
• Network addresses remain constant as the packet is delivered from hop to hop. The Network addresses indicate the logical address of the original sending device and the address of the final destination device.