Unit 4
Unit 4
Physical (Layer 1)
The lowest layer of the OSI reference model is the physical layer.
It is responsible for the actual physical connection between the devices.
The physical layer contains information in the form of bits.
It is responsible for transmitting individual bits from one node to the next.
When receiving data, this layer will get the signal received and convert it into 0s and 1s and
send them to the Data Link layer, which will put the frame back together.
Network (Layer 3)
Layer 3 provides switching and routing technologies, creating logical paths, known as virtual
circuits, for transmitting data from node to node.
Session (Layer 5)
This layer establishes, manages and terminates connections between applications.
The session layer sets up, coordinates, and terminates conversations.
It deals with session and connection coordination.
Presentation (Layer 6)
This layer provides independence from differences in data representation (e.g., encryption) by
translating from application to network format, and vice versa.
The presentation layer works to transform data into the form that the application layer can
accept.
Application (Layer 7)
OSI Model, Layer 7, supports application and end-user processes.
Everything at this layer is application-specific.
This layer provides application services for file.
The process of adding its header and trailer information at each layer of sending computer,
in the form of metadata to the actual payload (data) is called Encapsulation.
At layer 1 the entire package is converted to a form that can be transferred to the receiving machine.
At the receiving machine, the message is unwrapped layer by layer, with each process receiving and
removing the data meant for it.
Step 1:
The Application, Presentation, and Session layer in the OSI model, or the Application layer in
the TCP/IP model takes the user data in the form of data streams, encapsulates it and
forwards the data to the Transport layer.
It does not necessarily add any header or footer to the data.
But it is application-specific and can add the header if needed.
Step 2:
The protocol at the transport layer has its own packet structure, which is known as a protocol
data unit (PDU).
The Transport layer (in the OSI or TCP/IP model) takes the data stream from the upper
layers, and divide it into multiple pieces.
The Transport layer encapsulates the data by adding the appropriate header to each piece.
These data pieces are now called as data segments.
The header contains the sequencing information so that the data segments can be
reassembled at the receiver’s end.
Step 3:
The Network layer (in the OSI model) or the Internet layer (in the TCP/IP model) takes the data
segments from the Transport layer and encapsulate it by adding an additional header to the
data segment.
This data header contains all the routing information for the proper delivery of the data.
Here, the encapsulated data is termed as a data packet or datagram.
Step 4:
The Data-Link layer (in the OSI or TCP/IP model) takes the data packet or datagram from the
Network layer and encapsulate it by adding an additional header and footer to the data packet
or datagram.
The header contains all the switching information for the proper delivery of the data to the
appropriate hardware components, and the trailer contains all the information related to error
detection and control.
Here, the encapsulated data is termed as a data frame.
Step 5:
The Physical layer (in the OSI or TCP/IP model) takes the data frames from the Data-Link layer
and encapsulate it by converting it to appropriate data signals or bits (corresponding to the
physical medium).
1. Bit synchronization:
The physical layer provides the synchronization of the bits by providing a clock.
This clock controls both sender and receiver thus providing synchronization at bit level.
2. Bit rate control: The Physical layer also defines the transmission rate i.e. the number of bits
sent per second.
3. Physical Topologies: Physical layer specifies the way in which the different devices/nodes are
arranged in a network i.e. bus, star or mesh topology.
4. Transmission mode: Physical layer also defines the way in which the data flows between the
two connected devices. The various transmission modes possible are: Simplex, half-duplex and full-
duplex.
Framing: Data-link layer takes packets from Network Layer and encapsulates them into
Frames. Then, it sends each frame bit-by-bit on the hardware. At receiver’ end, data link layer
picks up signals from hardware and assembles them into frames.
Error Control: Sometimes signals may have encountered problem in transition and the bits are
flipped. These errors are detected and attempted to recover actual data bits. It also provides
error reporting mechanism to the sender.
Flow Control: Stations on same link may have different speed or capacity. Data-link layer ensures
flow control that enables both machines to exchange data on same speed.
Multi-Access: When host on the shared link tries to transfer the data, it has a high probability of
collision. Data-link layer provides mechanism such as CSMA/CD to equip capability of accessing a
shared media among multiple Systems.
It is responsible for routing packets from the source host to the destination host. The routes can be
based upon static tables that are rarely changed, or they can be automatically updated depending
upon network conditions.
The network layer tackles issues like transmission delays, transmission time, avoidance of
jitters, etc.
Segmentation and Reassembling: A message is divided into segments; each segment contains
sequence number, which enables this layer in reassembling the message. Message is reassembled
correctly upon arrival at the destination.
1. Session establishment, maintenance and termination: The layer allows the two processes to
establish, use and terminate a connection.
2. Synchronization: This layer allows a process to add checkpoints which are considered as
synchronization points into the data. These synchronization point help to identify the error so
that the data is resynchronized properly, and ends of the messages are not cut prematurely
and data loss is avoided.
3. Dialog Controller: The session layer allows two systems to start communication with each
other in half-duplex or full-duplex.
2. Encryption/ Decryption: Data encryption translates the data into another form or code. The
encrypted data is known as the cipher text and the decrypted data is known as plain text. A key
value is used for encrypting as well as decrypting data.
3. Compression: Reduces the number of bits that need to be transmitted on the network.
Features
Support for a flexible architecture. Adding more machines to a network was easy.
The network is robust, and connections remained intact until the source and destination
machines were functioning. The main idea was to allow one application on one computer to
talk to (send data packets) another application running on different computer.
There are three different protocols used in this layer. These include:
IP: One of the most important protocols as it detects the IP address of a device which is later used
for internetwork connections. Using this protocol, the path with which the data shall be
transmitted is decided. There are two common IP versions which are used, IPv4 and IPv6.
ARP: It stands for Address Resolution Protocol. The physical address from the IP address can be
determined using ARP.
ICMP: It stands for Internet Control Message Protocol and notification regarding datagram
problems can be sent back to the user using this.
Any issue with the network is immediately notified to the user by ICMP. It can only inform the user
about the errors and cannot rectify the problem
Internetworking: This is the main duty of network layer. It provides the logical connection
between different types of networks.
Addressing: Addressing is necessary to identify each device on the internet uniquely. This is
similar to telephone system. The address used in the network layer should uniquely and
universally define the connection of a computer.
Routing: In a network, there are multiple routes available from a source to a destination and one of
them is to be chosen. The network layer decides the route to be taken. This is called as routing.
Packetizing: The network layer encapsulates the packets received from upper layer protocol and
makes new packets. This is called as packetizing. It is done by a network layer protocol called IP
(Internetworking Protocol).
ARP stands for Address Resolution Protocol. ARP converts an Internet Protocol address to its
physical network address (MAC). It operates at layer 2 of the TCP/IP model.
Functions:
Local host maintains the ARP Table. ARP maps the Internet Protocol address (IP) to a
physical machine address.
It provides the interface between the IP addressing system used by IP and the Hardware
addresses used by the data link layer protocol.
ARP broadcasts an IP address in an effort to discover its equivalent hardware address.
1. When a source device want to communicate with another device, source device checks its Address
Resolution Protocol (ARP) cache to find it already has a MAC Address entry of the destination
device. If entry is in the cache table, it will use that MAC Address and will not issue ARP request.
2. If ARP entry is not seen in the cache, the source will generate an Address Resolution Protocol
(ARP) request message.
3. The source broadcast the Address Resolution Protocol (ARP) request frame on the LAN.
4. The message is received by each device on the LAN since it is a broadcast. Each device
compares the Target Protocol Address with its own Protocol Address (IPv4 Address). Those
who do not match will drop the packet.
5. When the targeted device checks the Target Protocol Address, it will find a match and will
generate an Address Resolution Protocol (ARP) reply frame. The destination device will
update its Address Resolution Protocol (ARP) cache, since it need to contact the sending device.
6. Destination device sends the Address Resolution Protocol (ARP) reply frame which will be
unicast.
7. The source device will process the Address Resolution Protocol (ARP) reply from destination,
store the Sender Hardware Address as the layer 2 address of the destination.
8. The source device will update its Address Resolution Protocol (ARP) cache with the Sender
Hardware Address and Sender Protocol Address from the Address Resolution Protocol
(ARP) reply frame.
1. Source Device “Generates RARP Request Message” – The source device generates a RARP
Request message. The Source puts its own data link-layer address (Hardware Address) as
both the Sender Hardware Address and also the Target Hardware Address. It leaves both
the Sender Protocol Address (IP) and the Target Protocol Address (IP) blank.
2. Source Device “Broadcasts RARP Request Message” – The source broadcasts the RARP
Request message on the local network.
3. Local Devices “Process RARP Request Message” – The message is received by each device
on the local network and processed. Devices that are not configured to act as RARP servers
ignore the message.
4. RARP Server Generates RARP Reply Message: Any device on the network that is a RARP
server responds to the broadcast from the source device. It generates a RARP Reply and sets
the Sender Hardware Address and Sender Protocol Address to its own hardware and IP
address of course. It then sets the Target Hardware Address to the hardware address of the
original source device. It looks up in a table the hardware address of the source, determines
that device’s IP address assignment, and puts it into the Target Protocol Address field.
5. RARP Server Sends RARP Reply Message: The RARP server sends the RARP Reply message
unicast to the device looking to be configured.
6. Source Device Processes RARP Reply Message: The source device processes the reply from
the RARP server. It then configures itself using the IP address in the Target Protocol Address
supplied by the RARP server.
DHCP clients obtain a DHCP lease for an IP address, a subnet mask, and various DHCP options
from DHCP servers in a four-step process:
DHCP DISCOVER: When we start a device, it checks whether a valid IP configuration is available or
not. If the valid IP configuration is not available, the device generates a special message known as
the DHCPDISCOVER message and broadcasts this message on the local LAN segment.
DHCPOFFER:
If multiple DHCP servers are available, based on their configuration, one of them or all of them can
reply to the DHCPDISCOVER message. In reply to the DHCPDISCOVER message, a DHCP server sends
a DHCPOFFER message to the client.
Since the client does not have an IP address, the DHCP server cannot send the DHCPOFFER message
directly to the client. Because of this, the server also broadcasts the DHCPOFFER message to the
local network.
DHCPREQUEST: All hosts in the local network receive the DHCPOFFER message. The host that sent
the DHCPDISCOVER message accepts the DHCPOFFER message. Except the original host, all other
hosts ignore the DHCPOFFER.
If a host receives multiple DHCPOFFER messages, it accepts only one message and tells the
corresponding server with a DHCPREQUEST message that it wants to use the offered IP
configuration.
IPV4
IPv4 addresses are unique.
They are unique in the sense that each address defines one, and only one, connection to the
Internet.
Two devices on the Internet can never have the same address at the same time.
Address Space:
IPv4 uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296 (more
than 4 billion).
This means that, theoretically, if there were no restrictions, more than 4 billion devices could be
connected to the Internet.
Notations
There are two prevalent notations to show an IPv4 address: Binary notation and Dotted decimal
notation.
1. Binary Notation:
In binary notation, the IPv4 address is displayed as 32 bits.
Each octet is often referred to as a byte.
So it is common to hear an IPv4 address referred to as a 32-bit address or a 4-byte address.
The following is an example of an IPv4 address in binary notation:
01110101 10010101 00011101 00000010
Dotted-Decimal Notation:
To make the IPv4 address more compact and easier to read, Internet addresses are usually
written in decimal form with a decimal point (dot) separating the bytes.
Each byte is identified by a decimal number in the range [0..255].
The following is the dotted decimal notation of the above address: 117.149.29.2
0.0.0.0 to 127.255.255.255
Example
2.134.213.2
Example
135.58.24.17
Class D: Class D range for first byte is 224-239 Class D is used for multicasting and its starting bits
are 1110
Class A
0000 0000 (0) 0000 0000 (0) 0000 0000 (0) 0000 0000 (0)
0111 1111 (127) 1111 1111 (255) 1111 1111 (255) 1111 1111 (255)
Class B
1000 0000 (128) 0000 0000 (0) 0000 0000 (0) 0000 0000 (0)
1011 1111 (191) 1111 1111 (255) 1111 1111 (255) 1111 1111 (255)
Class C
1100 0000 (192) 0000 0000 (0) 0000 0000 (0) 0000 0000 (0)
1101 1111 (223) 1111 1111 (255) 1111 1111 (255) 1111 1111 (255)
Class D
1110 0000 (224) 0000 0000 (0) 0000 0000 (0) 0000 0000 (0)
1110 1111 (239) 1111 1111 (255) 1111 1111 (255) 1111 1111 (255)
Class E
1111 0000 (240) 0000 0000 (0) 0000 0000 (0) 0000 0000 (0)
1111 1111 (255) 1111 1111 (255) 1111 1111 (255) 1111 1111 (255)
IPV4 vs IPV6
4. Total Length: This field contains the total length of the IP datagram. IP datagram cannot be
more than 65,536 since this filed size is 2 bytes or 16 (216 = 65,536).
5. Identification: This field is used in the situations when a datagram is fragmented. The sub
datagram are sequenced using identification field so that later it can be used to reconstruct the
original datagram.
6. Flags: This field corresponds to identification field. It indicates whether a datagram can be
fragmented and if fragmented, the position of the fragment (first, last or middle).
7. Fragmentation Offset: If a datagram is fragmented, this field indicates the offset of the data in
the original datagram before segmentation. This is used while reconstructing.
8. Time to Live (TTL): This filed is initialized by some value and decremented each time it passes
through routers. If the value becomes zero or negative, the data is not forwarded. Thus it decides the
lifetime of the data.
9. Protocol: This field identifies the transport protocol running on top of IP. The upper layer
software piece can be TCP or UDP. This field specifies which piece of software at the destination
node the datagram should be passed on to.
10. Source address: This field contains the 32 bit IP address of the sender.
11. Destination address: This field contains the 32 bit IP address of the final destination.
The IEEE 802.5 Token ring technology provides for data transfer rates of either 4 or 16 Mbps.
If one device does not receive a token within a specified period, it can issue an alarm. The alarm
alerts the network administrator the problem and its location.
Then, network administrator generates a new , free token
OR
There are two error conditions that could cause the token ring to break down.
One is the lost token in which case there is no token in the ring.
Other is the busy token that circulates endlessly.
To overcome these problems, the IEEE 802 standard specifies that one of the stations must be
designated as “active monitor”. The monitor detects the lost condition using a timer by time-
out mechanism and recovers by using a new free token
Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
Sub netting
Supernetting
Supernetting is inverse process of subnetting, in which several networks are merged into a single
network.
While performing supernetting, the mask bits are moved toward the left of the default mask.
The supernetting is also known as router summarization and aggregation.
It results in the creation of more host addresses at the expense of network addresses, where
basically the network bits are converted into host bits.
The supernetting is performed by internet service provider rather than the normal users, to
achieve the most efficient IP address allocation.
Step 3: Convert the result of AND operation to Dotted Decimal format which is Subnet mask.
Example 3:
A company is granted the site address 181.56.0.0 (class B). The company needs 1000 subnets.
Design the subnets.
Solution:
The number of 1s in the default mask is 16 (class B).
The company needs 1000 subnets.
This number is not a power of 2.
The next number that is a power of 2 is 1024 (210).
We need 10 more 1’s in the subnet mask.
The total number of 1’s in the subnet mask is 26 (16 + 10).
The total number of 0’s is 6 (32 - 26).
The mask is
11111111 11111111 11111111 11000000
or
255.255.255.192 8
The number of subnets is 1024.
The number of addresses in each subnet is 26 (6 is the number of 0s) or 64.