0% found this document useful (0 votes)
10 views

Lecture 5 Network Layer Part 1

Uploaded by

GAURAV CHHETRI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Lecture 5 Network Layer Part 1

Uploaded by

GAURAV CHHETRI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Network Layer

Part 1
Services provided by Network Layer

• Logical Address to the nodes in the network.


• Packet Switching data delivery services.
• Connection less services.
• Best effort data delivery services (Unreliable).
– Packets may be lost in the network.
– Packets may be delivered out of order at the destination.
– Duplicate packets may arrive at the destination.
– Packet may delayed too long to reach to the destination.
• Congestion Control
Global Internet Architecture
• The Internet backbone is made up of many
large networks which interconnect with each
other.
• These large networks are known
as Network Service Providers or NSPs.
Some of the large NSPs are UUNet,
CerfNet, IBM, BBN Planet, SprintNet,
PSINet, as well as others.
• Each NSP is required to connect to
three Network Access Points or NAPs.
• NSPs also interconnect at Metropolitan
Area Exchanges or MAEs.
• Both NAPs and MAEs are referred to as
Internet Exchange Points or IXs.
• NSPs also sell bandwidth to smaller
networks, such as ISPs and smaller
bandwidth providers.
Packet Switching
• Switches need to address three problems:
– Forwarding
• Directing input packet to correct output interface

– Routing
• Knowing which is the correct output interface
– Contention
• Buffering of packets (needs queue of storage)

• Approach of Network Layer: Store and Forward


• Packet reaches to the destination using packet switching
Network Level Address
• Two issued must be handled when we are connecting two networks:

– Heterogeneity

– Scalability

• Routers are interfacing components to connect multiple networks.

• Lower layers define maximum transfer unit (MTU) for the network layer.

• Heterogeneity and scalability issues can be addressed by the following

protocols:

– IPv4 (RFC 791)

– IPv6(RFC 2460)

• They also provide logical address to the nodes in the network.


Example
IPv4 Header
IPv4 Header (Contd.)
• Version: Version Number (4/6)
• Internet Header Length (IHL): Number of 32 byte words in
the IP header
• Type of Service (TOS): Define the type of processing at
intermediary node. (Shortest Path, Minimum Delay etc.)
• Length: Total number of bytes in IP packet including header.
• Identifier, Flag and Fragment offset are used for
fragmentation and reassembly of IP packet.
IPv4 Header (Contd.)
• Fragmentation and Reassembly example:
• Fragment the packet if packet sixe >MTU of the link.
• Identifier: Define a unique id for every fragment of the same
datagram.
• Flag: Three flags bits are defined with the following usage:
– First bit: Reserved (must be zero)
– Second bit: Don’t Fragment (DF)
– Third bit : More fragment (MF)
• Fragment offset are used for reassembly of fragmentations and mark
the offset from the starting byte of the IP packet.
IPv4 Header (Contd.)
Fragmentation and Reassembly Example
• Suppose an IP packet contains 1400 bytes of data but the MTU of the outgoing link is 512
Bytes.

• Then 1400 bytes will be divided into smaller chunks: 512, 512, 376

The first packet will have the following The second packet will have the The thirst packet will have the following
parameters: following parameters: parameters:
• Id: x • Id: x Id: x
• MF: 1 • MF: 1 MF: 0
• Offset: 0 • Offset: 512 Offset: 1024
• Date: 512 bytes • Date: 512 bytes Date: 376 bytes

• After receiving all the chunks, the receiver will assemble the data and forward it to the
upper layer protocol.
• Receiver gives up reassembly if all data segments do not receive at the receiver.
IPv4 Header (Contd.)
Fragmentation and Reassembly Example
IPv4 Header (Contd.)
• TTL: number of hops after which the network will discard the
packet. Hop count is decremented on each hop (forwarding).
• Protocol: The IP packet is containing data of which upper
layer protocol. (TCP:6) (UDP:17)
• Header Checksum: Used for error detection
• Source Address: 32 bit IP address of source node.
• Destination Address: 32 bit IP address of destination node.
IPv4 Address
• 32 bits long
• Identifier for host, router interface
• Notation:
– Each byte is written in decimal in MSB order,
separated by dots
– Example: 128.195.1.80 stands for the 32-bit IP address

10000000 11000011 00000001 01010000


Types of IPv4 Addresses
• Unicast Address
– Destination is a single host
• Multicast address
– Destination is a group of hosts
• Broadcast address
– 255.255.255.255
– Destination is all hosts
Types of IPv4 Addresses
• IPv4 address are divided into classes
• IPv4 Address has an hierarchical structure.
• IP address can be divided into the following:
– Net Id
– Host ID

• IP address has the notion of subnet mask which


helps to determine class of IP address and Net Id.
Class A IP Addresses
Class 32 bits
Net Id (8
A 0 Type of Serv. Host ID (24 Bits)
Bits)

• Default subnet mask: 255.0.0.0

• Address range:
– 0.0.0.0 – 127.255.255.255

• First 8 bits represent Net ID

