How Networks Communicate
Explain how networks communicate
When networks communicate, it allows for data flow between endpoint and intermediary devices over
the wire or wirelessly using software protocols. An endpoint device could be a computer; for an
intermediary could be routers and switches. Software protocols are rules that govern all data
communication, i.e. what, how, when data is communicated. Protocol elements include message
encoding, formatting and encapsulation, timing, size, delivery options.
In order for the computers to share data, all layers of the open systems interconnections (OSL) need
to be functioning.
The OSI model has 7 layers: application, presentation, session, transport, network, data link and
physical.
Layer 1 - Physical - transporting bits
The physical layer 1 technology is responsible for transporting Bits Data exists in Bits, or 1’s and 0’s of data. This includes twisted pair (Ethernet), coaxial, fibre cables as well as Wi-Fi. Though Wi-Fi does not require a physical cable, it is nonetheless transporting data. In addition to cables and Wi-Fi, a repeater or multi-port repeater (e.g. hubs) amplifies the signals, effectively extending the physical wire.
Layer 2 - Data Link - hop to hop
Layer 2 interacts with the wire (physical layer) as it puts bits on the wire or retrieves bits. Anything that connects to the wire is a Layer 2 technology such as a Network Interface Card (NIC) and Wi-Fi Access Cards. Without an NIC or Wi-Fi Access Card, the computer cannot interact with the network or Wi-Fi. It uses an addressing scheme, known as MAC addresses, which appear as 12 hex digits (0-9, A-F) converted to 48 bits. A switch is also a Layer 2 technology as it interacts with and connects the wires between devices to facilitate data transfer in frames. The MAC address helps the switch to direct data frames from computer to router to computer, with the data frame header updated between routers until it reaches the destination IP address or the endpoint MAC address.
Layer 3 - Network - end to end
Layer 3 technologies are routers that transfer data in packets. Router uses IP addresses which appear as 4 octets of 0-255, made up of 32 bits. It reads the IP address of a data packet’s header from the sender which has the source and destination IP addresses. This enables data to be sent end-to-end correctly in a complex network of routers. The host or anything with an IP address is considered to be a Layer 3 technology.
Layer 4 - Transport - service to service
Layer 4’s role is to distinguish data streams or segments by using ports to redirect data to the applications running on the computer, e.g. chat, web browser, gaming. There are two sets of ports: 0-65535 for TCP and 0-65535 for UDP. TCP favours reliability while UCP favours efficiency. A server listens for client requests for pre-defined ports. When a client sends a request, the Layer 4 header of the data packet contains a source port which is randomly selected by the client, and a destination port. When the packet reaches the destination IP, the server that patches the destination port as defined in the Layer 4 header will respond to the client and the response header will have the source and destination ports swapped. This ensures the right application gets the right data with the right protocol. Everytime a user opens a tab, the client generates a new random source port, thus, a client can make multiple connections to the same server and the user sees separate information on each tab.
Layers 5 to 7 can be condensed into the Application in the modern TCP/IP model.
Layer 5 - Session
The session layer starts or ends the connection between devices and determines the direction of data flow. It authenticates the connection. Layer 5 distinguishes between user sessions by identifying a user independent from L2, L3, or L4 addresses. This means a client-server connection does not have to be re-authenticated when the client moves across different locations and therefore different networks and their respective IP addresses because the client holds the same HTTP cookie generated by the domain server.
Layer 6 - Presentation
The presentation layer encrypts or converts information into a machine readable format such as a binary code before it is transmitted over the internet down to the other OSI layers. Or if the data is transmitted to the application layer, it is converted to a human readable format from binary code. Layer 6 can also determine the format of the binary code, i.e. Base64 (6 bits), Hexadecimal (4 bits), HTTP’s ASCII encoding (8 bits), Numbers / Integers (32 bits), or Long Numbers / Integers (64 bits) and presents the binary code to Layer 5 - Session, or human readable characters to Layer 7 - Application.
Layer 7 - Application
The application layer is the software application such as a web browser. Layer 7 determines what the interpreted characters do, i.e. the application commands. If the characters spell “GET”, HTTP fetches a web page.