The primary function of the network is to provide connectivity between devices. In the past there was a huge variety of different network protocols but today almost everything is based on Traffic Control Protocol/Internet Protocol (TCP/IP).
TCP/IP is based upon the Open Systems Interconnection (OSI) model that is made up of seven layers. Each layer of the OSI model is a specific function of network communcation between two devices.
|7||Application||Interface for receiving and sending data|
|6||Presentation||Formatting of the data and encryption|
|5||Session||Tracking of packets across a connection|
|4||Transport||End to end communcation between the devices|
|3||Network||Logical addressing and the routing of packets|
|2||Data Link||Hardware addressing of devices|
|1||Physical||Media type such as wiring, and connector|
Applications generate data at Layer 7 of the OSI model, and the device sends this data down each layer of the OSI model. Once the data begins to reach Layer 3, the nework layer, the host needs to determine whether this datra needs to be sent to an application on the same device or to continue working its way down the layers until it reaches Layer 1.
Layer 1 is responsible for getting the data values from one device other to the destination device. Once it reaches the destination device the data works its way back up the layers to deliver the network data to the application.
At Layers 2 and 3 network devices can forward traffic on a Layer 2 or 3 perspective from one device to another. In the beginning the first Layer 2 devices were bridges or switches, and Layer 3 devices were routers.
Technology advancements allowed the use of Application Specific Integrated Circuit (ASIC) chips to route and switch packets faster in hardware. As these technologies continued to advanced, multilayer switches came along to switch traffic at Layer 2 as if they were switches but also route traffic at Layer 3 as if they were routers.