Numerical Practise – (IPv4 Addressing)

Some important formula used for network configuration ( CLASSLESS)

  • Number of Addresses in Block => N=232-n    (where n is prefix length)
  • First address = (any address) AND (network mask)
  • Last Address = (any address) OR [NOT(network mask)]
  • Subnetwork mask for each subnetwork => nsub = n  + log2(N/ Nsub) where n is prefix length, Nsub is number address in each subnetwork and N is total  number of addresses
  • In Classful, Subnetid for each network  is        nsub= n + log2S where n is length of netID and s is number of subnets (must be power of 2)
  • Find Subnet mask by using each bit in octet as [1(128), 2(192), 3(224), 4(240), 5(248), 6(252), 7(254), 8(255)]
Question In a block of addresses, we know the IP address of one host is 182.44.82.16/26. What is the first address (network address) and the last address (limited broadcast address) in this block?                
Solution. Given IP Address => 182.44.82.16/26
Since the prefix is 26(8+8+8+2),therefore subnet mask will be 255.255.255.192.
Using
First address = (any address) AND (network mask) ,
Last Address = (any address) OR [NOT(network mask)], we get
First Address = (182.44.82.16) AND (255.255.255.192) = 182.44.82.0/26
Last Address = (182.44..82.16) OR (0.0.0.63) = 182.44.82.63/26

Question : Find the subnet mask in each case:
a)1024 subnets in class A
Solution:
Class A means (8+24) bits allocations (8 bit for network & 24 bit for host)
Number of bits required for 1024 subnets can be find by using nsub= n + log2S
So, nsub= 8+ log 1024 = 8 + 10 = 18, which is (8+8+2)
therefore Subnet mask => 255.255.192.0

b) 256 subnets in class B
Solution:
Class B means (16+16) bits allocations.
So, nsub= 16 + log 256 = 16 + 8 = 24, which is (8+8+8)
therefore Subnet mask => 255.255.255.0

Question: Find the range of addresses in blocks 123.56.77.32/29
Solution:
Here network bits are 29 (8+8+8+5) therefore subnet mask is 255.255.255.248
Using First address = (any address) AND (network mask) ,
Last Address = (any address) OR [NOT(network mask)], we get
First Address = (123.56.77.32) AND (255.255.255.248) = 123.56.77.32/29
Last Address = (123.56.77.32) OR (0.0.0.7) = 123.56.77.39/29
Total Address is block = 23 = 8

Question: An organization is granted the block 16.0.0.0/8. The administrator wants to create 500 fixed-length subnets.
a. Find the subnet mask.
b. Find the number of addresses in each subnet.
c. Find the first and the last address in the first subnet.

Solution:
Given bits allocation (8+24)
To create 500 fixed length subnet, we use value near to power of 2 (which is 512), so we create 512 subnet, therefore we need 9 bits.
So we have bits allocation in subnet as [17(8+8+1)+15] or use [nsub= n + log2S]
a. Subnet mask => 255.255.128.0
b. Number of addresses in each subnet => 215
c. First and the last address in the first subnet
Using First address = (any address) AND (network mask) ,
Last Address = (any address) OR [NOT(network mask)], we get
First Address = (16.0.0.0) AND (255.255.128.0) = 16.0.0.0/17
Last Address = (16.0.0.0) OR (0.0.127.255) = 16.0.127.255/17

Question: You have an interface on a router with the IP address of 192.168.192.10/29. What is the broadcast address the hosts will use on this LAN?
Solution :
Find the last address of this block(this is broadcast address)
Given bits allocation (29+3) =>29 means 8+8+8+5, Subnet Mask = 255.255.255.248
Last Address = (any address) OR [NOT(network mask)], we get
Last Address = (192.168.192.10) OR (0.0.0.7) = 192.168.192.15/29

