Lesson 2: Components

Ann K. Hoang
The Cabin Coder
Published in
5 min readMar 4, 2015

This lesson takes a look at how the devices and protocols fit into each of the OSI layer.

Layer123

Layer 1: Physical Layer

The physical layer is in charge of moving data between computers, so anything physical component, such as copper cabling, fiber optics, even radio waves is part of the OSI Layer 1.

This layer includes:

+ Network Interface Card (NIC)    
+ Cables
+ Connections
+ Hub
+ Data are called bits

The NIC, pronounced “nick”, serves as the interface between the PC and the network. In older computers, NIC are separate cards that are snapped into the expansion slot in the PC. Nowadays, NICs are soldered into the motherboard, but we still call it NICs.

old nick

Cables are known in the industry as unshielded twisted pair (UTP), usually contains four pairs of wires that can transmit and receive data.

Hubs are primitive in compare to switches since they take bits from one port and repay the same bits to all other ports, indiscriminately. When I write hub, think of “repeaters”. They just repeat, andBecause hubs have no knowledge of frames and packets, it is considered a Layer 1 device.

Layer 2: DataLink Layer

+ Media Access Control (MAC) address
+ NIC (due to its MAC addr)
+ Switches and Bridge
+ Data at this level are called frames

Switches are considered a Layer 2 device because unlike hub, it understands layer 2 addresses and frames. It doesn not forward traffic to every port like the hub. Switches does selective forwarding. It memorizes the source MAC addresses and associates them with the particular port. If switches knows where the destination MAC address of a particular frame, it will forward to that particular address only.

Unknown destination from the switch will be forward to all other active port.

A Bridge is exactly like switch, it also does selective forwarding. However, bridges are more old school–they are not as fast or do not have many ports as a switch.

switches

More on the NIC

One of the NIC’s most important role is to make sure each system have a unique id. This id is burned into the ROM chip as a 48-bit value called a media access controll address, or MAC address.

The Institutue of Electrical and Electronics Engineers (IEEE) makes these NICs, and they are responsible for making sure are NIC is unique.

An example of a MAC address is 00–40–05–60–7D-49.

The first six hex digits are often called the organizational unique indentifier (OUI), and no other manufacturer can use them.

OUI

The last six hex digits of the MAc are called the device ID, which are reserved for the manufacturer.

In the terminal, type in ipconfig for windows or ifconfig for Mac/Linux OS, to see the MAC address. The computer refer the MAC address as the physical address.

NICs and Frames

Imagine data moving to the NIC’s table. Here he is in charge of packaging these data into little cylinder canisters. You can think these canisters as the frame.

nic_table

Each frame begins with the recipient’s MAC address, then the sender’s MAC address, follow by the data itself, and a checking information called the frame check sequence (FCS). The FCS uses the cyclic redundancy check (CRC) to verify that the data arrived correctly.

Then NIC sends the frame to our hub. The hub makes copy of the frame, and send it to every system in our network. When the frame comes into the table from the receiving NIC in our network, where our NIC confirms if the physical address matches. Every frame is received by every NIC, but only the NIC with the correct MAc address will process and decapsulate that frame.

Layer 3: The Network Layer

The network layer is responsible for adding the IP address.

+ IPv4 and IPv6 addresses (including EUI-64)
+ Routers
+ Data in this layer is called packets

The IP version 4 uses the dotted decimal notation (dotted-octet) based on four 8-bits number. Each 8-bits number ranges from 0 to 255. For example, a typical IP version 4 address can be: 196.168.2.232.

The packet which contains the destination, the source address, and the data itself, is an envelope placed inside our frame.

packet inside frame

The router is in charge of connecting each subnets. The IP address is considered a logical address, since the router uses it and not the physical, MAC address, to forward data. We need to configure the IP addresses for each system. The data may go through many routers before it reaches the right destination.

The router strips incoming frame, check if the data has the correct IP address in the packet, create a new frame if it doesn’t have the right IP, then sends the packet within the frame on its way.

routers

Layer 3 is the last layer that deals with hardware components. All the remaining layers are all software.

Written Notes:

c1
c2
20
21
22
23
24

--

--

Ann K. Hoang
The Cabin Coder

Senior Software Engineer. Born in Saigon. Raised in the Silicon Valley. Currently in Seattle, WA.