NETWORK BASICS
Exchanging of information between sender and receiver is called communication. This can be
achieved with the help of Networking. Few examples are as below.
      Samson sending an email to Margaret over internet (data)
      Various teams connecting over conference call (voice)
      Two users video-chatting over Skype application (video)
Network is required in every communication,
communication system.
Communication system is a collection of systems which are connected together to make
communication. A typical communication system consists of the following components.
      Sender - person or Device who sends the data. Example: Computer, Telephone, Radio
       Broadcasting station.
      Receiver - person or Device who receives the data. Example: Computer, Telephone,
       Radio sets.
      Transmission Media - physical medium through which the message travels from the
       sender to the receiver. Example: Optical fibers, Coaxial Cables, Radio waves.
      Protocol - set of rules and regulations agreed upon by both the sender and receiver that
       govern the message exchange.
Network is a collection of various devices and end user systems connected with each other to
achieve the purpose of communication. Networking has changed the way we do business and
day to day activities. With the help of Networking, we can get the information instantaneously
through email, telephone, fax etc.
Networking enables us to exchange data like text, audio and video across geographies.
NETWORK COMPONENTS
The major components of a Network are End user devices, Switch, Router and Interconnections.
A typical network looks as below.
Repeater, Hub, Bridge and Gateway are also components of Network. However components are
varied since every Network does not contain same type of devices.
Functions of components of Network
End User Devices
        These are the end points in the Network
        They help the end users to send and receive messages
        Examples: Computers, Servers, Smart Phones, Mobile Phones, Printers etc.
Hub
        It is typically the least expensive and it is a dumb device
        Performs very simple job - anything that comes in one port is sent out through all
         the other ports
        It is used to form small networks
Note: port is an endpoint of communication in an operating system
Switch
        Switches contains multiple ports
        It connects various systems to form a simple local network
        Every switch maintains a database with source and destination information, it is called as
         MAC Address table
        It also provide intelligent switching of the message with in the local network
Router
      Routers connect multiple networks
      They choose the best path between the networks
      Every router maintains a database for source and destination information, it is called as
       Routing Table
      Routers usually connect different networks working in different locations. For example:
       One network in a campus might have to communicate with a distant network connected
       through fiber optics
Interconnections
      They help in providing a means for message to travel from one point to another.
       The types of Interconnections are
      NIC (Network Interface Card) - it is a hardware part residing in all the machines which
       efficiently translates the user data into a format that is fit to be transmitted in the network
      Media can be cables or wireless, they provide the channel to transmit the signals between
       devices
      Connectors are the connection end points for the media
NETWORK TYPES
Following are the Types of network.
LAN (Local Area Network)      WAN (Wide Area Network) MAN (Metropolitan Area Network)
LAN
LAN is used to connect networking devices that are in a very close geographic area, such as a
floor of a building, a building itself, or a campus environment. Switches and Hubs are the
primary devices to build a LAN. We can also build small network using only Hub.
WAN
WAN is used to connect Local Area Networks together. Typically, Wide Area Networks are
used to connect Local Area Networks which are separated by a large distance. Router is the
primary device to build a WAN.
MAN
MAN consists of a computer network across an entire city, college campus or small region. A
MAN is larger than a LAN, which is typically limited to a single building or site. Depending on
the configuration, this type of network can cover an area from several miles to tens of miles. A
MAN is often used to connect several LANs together to form a bigger network.
NETWORK COMMUNICATION TYPES
There are three types of communication which are used for different purposes:
      Unicast
      Multicast
      Broadcast
Unicast
In Unicast type of communication , there is only one source and one destination. In other words,
it is one to one communication. Example: Telephone call between two persons.
Multicast
In Multicast type of communication, source communicates with a group of destinations. In other
words, it is one to many. Example: A Manager sending a mail to his team.
Broadcast
In Broadcast communication, one to all. We have only one source and all the other hosts are the
destinations. Example: Radio Broadcasting service.
INTRODUCTION TO NETWORKING MODELS
The main aim of computer network is communication and information sharing. Suppose
computer A wants to communicate with computer B through a computer network. The two
systems might be few meters away or in different continents.
While communicating, data has to pass through many intermediate nodes which can be switch,
router etc.
To ensure that data from sender A reaches receiver B correctly and securely, we need to have a
set of rules which guides the communication between A and B. These set of rules are called as
Protocols. These protocols grouped together constitute a communication model. The agreed upon
set of rules are called as Standards.
Let us see a business scenario to understand host to host communication.
Boson, CEO of a British Company wants to send a letter to Lawrence, CEO of a French
company. Let us see how they communicate with each other. Boson and Lawrence have
employed secretaries to assist them.
The communication between Boson and Lawrence happens as given below.
The above scenario depicts a layered architecture wherein the person serves the person in the
above and gets the service from the person below. Similarly, in the communication system,
various services are categorized into layers. Each service in higher layer uses the service from
the layer below it. This is also termed as layered architecture for networking. Let us understand
the layered architecture in detail.
Andrew sends a text message from his iPhone to his friend Simon who is using Samsung Galaxy
Note. In this scenario, though both the users are using devices manufactured by different
companies there are able to communicate with each other. This is because of a set of rules agreed
upon by the vendors to exchange the information. These rules are defined in Networking Models.
      Two important Networking Models are OSI (Open System Interconnection) reference
       model and TCP/IP (Transmission Control Protocol / Internet Protocol) Protocol suite
      The reference model is a conceptual framework for understanding communication
      Networking Models assist in exchanging the data between dissimilar hosts
E.g. you can communicate between a PC with Windows OS and a PC with Unix OS.
OSI stands for Open System Interconnection. OSI means that every system participating in this
model, is open for communicating with other systems. OSI reference model is developed by an
organization called ISO (International Organization for Standardization) which works on the
standardization of protocols. OSI Model is an ideal model that helps us in understanding how
data transfer happens between systems.
How the OSI Model look like?
      OSI model has been divided in seven separate layers
      Layer is a logical group of related functionalities
      Each layer has its own functionality and provides support to other layers
      All layers work together to move data through a network
Let us understand the properties and functions of each layer
Application Layer
      This layer serves as the window for users and application processes to access the network
       services. An end user program that opens what was sent or creates what is to be sent
      Functionalities: Remote file access, resource sharing
      Protocols: HTTP/FTP/SMTP
      Data format (PDU - Protocol Data Unit) in this layer is called as user data
Presentation Layer
      This layer presents the data in the required format which may                    include:
       encryption/decryption, compression/decompression, encoding/decoding
      It is a syntax layer which can be viewed as a “translator” for the network
      Functionalities: data conversion, data compression
      Protocols: ASCII/JPEG/GIF/EBCDIC/ASN.1
      Data format (PDU) in this layer is called as formatted data
Session Layer
      This layer establishes, manages, and terminates sessions between two communicating
       hosts
      Functionalities: Perform security, Name recognition, Logging
      Protocols: RPC/SQL/NFS
      Data format (PDU) in this layer is called as formatted data
Transport Layer
      This layer breaks up the data from the sending host and then reassembles it in the
       receiver. This Host to Host layer used for flow control
      It ensures that messages are delivered error-free, in sequence, and with no losses or
       duplications
      Functionalities: Message segmentation, Message acknowledgement, Traffic control
      Data Format (PDU) in this layer is called as segment
Protocols: TCP/UDP/SPX
TCP (Transmission Control Protocol)
      It is a connection-oriented protocol
      It incurs an additional overhead to gain functions of order delivery, reliable delivery, and
       flow control
      Applications that use TCP: Web Browsers, E-mail, File Transfers etc.
UDP (User Datagram Protocol)
      It is a simple, connection less protocol
      It provisions for low overhead data delivery
      The pieces of communication in UDP are called as datagrams. The datagrams are sent
       using "best effort" service by this Transport layer protocol
      Applications that use UDP: Domain Name System (DNS),Video Streaming, Voice over
       IP (VoIP) etc
Network Layer
      This layer makes “Best Path Determination” decisions based on logical addresses
       (usually IP addresses)
      Functionalities: Routing, Network traffic control, Logical (ip)-Physical(mac) address
       mapping
      Protocols: IP/IPX
      Associated device in this layer: Router
      Data format (PDU) in this layer is called as packet
Data Link Layer
      This layer provides error free transfer of data frames from one node to another over the
       physical layer
      It makes decisions based on physical addresses (usually MAC addresses)
      Functionalities: Frame traffic control, Frame sequencing, Frame error checking
      Protocols: Ethernet, PPP/HDLC
      Associated device in this layer: Switch/Bridge
      Data format (PDU) in this layer is called as frame
Physical Layer
      This layer is concerned with the transmission and reception of the unstructured raw bit
       stream over the physical medium (cables, hubs, etc.)
      Functionalities: Data encoding, Physical Medium attachments, Transmission technique,
       physical medium transmission bits & volts
      Associated device in this layer: Hub/Repeater
      Data format (PDU) in this layer is called as bit
The application (upper) layers
       Layer 7: Application layer
       Layer 6: Presentation layer
       Layer 5: Session layer
The data-flow (lower) layers
       Layer 4: Transport layer
       Layer 3: Network layer
       Layer 2: Data link layer
       Layer 1: Physical layer
The communication between a same layer on source and destination is known as peer layer communication.
The following image illustrates various Protocol Data Unit represented at each layer of OSI model. The same
terminologies are also applicable for TCP-IP model.
Encapsulation and De-capsulation of data at different layers of OSI model as follows.
Let us understand the data flow in OSI model.
System A wants to communicate with system B over the network. They are the end systems
connected by a network.
The intermediate nodes implement only the bottom 3 layers of communication. Since their task
is to pass on the data along the navigation path.
The top 4 layers are implemented by end systems and bottom 3 layers are implemented by all
nodes in the path.
Every layer has some protocol using which it communicates with the corresponding layer in the
other system. Application layer protocol, Presentation layer protocol, Session layer protocol etc.
are such protocols. Every layer communicates with the layer above and below it. Also it provides
some service to the layer above it. Protocols works between same layers of different machines,
where services works with different layers within same machine.
Now we will learn how data get transmitted in a network. To illustrate this we’ll study how
browser request for a page.
Step 1: User types a URL in the browser. Here URL is the user data.
Step 2: Application layer in the browser adds metadata(header) to user data. This results in a
HTTP GET request. This is also called a message.
Step 3: Presentation layer formats message from a format used by application layer into a
common format at the sender system. This layer adds metadata(header) to Message and creates
Formatted message.
Step 4: Session layer adds metadata(header) to formatted message. This Header contains the
detail of session establishment between both the host.
Step 5: Transport layer adds metadata to massage and creates segment.
      Destination port : used to identify process on destination device
      Source port : will be used by the receiver as the destination port for sending reply
      Sequence no : used for reliable data delivery
Step 6: Network layer adds metadata to segment and creates a packet.
      Destination IP : used to identify destination device
      Source IP : will be used by the receiver as the destination IP for sending reply
Step 7: Data link layer adds metadata to packet and creates a frame.
      Destination mac : used to identify the next router or destination device
      Source mac : will be used as the destination mac for sending reply
Step 8: Physical layer converts frame to signal (0,1) and transmits via the media.
Step 9: Frame (bits) reaches the switch of the sender’s network.
Step 10: Data link layer of switch read the header in the frame to find destination MAC. It then
uses MAC table to identify the port for forwarding the data.
Step 11: It forwards frame to physical link (E.g. ethernet cable) through the identical port. then
frame (bits) reaches the router.
Step 12: The frame has reached the data link layer of the router. The layer will remove the
metadata from frame and deliver the packet to the network layer.
Step 13: The network layer of router reads the destination ip from the packet, and determines the
destination path using routing table.
Step 14: The data link layer of the router adds metadata to packet based on destination path. It
changes the source MAC and the destination MAC.
Step 15: Physical layer converts frame to signals and transmits via the media. Frame (bits)
reaches the switch of the receiving network.
Step 16: Data link layer of switch read the header in the frame to find destination MAC. It then
uses MAC table to identify the port for forwarding the data.
Step 17: It forwards frame to physical link (E.g. ethernet cable) through the identical port. Frame
(bits) reaches the Receiver machine.
Step 18: The frame has reached the data link layer of receiver. The layer will remove the
metadata from frame and deliver the packet to network layer.
Step 19: The packet has reached the network layer of receiver. This layer will remove metadata
from packet and deliver the segment to the transport layer.
Step 20: The segment has reached the transport layer of receiver. This layer will remove
metadata from segment to exact message. Next it will use the port number to deliver the message
to the application layer of the correct application (In this case the Web Server).
Step 21: The Formatted message has reached the session layer of receiver. This layer will
remove metadata from Formatted message.
Step 22: The Formatted message has reached the presentation layer of receiver. This layer will
remove metadata from Formatted message to extract message. It will translate the message into
the format needed by allocation layer.
Step 23: The message has reached the application layer of receiver. This layer will remove
metadata from message. It will use the removed metadata to pass user data to appropriate
component in web server.
Step 24: The web server receives the user data (http request).
TCP/IP PROTOCOL SUITE
Before OSI Reference Model was developed, the most widely used reference model was TCP/IP
Protocol Suite. This was developed as a result of a researched program sponsored by United
States Department of Defense. Unlike OSI reference model, TCP/IP has only 4 layers. This
model is as given below.
      Although the OSI reference model is universally recognized, the historical and technical
       open standard of the internet is TCP/IP (Transmission Control Protocol / Internet
       Protocol)
      The TCP/IP reference model and the TCP/IP protocol stack make data communication
       possible between any two computers, anywhere in the world, at nearly the speed of light
      The U.S. Department of Defense (DoD) created the TCP/IP reference model