Question: what is the last valid host on the subnetwork 165.21.80.128/26?
Solution:
Given bits allocation (26+6) =>26 means 8+8+8+2, Subnet Mask = 255.255.255.192
Last valid host is the second last address as the last address of block is broadcast address.
Last Address = (any address) OR [NOT(network mask)], we get
Last Address = (165.21.80.128) OR (0.0.0.63) = 165.21.80.191/26
So, Last Valid host is 165.21.80.190/26

Question: Find the number of addresses in a range if the first address is 106.92.29.0 and the last address is 106.92.31.255.
Solution:
Find the difference by subtracting each octet of the first address from the corresponding octet of last address, we get 0.0.2.255
To find the number of addresses(in decimal), we convert it to base 10 and finally add 1 to the result.[ex. range between 5 to 10 is 6 i.e. 10-5=5+1 =6]
Number of addresses = (0×2563 + 0×2562+ 2×2561+ 255×2560) + 1
= (0+0+512+255)+1 = 768

Question: Find the netid and the hostid of the following classfull addresses:
a. 114.34.2.8 b. 208.34.54.12

Solution :
Classes have following range [0-127, 128-191, 192-223, 224-239, 240-255]
a). 114.34.2.8 is class A Address, therefore bits allocation is ( 8 + 24)
So, Netid = 114 and Hostid = 34.2.8
b).208.34.54.12 is class C Address, therefore bits allocation is (24 + 8)
So, Netid = 208.34.54 and Hostid = 12

Question: In fixed-length subnetting, find the number of 1's that must be added to the mask if the number of desired subnets will be
a. 2
b. 122

Solution:

In fixed length subnetting (i.e. classful Addressing), the subnet must be power of 2 ,(we can also use log2S to find number of 1's to be added to mask )
a). to get 2 subnets => log22 = 1
b). to get 122 which is not power of 2, so we look for near value which is 128 =>log2128 = 7

Question: In classless addressing, we know the first address and one of the addresses in the block (not necessarily the last address). Can we find the prefix length? Explain.
Solution:
If two addresses are given which belong to same block then there network bits(prefix bits) must be same. we find out the same bits and that will be the prefix length.


















Published by Expert_Talk

I like sharing article and discussion on emerging technologies. Love to share my knowledge on various latest trends and technologies.

8 thoughts on “Numerical Practise – (IPv4 Addressing)

  1. I have a question.If the IP address is 163.171.113.153 and Subnet mask is 255.255.252.0 of a network then find out the first host of the first subnet id and the last host of the last subnet id. How to solve this problem??

    1. Using the subnet mask, we can find the size of this block and therefore the first and last ip of the block.
      Using
      First address = (any address) AND (network mask) ,
      Last Address = (any address) OR [NOT(network mask)], we get
      First Address = (163.171.113.153) AND (255.255.252.0) = 163.171.112.0
      Last Address = (163.171.113.153) OR (0.0.3.255) = 163.171.115.255

      We know the first and last address are reserved and do not assigned to host. Moreover the IP are consecutively assigned to subnetworks.
      Therefore, second ip address of the block will be the first host of the first subnet.
      i.e. 163.171.112.1
      Similarly, the second last ip of the block will be the last host of the last subnetwork
      i.e. 163.171.115.254

  2. Even i did the same as you did but got confused whether i did correct or not thanks to your i did that problem in my own

  3. Can you please explain how to calculate NOT[MASK]? For example, in this example, where the mask is 255.255.128.0 I calculated NOT[MASK] as 0.0.127.255 but turns out this is wrong. Thanks in advance.

  4. given host a ip address 101.8.128.72/26 find the network it belongs to and find resulting bid.

  5. Hello professor.

    In 4 question (An organization is granted the block 16.0.0.0/8. The administrator wants to create 500 fixed-length subnets. a. Find the subnet mask. b. Find the number of addresses in each subnet. c. Find the first and the last address in the first subnet.) in C part solution you says NOT(255.255.128.0) is equal to 0.0.63.255 and this confuses me because NOT(1000 0000 (128)) = 0111 1111 (127).

Leave a reply to CHRISTIAN JOSEPH ELISHA Cancel reply