The Internet is a vast, layered network, with billions of devices spread across subnets large and small. Here we show a simplified office network consisting of three subnets connected by routers and some computers and office equipment connected by Layer 2 switches or wireless hotspots inside the subnet.

The two-layer switch in the figure works at the data link layer. It maintains an IP Address to physical Address mapping learned through ARP (Address Resolution Protocol) to determine which port of the switch to forward packets to a target host. So as to realize the communication with the equipment in the network segment.

A router works at the network level, with ports connected to another router or switch, each configured to address a different subnet. Routers use OSPF (Open Shortest Path First) protocol to learn from each other and form a route table, which is used to master the information such as “which router can pass through, which port, reach the specified subnet, how far is it” and so on.

Each host in the network (network card) is manually configured or obtained from DHCP with an IP address, including the host address, subnet mask, and default gateway. When host 192.168.0.100/24 in subnet 3 wants to send a request to Web server 172.16.1.10/24 in subnet 1, the packet is first sent to the default gateway — here is the address of the port where the wireless router connects to subnet 3:192.168.0.1; The wireless router checks the routing table, obtains the optimal path to subnet 1, and forwards the packet to the router of the next station through the specified port. This continues to complete communication across network segments.

The purpose of this article is to give a brief understanding of how switched and routing networks work differently, and to consolidate what we have learned earlier. Interested friends, can read the Cisco CCNA certification related materials, for more information.