Open Systems Interconnections (OSI) Model
The Open Systems Interconnection (OSI) model was created to standardize the language used to describe networking protocols. It defines the manner in which systems communicate with one another using abstraction layers. Each layer communicates with the layer directly above and below. Not all layers are used at all times.
Layer | Name | Description |
---|---|---|
7 | Application | Most networking stacks have a concept of the application layer. |
6 | Presentation | Most networking stacks combine the presentation layer in layers 4, 5, or 7. |
5 | Session | Sometimes used by different stacks, often combined into other layers (7 or 6). |
4 | Transport | Most networking stacks have a concept of the transport layer. |
3 | Network | Most networking stacks have a concept of the network layer. |
2 | Data Link | Most networking stacks have a concept of the data link layer. |
1 | Physical | Most networking stacks have a concept of the physical layer. |
Layer 7 - Application
Some of the common protocols which exist in the Application Layer are:
- HTTP: Hypertext Transfer Protocol
- SMTP: Simple Mail Transfer Protocol
- DNS: Domain Name System
- FTP: File Transfer Protocol
- DHCP: Dynamic Host Configuration Protocol.
Layer 6 - Presentation
The Presentation Layer is commonly rolled up into a different layer. This layer deals with the formatting of data, e.g. conversion of Extended Binary Coded Decimal Interchange Code (EBCDIC) to American Standard Code for Information Interchange (ASCII).
For example, the HTTP protocol (an Application Layer protocol) has methods for converting character encoding. In other words, this Presentation Layer step happens at the Application Layer.
Layer 5 - Session
The Session Layer deals with managing of session data. It creates a semi-permanent connection, which is then used for communications.
Many of the RPC-type protocols depend on this layer:
- NetBIOS: Network Basic Input Output System
- RPC: Remote Procedure Call
- PPTP: Point to Point Tunneling Protocol.
This layer is used by protocols which need reliable sessions, such as videoconferencing and SOCKS proxy.
If an established connection is lost or disrupted, this layer may try to recover the connection.
If a connection is not used for a long time, the session layer may close and then reopen it.
Layer 4 - Transport
The Transport Layer is responsible for the end-to-end communication protocols. Data is properly multiplexed by defining the source and destination port numbers. This layer also deals with reliability by adding check sums, doing request repeats, and avoiding congestion.
Some of the common protocols in the Transport Layer are:
- TCP: Transmission Control Protocol: It is the main component of the TCP/IP (Internet Protocol Suite) stack. It is useful when data integrity, ordered delivery, and reliability are important. It is the backbone to many of the most popular protocols.
- UDP: User Datagram Protocol: This is another popular component of the Internet Protocol Suite stack. It is useful when transmission speed is important and the integrity of the data isn't as important, or is managed by an above layer.
- SCTP: Stream Control Transmission Protocol: It uses port numbers to allow for connection multiplexing.
Transport layer protocols use ports to distinguish between different types of traffic or to do multiplexing. The ports are classed in three different ways:
- Well-known ports (0-1023): They are assigned by the Internet Assigned Numbers Authority (IANA), and usually require super-user privilege to be bound. Some of the well-known ports are: 22 TCP: SSH; 25 TCP: SMTP; 80 TCP: HTTP; 443 TCP: HTTPS.
- Registered Ports (1024-49151): Registered ports are also assigned by the IANA. They can be bound on most systems by non-super-user privilege. Some of the registered ports are: 1194 TCP/UDP: OpenVPN; 1293 TCP/UDP: IPSec; 1433 TCP: MSSQL Server.
- Dynamic or Ephemeral Ports (49152-65535): The Ephemeral ports are used as source ports for the client-side of a Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) connection. You can also use the Ephemeral ports for a temporary or non-root service.
Layer 3 - Network
The Network Layer is all about routing packets. This layer is responsible for getting the packets to the next point in the path to the destination. So, this layer deals with routing and packet forwarding, as well as with managing the quality of service.
In many cases, the final destination is not adjacent to this machine, so the packets are routed based on the local routing table information.
It is connectionless; connection tracking can happen at the layers above. Common protocols are IPv4 and IPv6, and is the backbone of the internet.
Many routing and control protocols live at this layer, such as:
- IP: Internet Protocol
- OSPF: Open Shortest Path First
- IGRP: Interior Gateway Routing Protocol
- ICMP: Internet Control Message Protocol.
The Internet Protocol has two main functions:
- Addressing: The addressing function examines the address on the incoming packet and decides if the datagram (packet) is for the local system or for another system. If the address indicates the datagram is for the local system, the headers are removed and the datagram is passed up to the next layer in the protocol stack. If the address indicates the datagram is for another machine, then it is passed to the next system in the direction of the final destination.
- Fragmentation: The fragmentation component will split and re-assemble the packets if the path to the next system uses a smaller transmission unit size.
IPv4 and IPv6
IPv4 was the first major Internet Protocol version:
- It is the most used protocol on the Internet
- The 32bit address size allows for 4,294,967,296 possible addresses
- The address space was exhausted on January 31, 2011
- The last allocation of blocks was given out on February 3, 2011.
- The IPv4 address space exhaustion has been a concern for some time. There are different solutions for mitigating the problem:
- The move from Classed networks to Classless Inter-Domain Routing (CIDR)
- The invention of Network Address Translation (NAT)
- The move to IPv6.
IPv6 is the successor to IPv4.
example.com: 2001:500:88:200::10
- IPv6 has a 128bit address size that allows for 3.4 x 1038 possible addresses. IPv6 was designed to deal with the exhaustion of IPv4 addresses and other IPv4 shortcomings:
- Expanded addresses capabilities
- Header format simplification
- Improved support for extensions and options
- Flow labeling capabilities.
More about IP
An IP address is composed of two parts:
- Network
- Host
Layer 2 - Data Link Layer
Deals with transfer of data between network nodes:
- WAN (Wide Area Network)
- LAN (Local Area Network)
Common protocols are:
- Ethernet
- ARP
- PPP
- STP
Layer 1 - Physical Layer
The Physical Layer is the lowest possible layer and deals with the actual physical transfer of information. This layer deals with transferring bits over a physical medium:
- Electric pulses over copper cables
- Laser pulses over fiber optic cables
- Frequency modulations over radio waves
There are various different protocols, hardware types, and standards defined for different types of physical networks (commonly referred to as PHYs):
- IEEE 802.3: Copper or fiber connections
- IEEE 802.11: Wireless (Wi-Fi) connections
- Bluetooth: Wireless connections
- USB: Copper connections
- RS232: Copper serial connections.