4 Network Layer
4 Network Layer
Tutun Juhana
Telecommunication Engineering
School of Electrical Engineering & Informatics Institut Teknologi Bandung
Network Layer
Computer Networks
INTRODUCTION
IPV4 ADDRESSES
The IPv4 addresses are unique and universal An IPv4 address is 32 bits long
The address space of IPv4 is 232 or 4.294.967.296
Range of Address
To find the number of addresses in a range if the first and last address is given we can perform subtraction or addition Example #1
Find the number of addresses in a range if the first address is 146.102.29.0 and the last address is 146.102.32.255 Ans: 146.102.32.255 - 146.102.29.0 = 0.0.3.255 Number of addresses= (0 2563+ 0 2562+ 32561+ 255 2560)+ 1= 1024
Example #2
The first address in a range of addresses is 14.11.45.96. If the number of addresses in the range is 32, what is the last address? Ans: Convert the number of addresses minus 1 to base 256 0.0.0.31 We then add it (in base 256) to the first address to get the last address
Last address = (14.11.45.96 + 0.0.0.31)256 = 14.11.45.127
CLASSFUL ADDRESSING
Recognizing Classes
Two-Level Addressing
The range of addresses allocated to an organization in classful addressing was a block of addresses in Class A, B, or C Since all addresses in a network belonged to a single block, each address in classful addressing contains two parts: netid and hostid
The netid defines the network The hostid defines a particular host connected to that network
To extract the above information, we need to know the class of the address we will know the value of n (the length of netid in bits)
Example #3
An address in a block is given as 73.22.17.25. Find the number of ddresses in the block, the first address, and the last address
Network Address
The first address in a block is network address important because it is used in routing a packet to its destination network
Network Mask
Routers in the Internet need to know the network mask to extract the network address from the destination address of a packet A network mask (default mask in classful addressing) is a 32-bit number with n leftmost bits all set to 1s and (32 n) rightmost bits all set to 0s
Example #4
A router receives a packet with the destination address 201.24.67.32. Show how the router finds the network address of the packet
2.
The idea of splitting a block to smaller blocks is referred to as subnetting In subnetting, a network is divided into several smaller subnetworks (subnets) with each subnetwork having its own subnetwork address
Example #5
Before subnetting
Length of netid
After subnetting
Length of subnetid
Subnet Mask
The network mask is used when a network is not subnetted When we divide a network to several subnetworks, we need to create a subnetwork mask (or subnet mask) for each subnetwork A subnetwork has subnetid and hostid
Subnetting increases the length of the netid and decreases the length of hostid
When we divide a network to s number of subnetworks (each of equal numbers of hosts) we can calculate the subnetid for each subnetwork as
n is the length of netid nsub is the length of each subnetid s is the number of subnets (must be a power of 2)
Example #6
In Example #5, we divided a class B network into four subnetworks. The value of n = 16 and the value of n1= n2= n3= n4= 16 + log24 = 18 The subnet mask has eighteen 1s and fourteen 0s 255.255.192.0 (different from the network mask for class B (255.255.0.0))
Subnet Address
When a network is subnetted, the first address in the subnet is the identifier of the subnet and is used by the router to route the packets destined for that subnetwork
Example #7
In Example #5, we show that a network is divided into four subnets. Since one of the addresses in subnet 2 is 141.14.120.77, we can find the subnet address as
Supernetting
In supernetting, an organization can combine several class C blocks to create a larger range of addresses (several networks are combined to create a supernetwork)
By doing this, an organization can apply for several class C blocks instead of just one For example, an organization that needs 1000 addresses can be granted four class C blocks.
Supernet Mask
A supernet mask is the reverse of a subnet mask A supernet mask for class C has less 1s than the default mask for this class.
In supernetting, the number of class C addresses that can be combined to make a supernet needs to be a power of 2 The length of the supernetid can be found using the formula
nsuper defines the length of the supernetid in bits c defines the number of class C blocks that are combined
Problems
1. The number of blocks to combine needs to be a power of 2
An organization that needed seven blocks should be granted at least eight blocks (address wasting)