• Rest 24 bits represent Host Id.

• For very large organizations


• 16 million hosts allowed in one network.
• Eg. 69.25.36.21 → Net ID: 64.0.0.0; Host ID: 0.25.36.21
Class B IP Addresses
Class 32 bits

B 110 Net Id (16 Bits) Host ID (16 Bits)

• Default subnet mask: 255.255.0.0


• Address range:
– 128.0.0.0 – 191.255.255.255

• First 16 bits represent Net ID


• Rest 16 bits represent Host Id.

• For large organizations


• 65 thousand hosts allowed in one network.
• Eg. 169.25.36.21 → Net ID: 169.25.0.0; Host ID: 0.0.36.21
Class C IP Addresses
Class 32 bits
11 Host ID (8
C 10 Net Id (24 Bits)
Bits)

• Default subnet mask: 255.255.255.0


• Address range:
– 192.0.0.0 – 223.255.255.255

• First 24 bits represent Net ID


• Rest 8 bits represent Host Id.

• For small organizations


• 255 hosts allowed in one network.
• Eg. 194.25.36.21 → Net ID: 194.25.36.0; Host ID: 0.0.0.21
Class D IP Addresses
Class 32 bits

D 1110

• No default subnet mask


• Address range:
– 224.0.0.0 – 239.255.255.255

• Known as multicast address which means one


address can represent a group of hosts.
Class E IP Addresses
Class 32 bits

E 1111

• Reserved Addresses
• No default subnet mask
• Address range:
– 240.0.0.0 – 255.255.255.255

• Not usable for any one.


Special Addresses

• 127.x.y.z: Loopback Address

• 255.255.255.255: Limited Broadcast Address


Subnetting
Subnetting
Example: Class B address with 8-bit subnetting.
Now IP address will have Net ID, Subnet ID and Host ID

16 8 8
bits id
Network bits id
Subnet bits id
Host
Example 165.230 .24 .8
Address:
Subnet Masks

Subnet masks allow hosts to determine if another IP


address is on the same subnet or the same network

16 bits 8 bits 8 bits


Network id Subnet id Host id
Mask 1111111111111111 11111111 00000000
:
255.255 .255 .0
Problems with Class-based
Addressing
• Too many small networks requiring multiple class C addresses.

• Running out of class B addresses, not enough nets in class A.

• Addressing strategy must allow for greater diversity of network


sizes.

• IPv4 address space is running out, therefore, IPv6 came into


existence with 128 bit address space.
Subnet Mask

Assume IP addresses A and B share subnet mask M.


Are IP addresses A and B on the same subnet?

1. Compute logical AND (A & M).


2. Compute logical AND (B & M).
3. If (A & M) == (B & M) then A and B are
on the same subnet.

Example: A and B are class B addresses


A = 165.230.82.52
Same (classful) network?
B = 165.230.24.93
Same subnet?
M = 255.255.255.0
Global Address vs Logical Address
• Global address are also known as the following names:
– MAC address
– Physical address
– NIC address
– Ethernet address etc.
– Provided by IEEE 802.x standards where x=3, 4,….22.

• Logical addresses are provided by the following protocols:


– IPv4
– IPv6
Router
• Routers are attached to two or more networks.
• Since they need to have an address on each network, therefore, they
need more than one network interface (port).
• IP addressed are assigned to the interfaces rather than host so that
they can be part pf more than one network.
Network 2
Net id:
172.27.0.0
Router
Network 1 IF1: 172.26.21.32
Net id: IF2: 172.27.21.25
172.26.0.0 IF3: 172.28.21.32
Network 3
Net id:
172.28.0.0
Routing vs Forwarding
• Forwarding is the process of taking a packet queue and
forward it on a appropriate output interface.

Whereas

• Routing is the process of building and maintaining the


routing /forwarding table that allows the correct
output interface for the packet to be determined.
Forwarding Algorithm
if (net id of the destination = net is of one of my interfaces)
then
deliver the packet to the destination on that interface.

else if (net id of the destination is in my forwarding / routing table)


then
deliver the packet to next hop on the output interface.
else
deliver the packet to the default router.
Routing Protocols
• Concerned with delivering a packets from source to destination.

Machine A Machine
B
Application Application

Transport Router/Gateway Transport

Internet Internet Internet


Network Network
Network
Interface Interface
Interface

Network Network
1 2
Routing Protocols (contd.)
• Routing algorithms are the part of the Network Layer responsible for deciding on which
output interface /link to transmit an incoming packet.
• Algorithm properties: correctness, simplicity, robustness, stability, fairness, optimality,
and scalability.
• Routing protocols visualize network as graph G (V,E) where V are the nodes of the network
and E are the edges in the network representing links between the two nodes.
• V={v1, v2, v3, …..vn}
• E={(v1,v3),……..}
• Autonomous system (domain): All the networks Routing Table
under a single administrative control. Destination Net Next Hop Cost
Id
172.23.0.0 IF1 25
192.26.25.0 IF7 12
…. … …

You might also like