Network Layer (Part 2)
Network Layer (Part 2)
Computer Networks
29-10-2024 1
Dr. Divya Lohani
IPv4 Address
• Unique global identifier for a network interface.
• IP address is for the INTERFACE of a host. Multiple interfaces
mean multiple IP addresses.
• The address space of IPv4 is 232 – an IP address is 32-bit long
identifier conceptually divided into network ID and host ID.
Computer Networks
29-10-2024 2
Dr. Divya Lohani
• IP addresses are written in dotted decimal notation
• Each byte is identified by a decimal number in the range [0..255]:
Computer Networks
29-10-2024 3
Dr. Divya Lohani
Classful Addressing
When Internet addresses were standardized (early 1980s), the Internet address space was divided up into classes:
• Class A: Network prefix is 8 bits long - IP address starts with “0”
• Class B: Network prefix is 16 bits long - IP address starts with “10”
• Class C: Network prefix is 24 bits long - IP address starts with “110”
• Class D: Used for Multicasting - IP address starts with “1110”
• Class E: Reserved: IP address starts with “1111”
Computer Networks
29-10-2024 4
Dr. Divya Lohani
Default Mask
• A mask is a 32-bit binary number. N1
Class A = 120.0.0.0
N2 Class C – 200.10.5.0
200.10.5.0 a
• Class A : 8 bits (NID) + 24 bits (HID)
192.10.20.0 c
• Class B : 16 bits (NID) + 16 bits (HID) 120.0.0.0 b
• Class C : 24 bits (NID) + 8 bits (HID)
Computer Networks
29-10-2024 5
Dr. Divya Lohani
Problems with Classful Addressing
Problem 1. Too few network addresses for large networks
• Class A and Class B addresses are gone.
Problem 2. Two-layer hierarchy is not appropriate for large networks with Class A and Class
B addresses.
• Fix #1: Subnetting
Computer Networks
29-10-2024 6
Dr. Divya Lohani
Subnetting
• Organizations have multiple networks which
are independently managed
University Network
✓ Allocate an address for each network
✓ Add another level of hierarchy to the IP
School 1 School 2
addressing structure
• Split the host number portion of an IP address
into a subnet number and a (smaller) host School 3 School 4
number.
Computer Networks
29-10-2024 7
Dr. Divya Lohani
A university with 2 schools has the following IP address: 200.10.5.0. As the network
administrator, you are required to create subnets to accommodate the following
requirements: Each subnet must support 120 hosts.
200.10.5. --------
1st subnet: 200.10.5.0-------
2nd subnet: 200.10.5.1-------
120 hosts = 2^7
Computer Networks
29-10-2024 8
Dr. Divya Lohani
CIDR – Classless InterDomain Routing
• There are no classes – the length of the network prefix (block ID) is
flexible.
Block ID Host ID
Example: 200.10.5.172/26
26 bits represent block ID
So, no. of bits for host ID = 32 – 26 = 6
Mask: 26 1’s + 6 0’s = 255.255.255.192
Computer Networks
29-10-2024 9
Dr. Divya Lohani
Network Routing
Computer Networks
29-10-2024 10
Dr. Divya Lohani
Routing
• Routing is the process of discovering network paths:
• Deals with routing of packet from source to destination - responsible for end-to-
end delivery of individual packets across multiple networks, without guarantees.
• Properties of routing algorithm:
• Correctness, Simplicity, Robustness, Stability, Fairness, Efficiency
Computer Networks
Dr. Divya Lohani
Dijkstra's Shortest Path Algorithm
• Developed by E. Dijkstra in 1956 (published in 1959).
• Algorithm exists in many variants.
• Classic Form - For a given source node in the graph, the algorithm finds the
shortest path between that node and every other (single source shortest
path).
• Can also be used for finding the shortest paths from a single node to a single
destination node by stopping the algorithm once the shortest path to the
destination node has been determined.
Computer Networks
29-10-2024 13
Dr. Divya Lohani
Dynamic Routing
Routing Concept Routing Algorithm Routing Protocol
Distance Vector Routing Bellman Ford / Ford Fulkerson RIP (Routing Information Protocol)
algorithm IGP (Interior Gateway Protocol)
Link State Routing Dijkstra algorithm OSPF (Open Shortest Path First)
IS-IS (Intermediate System to
Intermediate System)
Computer Networks
29-10-2024 14
Dr. Divya Lohani
Distance Vector Routing
• Oldest routing concept in practice.
• It was the original ARPANET routing algorithm and was also used in the Internet under the name RIP.
• Uses distributed Bellman-Ford algorithm (Bellman, 1957).
• Distance vector routing protocol uses a routing algorithm in which routers periodically send routing
updates to all neighbors by broadcasting their entire distance vectors.
Important relationship that exists among the costs of the least-cost paths:
Computer Networks
29-10-2024 16
Dr. Divya Lohani
Destination Cost Link/Hop
A 1 A
B 0 -
C 3 C
D ∞ -
E 9 E
Destination Cost Link/Hop
A 0 -
B 1 B
C 5 C Destination Cost Link/Hop
D ∞ - A ∞ -
E ∞ - B 9 B
C ∞ -
D 2 D
E 0 -
Computer Networks
29-10-2024 18
Dr. Divya Lohani
Link State Routing
• Link state protocol is a way to communicate information among the nodes so
that all nodes have the consistent link state database. While this basic idea is
very simple, it is not so easy to make this work in a distributed environment.
• A node in the network needs to store the cost of a link and record whether this link is
up or down: generally referred to as the state of the link. Information about links a
node needs to store as the link state database.
• Link State Protocols relay specific link characteristics and state information.
C
Network Layer Devices
Computer Networks
29-10-2024 23
Dr. Divya Lohani
Router
• Routes data packets based on their IP addresses.
• Does not see the frame addresses and does not know if
the packet came in on a LAN or a point-to-point line.
• Works with networking protocols that they were
designed to handle – requires prior configuration
• Normally connect LANs and WANs together and have
a dynamically updating routing table based on which
they make decisions on routing the data packets – route
optimality based on routing algorithm
• Divide broadcast domains of hosts connected through
it (sub netting).
Computer Networks
29-10-2024 24
Dr. Divya Lohani
Layer 3 Switch
• It is a multilayer device.
• Combines the functionality of a switch and a router.
• Usually come in 24 or 48 ports - without the WAN interface.
• Connects devices within the same subnet.
• Routing protocols are simple.
• Separate Broadcast Domains.
• Works in 2 modes: Store & Forward ; Cut through.
Computer Networks
29-10-2024 25
Dr. Divya Lohani
Gateway
• An internetworking system capable of joining together two networks that
use different base protocols
• Can be implemented in software, hardware, or as a combination of both.
• Depending on the types of protocols they support, network gateways can
operate at any level of the OSI model.
• Have capabilities like firewalls and other security features.
Computer Networks
29-10-2024 26
Dr. Divya Lohani
References
• Andrew S. Tanenbaum, Nick Feamster, and David J. Wetherall;
Computer Networks; Pearson Education; 6th Edition, 2021.
Computer Networks
29-10-2024 27
Dr. Divya Lohani