let us understand the functions of each layer in TCP/IP model.
Application Layer
       This layer contains all the higher level protocols including file transfer, email, web
       services etc.
      Application, Presentation and Session layers in OSI model together, correspond to
       Application layer of TCP/IP model
Transport Layer
      This layer takes care of the conversation between source and destination. The
       conversation can be connection oriented or connection less. Protocols in this layer are
       TCP and UDP. TCP functionalities are fragmenting the original message into discrete
       pieces and reassembling the same when they reach the destination. On the other hand,
       UDP is unreliable protocol.
      Transport layer in both the models are same
Internet Layer
     This layer was the result of packet switching network. The main functionality of this
      layer is to transmit packets to any network through the best path from the source. The
      major protocol in this layer is IP (Internet Protocol)
     Network layer of OSI model corresponds to Internet layer in TCP/IP model
Network Access Layer
     TCP/IP protocol suite does not specify much below the Internet layer. This layer is quite
      undefined
     The data link layer and physical layer of OSI form the Network Access layer in TCP/IP
      Protocol suite
TCP/IP model data
Let's say that you are browsing Sparsh. By the time the Sparsh page loads in your desktop, the
data has gone through so many software and hardware.This is sort of like how the postal system
works. Many people in the postal department, do their respective jobs to make sure your parcel
reaches to your friend.
Like the postal department, in computer networks, many layers of software and hardware must
do their respective jobs to ensure smooth communication. It is called as the TCP/IP model. It
defiles how networks should work. TCP/IP is a set of four layers of protocols. Each layer focuses
on how to package the data so that the corresponding layer on the receving device can
understand it. It does not bother how the data is handled by subsequent layers.
Application Layer
This layer is responsible for converting the data in a form understandable by the destination
application. Layer is just a concept. It is implemented in a software or a hardware. This
application and application layer are not the same.
Transport Layer
This layer ensures that the data has reached the destination. It does this by looking for an
acknowledgement from the receiver. It sends a unique sequence number for each data and
expects it back in the acknowledgement. If it does not receive an acknowledgement within a
certain time, it resends the data.
Internet Layer
This layer is responsible for finding the best possible route for the data to reach the destination.
Router is the network device works in this layer and it actively use this layer to find the best
route.
Link Layer
Here the Network Access layer referred as link layer. The link layer is responsible for ensuring
the data delivery to the correct host with error-free using CRC (Cyclic Redundancy Check)
checks.
The sender uses CRC algorithm to generate a unique number for the data. The CRC and data are
transmitted to the destination. The receiver uses the same CRC algorithm and checks if the
generated CRC matches with the transmitted CRC. If both are matched, then the data has arrived
uncorrected. If not, the received data is discarded.
Physical Layer
This layer is outside of the TCP/IP model. It coverts data to appropriate signals for transmission
through wired and wireless media.
Protocol Stack
There can be many combination of protocols to make up a stack.
Following is the comparison between OSI model and TCP/IP along with protocols.