A network is officially defined as a group or system of interconnected people or items.
So, by this definition, train stations connected to each other with rail tracks make up a railway network. People who follow each other on Twitter make up an online social network.
Similarly, computers connected to each other with cable or wireless radio make up a computer network.
There are two main purposes of computer networks: Communication using computers and sharing of resources. An “internet” allows doing these two things across different computer networks.
The Internet is essentially a network of computer networks.
So your personal computer is connected to other computers at your house or workplace to create a small computer network, which is in turn connected to other computer networks. And so the global Internet encompasses a complex web of interconnected computer networks.
What Is a Protocol?
Let’s start with an analogy. Think of your routine conversations. They usually follow a general pattern dictated by predefined rules. For example, most conversations start with greetings and end with goodbyes. They probably go something like this:
Turns out that end systems also follow such protocols to communicate with each other effectively on the network.
Formally, according to the Oxford Dictionary, a protocol is “a set of rules governing the exchange or transmission of data between devices.” In the next few chapters, we’ll study several network protocols in detail.
TCP - Transmission Control Protocol
The Transmission Control Protocol (TCP) is one such protocol. It was created to allow end systems to communicate effectively. The distinguishing feature of TCP is that it ensures that data reaches the intended destination and is not corrupted along the way.
UDP - User Datagram Protocol
The User Datagram Protocol (UDP) is also one such key protocol. However, it does not ensure that data reaches the destination and that it remains incorrupt.
HTTP - HyperText Transfer Protocol
HyperText Transfer Protocol (HTTP) is a web protocol that defines the format of messages to be exchanged between web clients, e.g., web browsers and web servers, and what action is to be taken in response to the message. The World Wide Web uses this as its underlying protocol.
Now that we’ve established that end systems communicate with each other based on set protocols, let’s discuss how they actually communicate. Computers send messages to each other that are made up of ones and zeros (bits).
However, instead of sending messages of possibly trillions of bits all in one go, they’re broken down into smaller units called packets to make transmission more manageable. These smaller sizes make transmission more manageable because most links are shared by a few end systems. Sending smaller units in succession instead of one big file all in one go makes usage of the network fairer amongst end systems.
So, applications communicate with each other by sending messages based on protocols. However, packets have to be addressed to a certain application on a certain end system. How do you do that out of potentially millions of end systems and hundreds of applications on each of them? The answer lies in addressing.
An address identifies a sending entity and a receiving entity.
Every device that is connected to the Internet has an address called an ‘IP Address’ which is much like a mailing address.
- IP addresses are 32-bit numbers (in IP version 4).
- The human-readable way for looking at these numbers is the dotted decimal notation, whereby the number is considered one octet of bits (8 bits) at a time. Those octets are read out in decimals, then separated by dots.
- Hence, each number can be from
- 0 to
- 255. For example, 18.104.22.168.
- Some IP addresses are reserved for specific functions. We’ll discuss them in more depth in later lessons.
Any host connected to the Internet could be running many network applications. In order to distinguish these applications, all bound to the same IP address, from one another, another form of address, known as port numbers, is used. Each endpoint in a communication session is identified with a unique IP address and port combination. This combination is also known as a socket. So in essence, ports help to address the packet to specific applications on hosts.
IP addresses identify end systems but ports identify an application on the end system.
Every application has a 16-bit port number. So the port number could range from
- 0 to
- The ports
- 0−1023 are reserved for specific applications and are called well-known ports.
For instance, port 80 is reserved for HTTP traffic. The ports:
- 1024−49152 are known as registered ports and they are used by specific, potentially proprietary, applications that are known but not system defined.
- SQL Server, for example, uses port
It is generally considered best practice not to use these ports for any user-defined applications although there is no technical restriction on using them.
The ports 49152–65535 can be used by user applications or for other purposes (dynamic port allocation for instance, but more on that later).
There are several models along which computer networks are organized.
The two most common ones are the Open Systems Interconnection (OSI) model and the Transmission Control Protocol/Internet Protocol (TCP/IP) model. We will discuss each model and the differences between the two in detail starting with the OSI model.
The OSI Model
The OSI Model was developed in the '70s by the Organization for Standardization (ISO). At this time, the Internet was in its infancy and its protocols had not fully matured. The OSI model provides a standard for different computer systems to be able to communicate with each other.
The Layers of the OSI Model
The model splits up a communication system into 7 abstract layers, stacked upon each other.
Here are the seven layers of the OSI Model.
Network protocols are implemented in software, hardware, or a combination of both, and their hardware and software components are organized into these layers. So the main purpose of this ‘network stack’ is to understand how the components of these protocols fit into the stack and work with each other.
Here are some key responsibilities of each layer. Note that we are listing only some of the responsibilities of each layer. The exhaustive discussion is deferred to later chapters.
These applications or protocols are almost always implemented in software.
- End-users interact with the application layer.
- The application layer is where most end-user applications such as web browsing and email live.
- The application layer is where an outgoing message starts its journey so it provides data for the layer below.
- Presents data in a way that can be easily understood and displayed by the application layer.
- Encoding is an example of such a presentation. The underlying layers might use a different character encoding compared to the one used by the application layer. The presentation layer is responsible for the translation.
- Encryption (changing the data so that it is only readable by the parties it was intended for) is also usually done at this layer.
- Abstracts: the presentation layer assumes that a user session is being maintained by the lower layers and transforms content presentation to suit the application.
- End-to-end Compression: The presentation layer might also implement end-to-end compression to reduce the traffic in the network.
- The session layer’s responsibility is to take the services of the transport layer and build a service on top of it that manages user sessions.
- As we will see shortly, the transport layer is responsible for transporting session layer messages across the network to the destination. The session layer must manage the mapping of messages delivered by the transport layer to the sessions.
- A session is an exchange of information between local applications and remote services on other end systems.
- For example, one session spans a customer’s interaction with an e-commerce site whereby they search, browse and select products, then make the payment and log out.
- Abstracts: the session layer assumes that connections establishment and packet transportation is handled by the layers below it.
- The transport layer also has protocols implemented largely in software.
- Since the application, presentation, and session layers may be handing off large chunks of data, the transport layer segments it into smaller chunks.
- These chunks are called datagrams or segments depending on the protocol used.
- Furthermore, sometimes some additional information is required to transmit the segment/datagram reliably. The transport layer adds this information to the segment/datagram.
- An example of this would be the checksum, which helps ensure that the message is correctly delivered to the destination, i.e. that it’s not corrupted and changed to something else on the way.
- When additional information is added to the start of a segment/datagram, it’s called a header.
- When additional information is appended to the end it’s called a trailer.
- Network layer messages are termed as packets.
- They facilitate the transportation of packets from one end system to another and help to determine the best routes that messages should take from one end system to another.
- Routing protocols are applications that run on the network layer and exchange messages with each other to develop information that helps them route transport layer messages.
- Load Balancing There are many links (copper wire, optical fiber, wireless) in a given network and one objective of the network layer is to keep them all roughly equally utilized. Otherwise, if some links are under-utilized, there will be concerns about the economic sense of deploying and managing them.
Data Link Layer
- Allows directly connected hosts to communicate. Sometimes these hosts are the only two things on a physical medium. In that case, the challenges that this layer addresses include flow control and error detection/correction.
- Encapsulates packets for transmission across a single link.
- Resolves transmission conflicts i.e., when two end systems send a message at the same time across one singular link.
- Handles addressing if the data link is a broadcast medium, addressing is another data link layer problem.
- Multiplexing & Demultiplexing:
- Multiple data links can be multiplexed into something that appears like one, to integrate their bandwidths.
- Likewise, sometimes we disaggregate a single data link into virtual data links which appear like separate network interfaces.
- Consists largely of hardware.
- Provides a solid electrical and mechanical medium to transmit the data.
- Transmits bits. Not logical packets, datagrams, or segments. Also, has to deal with mechanical specifications about the makeup of the cables and the design of the connectors.
Introduction to TCP/IP Model
- The TCP/IP Model, also known as the Internet protocol suite, was developed in 1989.
- Its development was funded by DARPA (Advanced Research Projects Agency (ARPA) was renamed to the Defense Advanced Research Projects Agency (DARPA!)
- Its technical specifications are detailed in RFC 1122.
- This model is primarily based upon most protocols of the Internet, namely the Internet Protocol (IP) and the Transmission Control Protocol (TCP).
The Layers of The TCP/IP Stack
The TCP/IP model splits up a communication system into 5 abstract layers, stacked upon each other. Each layer performs a particular service and communicates with the layers above and below itself.
Here are the five layers of the TCP/IP model: