Category: Computer Networks

Routing Table in Networking | Examples

Subnetting in Networking-

 

Before you go through this article, make sure that you have gone through the previous article on Subnetting.

 

We have discussed-

  • Subnetting is a process of dividing a single network into multiple smaller networks.
  • The number of sub networks created depends upon the requirement.

 

 

Arrangement Of Subnets-

 

  • All the subnets are connected to an internal router.
  • Internal router is connected to an external router.
  • The link connecting the internal router with a subnet is called as an interface.

 

Example-

 

 

Working-

 

When a data packet arrives,

  • External router forwards the data packet to the internal router.
  • Internal router identifies the interface on which it should forward the incoming data packet.
  • Internal router forwards the data packet on that interface.

 

Routing Table-

 

  • A table is maintained by the internal router called as Routing table.
  • It helps the internal router to decide on which interface the data packet should be forwarded.

 

Routing table consists of the following three fields-

  1. IP Address of the destination subnet
  2. Subnet mask of the subnet
  3. Interface

 

Also Read- Subnet Mask

 

Example-

 

Consider a network is subnetted into 4 subnets as shown in the above picture.

 

The IP Address of the 4 subnets are-

  1. 200.1.2.0 (Subnet A)
  2. 200.1.2.64 (Subnet B)
  3. 200.1.2.128 (Subnet C)
  4. 200.1.2.192 (Subnet D)

 

Then, Routing table maintained by the internal router looks like-

 

Destination Subnet Mask Interface
200.1.2.0 255.255.255.192 a
200.1.2.64 255.255.255.192 b
200.1.2.128 255.255.255.192 c
200.1.2.192 255.255.255.192 d
Default 0.0.0.0 e

Routing Table Example

 

When a data packet arrives to the internal router, it follows the following steps-

 

Step-01:

 

Router performs the bitwise ANDing of-

  • Destination IP Address mentioned on the data packet
  • And all the subnet masks one by one.

 

Step-02:

 

Router compares each result with their corresponding IP Address of the destination subnet in the routing table.

Then, following three cases may occur-

 

Case-01:

 

If there occurs only one match,

  • Router forwards the data packet on the corresponding interface.

 

Case-02:

 

If there occurs more than one match,

  • Router forwards the data packet on the interface corresponding to the longest subnet mask.

 

Case-03:

 

If there occurs no match,

  • Router forwards the data packet on the interface corresponding to the default entry.

 

Important Notes-

 

Note-01:

 

In fixed length subnetting,

  • All the subnets have the same subnet mask.
  • So, bitwise ANDing is performed only once.

 

If the result matches to any of the destination subnet IP Address,

  • Router forwards the data packet on its corresponding interface.
  • Otherwise, it is forwarded on the default interface.

 

Note-02:

 

In variable length subnetting,

  • All the subnets do not have the same subnet mask.
  • So, bitwise ANDing is performed once with each subnet mask.
  • Then, the above three cases are followed.

 

Note-03:

 

  • A host may also be directly connected to the router.
  • In that case, there exists a host specific route from the router to the host.
  • Router saves the IP Address of that host in the “Destination Network” column.
  • Router saves 255.255.255.255 in the “Subnet Mask” column.
  • The ANDing of its destination address and subnet mask yields the IP Address of the host.
  • When a data packet arrives for that specific host, bitwise ANDing is performed.
  • When the result of ANDing is the IP Address of the host, packet is forwarded to its host specific route.

 

Note-04:

 

  • Subnet mask for default route = 0.0.0.0
  • Subnet mask for host specific route = 255.255.255.255

 

PRACTICE PROBLEMS BASED ON ROUTING TABLE-

 

Problem-01:

 

A router uses the following routing table-

 

Destination Mask Interface
144.16.0.0 255.255.0.0 eth0
144.16.64.0 255.255.224.0 eth1
144.16.68.0 255.255.255.0 eth2
144.16.68.64 255.255.255.224 eth3

 

A packet bearing a destination address 144.16.68.117 arrives at the router. On which interface will it be forwarded?

  1. eth0
  2. eth1
  3. eth2
  4. eth3

 

Solution-

 

Router performs the bitwise ANDing of-

  • Destination address mentioned on the data packet
  • And each subnet mask one by one.

 

1st Row-

 

144.16.68.117 AND 255.255.0.0

= 144.16.0.0

Since result is same as the given destination address, so a match occurs.

 

2nd Row-

 

144.16.68.117 AND 255.255.224.0

= 144.16.64.0

Since result is same as the given destination address, so a match occurs.

 

3rd Row-

 

144.16.68.117 AND 255.255.255.0

= 144.16.68.0

Since result is same as the given destination address, so a match occurs.

 

4th Row-

 

144.16.68.117 AND 255.255.255.224

= 144.16.68.96

Since result is not same as the given destination address, so a match does not occur.

 

Now,

  • Clearly, there occurs more than one match.
  • So, router forwards the packet on the interface corresponding to the longest subnet mask.
  • Out of all, 255.255.255.0 is the longest subnet mask since it has maximum number of 1s.

 

So,

  • Router forwards the packet on the interface corresponding to the subnet mask 255.255.255.0.
  • The corresponding interface is eth2.

 

Thus, Option (C) is correct.

 

Problem-02:

 

The routing table of a router is shown below-

 

Destination Mask Interface
128.75.43.0 255.255.255.0 eth0
128.75.43.0 255.255.255.128 eth1
192.12.17.5 255.255.255.255 eth3
default eth2

 

On which interfaces will the router forward packets addressed to destination 128.75.43.16 and 192.12.17.10 respectively?

  1. eth1 and eth2
  2. eth0 and eth2
  3. eth0 and eth3
  4. eth1 and eth3

 

Solution-

 

Router performs the bitwise ANDing of-

  • Destination address mentioned on the data packet
  • And each subnet mask one by one.

 

Packet With Destination Address 128.75.43.16-

 

1st Row-

 

128.75.43.16 AND 255.255.255.0

= 128.75.43.0

Since result is same as the given destination address, so a match occurs.

 

2nd Row-

 

128.75.43.16 AND 255.255.255.128

= 128.75.43.0

Since result is same as the given destination address, so a match occurs.

 

3rd Row-

 

128.75.43.16 AND 255.255.255.255

= 128.75.43.16

Since result is not same as the given destination address, so a match does not occur.

 

Now,

  • Clearly, there occurs more than one match.
  • So, router forwards the packet on the interface corresponding to the longest subnet mask.
  • Out of all, 255.255.255.128 is the longest subnet mask since it has maximum number of 1s.

 

So,

  • Router forwards the packet on the interface corresponding to the subnet mask 255.255.255.128.
  • The corresponding interface is eth1.

 

Packet With Destination Address 192.12.17.10-

 

1st Row-

 

192.12.17.10 AND 255.255.255.0

= 192.12.17.0

Since result is not same as the given destination address, so a match does not occur.

 

2nd Row-

 

192.12.17.10 AND 255.255.255.128

= 192.12.17.0

Since result is not same as the given destination address, so a match does not occur.

 

3rd Row-

 

192.12.17.10 AND 255.255.255.255

= 192.12.17.10

Since result is not same as the given destination address, so a match does not occur.

 

Now,

  • Clearly, there occurs no match.
  • So, router forwards the packet on the interface corresponding to the default entry.
  • The corresponding interface is eth2.

 

Thus, Option (A) is correct.

 

Problem-03:

 

Host specific route has a subnet mask of _____ in the routing table.

  1. 255.255.255.255
  2. 0.0.0.0
  3. 255.0.0.0
  4. 0.0.0.255

 

Solution-

 

Option (A) is correct.

 

Problem-04:

 

Default route has a subnet mask of _____ in the routing table.

  1. 255.255.255.255
  2. 0.0.0.0
  3. 255.0.0.0
  4. 0.0.0.255

 

Solution-

 

Option (B) is correct.

 

Problem-05:

 

Default route can be described as-

  1. Destination values of 0.0.0.0 in the routing table
  2. It can be used if network has only one next hop router
  3. It is useful in keeping routing table small
  4. All of the above

 

Solution-

 

Option (D) is correct.

 

To gain better understanding about Routing Table,

Watch this Video Lecture

 

Next Article- Use of Subnet Mask

 

Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.

Subnetting in Networking | Subnetting Examples

Subnetting in Networking-

 

In networking,

  • The process of dividing a single network into multiple sub networks is called as subnetting.
  • The sub networks so created are called as subnets.

 

Example-

 

Following diagram shows the subnetting of a big single network into 4 smaller subnets-

 

 

Advantages-

 

The two main advantages of subnetting a network are-

  • It improves the security.
  • The maintenance and administration of subnets is easy.

 

Subnet ID-

 

  • Each subnet has its unique network address known as its Subnet ID.
  • The subnet ID is created by borrowing some bits from the Host ID part of the IP Address.
  • The number of bits borrowed depends on the number of subnets created.

 

Types of Subnetting-

 

Subnetting of a network may be carried out in the following two ways-

 

 

  1. Fixed Length Subnetting
  2. Variable Length Subnetting

 

1. Fixed Length Subnetting-

 

Fixed length subnetting also called as classful subnetting divides the network into subnets where-

  • All the subnets are of same size.
  • All the subnets have equal number of hosts.
  • All the subnets have same subnet mask.

 

2. Variable Length Subnetting-

 

Variable length subnetting also called as classless subnetting divides the network into subnets where-

  • All the subnets are not of same size.
  • All the subnets do not have equal number of hosts.
  • All the subnets do not have same subnet mask.

 

Subnetting Examples-

 

Now, we shall discuss some examples of subnetting a network-

 

Example-01:

 

Consider-

  • We have a big single network having IP Address 200.1.2.0.
  • We want to do subnetting and divide this network into 2 subnets.

 

Clearly, the given network belongs to class C.

 

 

Also Read- Classes of IP Address

 

For creating two subnets and to represent their subnet IDs, we require 1 bit.

So,

  • We borrow one bit from the Host ID part.
  • After borrowing one bit, Host ID part remains with only 7 bits.

 

 

  • If borrowed bit = 0, then it represents the first subnet.
  • If borrowed bit = 1, then it represents the second subnet.

 

IP Address of the two subnets are-

  • 200.1.2.00000000 = 200.1.2.0
  • 200.1.2.10000000 = 200.1.2.128

 

 

For 1st Subnet-

 

  • IP Address of the subnet = 200.1.2.0
  • Total number of IP Addresses = 27 = 128
  • Total number of hosts that can be configured = 128 – 2 = 126
  • Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] = [200.1.2.0, 200.1.2.127]
  • Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
  • Limited Broadcast Address = 255.255.255.255

 

For 2nd Subnet-

 

  • IP Address of the subnet = 200.1.2.128
  • Total number of IP Addresses = 27 = 128
  • Total number of hosts that can be configured = 128 – 2 = 126
  • Range of IP Addresses = [200.1.2.10000000, 200.1.2.11111111] = [200.1.2.128, 200.1.2.255]
  • Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
  • Limited Broadcast Address = 255.255.255.255

 

Example-02:

 

Consider-

  • We have a big single network having IP Address 200.1.2.0.
  • We want to do subnetting and divide this network into 4 subnets.

 

Clearly, the given network belongs to class C.

 

 

For creating four subnets and to represent their subnet IDs, we require 2 bits.

So,

  • We borrow two bits from the Host ID part.
  • After borrowing two bits, Host ID part remains with only 6 bits.

 

 

  • If borrowed bits = 00, then it represents the 1st subnet.
  • If borrowed bits = 01, then it represents the 2nd subnet.
  • If borrowed bits = 10, then it represents the 3rd subnet.
  • If borrowed bits = 11, then it represents the 4th subnet.

 

IP Address of the four subnets are-

  • 200.1.2.00000000 = 200.1.2.0
  • 200.1.2.01000000 = 200.1.2.64
  • 200.1.2.10000000 = 200.1.2.128
  • 200.1.2.11000000 = 200.1.2.192

 

 

For 1st Subnet-

 

  • IP Address of the subnet = 200.1.2.0
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.00000000, 200.1.2.00111111] = [200.1.2.0, 200.1.2.63]
  • Direct Broadcast Address = 200.1.2.00111111 = 200.1.2.63
  • Limited Broadcast Address = 255.255.255.255

 

For 2nd Subnet-

 

  • IP Address of the subnet = 200.1.2.64
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.01000000, 200.1.2.01111111] = [200.1.2.64, 200.1.2.127]
  • Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
  • Limited Broadcast Address = 255.255.255.255

 

For 3rd Subnet-

 

  • IP Address of the subnet = 200.1.2.128
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] = [200.1.2.128, 200.1.2.191]
  • Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191
  • Limited Broadcast Address = 255.255.255.255

 

For 4th Subnet-

 

  • IP Address of the subnet = 200.1.2.192
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.11000000, 200.1.2.11111111] = [200.1.2.192, 200.1.2.255]
  • Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
  • Limited Broadcast Address = 255.255.255.255

 

Example-03:

 

Consider-

  • We have a big single network having IP Address 200.1.2.0.
  • We want to do subnetting and divide this network into 3 subnets.

 

Here, the subnetting will be performed in two steps-

  1. Dividing the given network into 2 subnets
  2. Dividing one of the subnets further into 2 subnets

 

Step-01: Dividing Given Network into 2 Subnets-

 

The subnetting will be performed exactly in the same way as performed in Example-01.

After subnetting, we have-

 

 

Step-02: Dividing One Subnet into 2 Subnets-

 

  • We perform the subnetting of one of the subnets further into 2 subnets.
  • Consider we want to do subnetting of the 2nd subnet having IP Address 200.1.2.128.

 

For creating two subnets and to represent their subnet IDs, we require 1 bit.

So,

  • We borrow one more bit from the Host ID part.
  • After borrowing one bit, Host ID part remains with only 6 bits.

 

 

  • If 2nd borrowed bit = 0, then it represents one subnet.
  • If 2nd borrowed bit = 1, then it represents the other subnet.

 

IP Address of the two subnets are-

  • 200.1.2.10000000 = 200.1.2.128
  • 200.1.2.11000000 = 200.1.2.192

 

 

Finally, the given single network is divided into 3 subnets having IP Address-

  • 200.1.2.0
  • 200.1.2.128
  • 200.1.2.192

 

For 1st Subnet-

 

  • IP Address of the subnet = 200.1.2.0
  • Total number of IP Addresses = 27 = 128
  • Total number of hosts that can be configured = 128 – 2 = 126
  • Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] = [200.1.2.0, 200.1.2.127]
  • Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
  • Limited Broadcast Address = 255.255.255.255

 

For 2nd Subnet-

 

  • IP Address of the subnet = 200.1.2.128
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] = [200.1.2.128, 200.1.2.191]
  • Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191
  • Limited Broadcast Address = 255.255.255.255

 

For 3rd Subnet-

 

  • IP Address of the subnet = 200.1.2.192
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.11000000, 200.1.2.11111111] = [200.1.2.192, 200.1.2.255]
  • Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
  • Limited Broadcast Address = 255.255.255.255

 

Disadvantages of Subnetting-

 

Point-01:

 

Subnetting leads to loss of IP Addresses.

 

During subnetting,

  • We have to face a loss of IP Addresses.
  • This is because two IP Addresses are wasted for each subnet.
  • One IP address is wasted for its network address.
  • Other IP Address is wasted for its direct broadcasting address.

 

Point-02:

 

Subnetting leads to complicated communication process.

 

After subnetting, the communication process becomes complex involving the following 4 steps-

  1. Identifying the network
  2. Identifying the sub network
  3. Identifying the host
  4. Identifying the process

 

PRACTICE PROBLEMS BASED ON SUBNETTING IN NETWORKING-

 

Problem-01:

 

Suppose a network with IP Address 192.16.0.0. is divided into 2 subnets, find number of hosts per subnet.

Also for the first subnet, find-

  1. Subnet Address
  2. First Host ID
  3. Last Host ID
  4. Broadcast Address

 

Solution-

 

  • Given IP Address belongs to class C.
  • So, 24 bits are reserved for the Net ID.
  • The given network is divided into 2 subnets.
  • So, 1 bit is borrowed from the host ID part for the subnet IDs.
  • Then, Number of bits remaining for the Host ID = 7.
  • Thus, Number of hosts per subnet = 27 = 128.

 

For 1st Subnet-

 

  • Subnet Address = First IP Address =  192.16.0.00000000 = 172.16.0.0
  • First Host ID = 192.16.0.00000001 = 192.16.0.1
  • Last Host ID = 192.16.0.01111110 = 192.16.0.126
  • Broadcast Address = Last IP Address = 192.16.0.01111111 = 172.16.0.127

 

Problem-02:

 

What is not true about subnetting?

  1. It is applied for a single network
  2. It is used to improve security
  3. Bits are borrowed from network portion
  4. Bits are borrowed from Host portion

 

Solution-

 

Clearly, Option (C) is correct.

 

Problem-03:

 

In a class B, network on the internet has a subnet mask of 255.255.240.0. What is the maximum number of hosts per subnet?

  1. 4096
  2. 4094
  3. 4092
  4. 4090

 

Solution-

 

  • Number of bits reserved for network ID in the given subnet mask = 20.
  • So, Number of bits reserved for Host ID = 32 – 20 = 12 bits.
  • Thus, Number of hosts per subnet = 212 – 2 = 4094.
  • In class B, 16 bits are reserved for the network.
  • So, Number of bits reserved for subnet ID = 20 – 16 = 4 bits.
  • Number of subnets possible = 24 = 16.
  • Thus, Option (B) is correct.

 

To gain better understanding about IPv4 Subnetting,

Watch this Video Lecture

 

Next Article- Subnet Mask | Calculating Subnet Mask

 

Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.

IP Address in Networking | Problems

IP Address in Networking-

 

Before you go through this article, make sure that you have gone through the previous article on IP Address.

 

We have discussed-

  • IP Address is a unique address assigned to each computing device in an IP network.
  • ISP assigns IP Address to all the devices present on its network.
  • Casting refers to transmitting data (stream of packets) over the network.

 

Also Read- Types of Casting

 

In this article, we will discuss some practice problems based on IP Address.

 

Important Points-

 

Point-01:

 

For any given IP Address,

  • If the range of first octet is [1, 126], then IP Address belongs to class A.
  • If the range of first octet is [128, 191], then IP Address belongs to class B.
  • If the range of first octet is [192, 223], then IP Address belongs to class C.
  • If the range of first octet is [224, 239], then IP Address belongs to class D.
  • If the range of first octet is [240, 254], then IP Address belongs to class E.

 

Point-02:

 

For any given IP Address,

  • IP Address of its network is obtained by setting all its Host ID part bits to 0.

 

Point-03:

 

For any given IP Address,

  • Direct Broadcast Address is obtained by setting all its Host ID part bits to 1.

 

Point-04:

 

  • For any given IP Address, limited Broadcast Address is obtained by setting all its bits to 1.
  • For any network, its limited broadcast address is always 255.255.255.255

 

Point-05:

 

  • Class D IP Addresses are not divided into Net ID and Host ID parts.
  • Class E IP Addresses are not divided into Net ID and Host ID parts.

 

PRACTICE PROBLEMS BASED ON IP ADDRESS IN NETWORKING-

 

Problem-01:

 

For the following IP Addresses-

  1. 1.2.3.4
  2. 10.15.20.60
  3. 130.1.2.3
  4. 150.0.150.150
  5. 200.1.10.100
  6. 220.15.1.10
  7. 250.0.1.2
  8. 300.1.2.3

 

Identify the Class, Network IP Address, Direct broadcast address and Limited broadcast address of each IP Address.

 

Solution-

 

Part-A:

 

Given IP Address is-

1.2.3.4

 

  • IP Address belongs to class A
  • Network IP Address = 1.0.0.0
  • Direct Broadcast Address = 1.255.255.255
  • Limited Broadcast Address = 255.255.255.255

 

Part-B:

 

Given IP Address is-

10.15.20.60

 

  • IP Address belongs to class A
  • Network IP Address = 10.0.0.0
  • Direct Broadcast Address = 10.255.255.255
  • Limited Broadcast Address = 255.255.255.255

 

Part-C:

 

Given IP Address is-

130.1.2.3

 

  • IP Address belongs to class B
  • Network IP Address = 130.1.0.0
  • Direct Broadcast Address = 130.1.255.255
  • Limited Broadcast Address = 255.255.255.255

 

Part-D:

 

Given IP Address is-

150.0.150.150

 

  • IP Address belongs to class B
  • Network IP Address = 150.0.0.0
  • Direct Broadcast Address = 150.0.255.255
  • Limited Broadcast Address = 255.255.255.255

 

Part-E:

 

Given IP Address is-

200.1.10.100

 

  • IP Address belongs to class C
  • Network IP Address = 200.1.10.0
  • Direct Broadcast Address = 200.1.10.255
  • Limited Broadcast Address = 255.255.255.255

 

Part-F:

 

Given IP Address is-

220.15.1.10

 

  • IP Address belongs to class C
  • Network IP Address = 220.15.1.0
  • Direct Broadcast Address = 220.15.1.255
  • Limited Broadcast Address = 255.255.255.255

 

Part-G:

 

Given IP Address is-

250.0.1.2

 

  • IP Address belongs to class E
  • Network IP Address = Not available
  • Direct Broadcast Address = Not available
  • Limited Broadcast Address = Not available

 

Part-H:

 

Given IP Address is-

300.1.2.3

 

  • This is not a valid IP Address.
  • This is because for any given IP Address, the range of its first octet is always [1, 254].
  • First and Last IP Addresses are reserved.

 

Problem-02:

 

A device has two or more IP Addresses, the device is called-

  1. Workstation
  2. Router
  3. Gateway
  4. All of these

 

Solution-

 

  • All the given devices have a network layer.
  • So, they will have at least one IP Address.

 

In TCP/IP suite-

  • Workstation and gateway have all the 5 layers.
  • Router has only 3 layers last layer being network layer.

 

Workstation-

 

  • A user may configure more than one IP Addresses in his workstation / computer.
  • With more than one IP Address, it remains present in more than one networks.
  • So, if one network goes down, it is always reachable from other networks.

 

The following figure shows a host present in more than one networks-

 

 

  • It is important to note that IP Addresses are assigned to interfaces.
  • When we buy a new laptop, we usually get 2-3 interfaces.
  • Thus, a workstation can have more than one IP Addresses.

 

Router-

 

  • A router may be connected to various interfaces.
  • Each interface has a unique IP Address.
  • Thus, a router may also have more than IP Addresses.
  • Similar is the case with gateways because gateways are extension of routers.

 

Thus, Option (D) is correct.

 

Problem-03:

 

A host with IP Address 200.100.1.1 wants to send a packet to all the hosts in the same network.

What will be-

  1. Source IP Address
  2. Destination IP Address

 

Solution-

 

  1. Source IP Address = IP Address of the sender = 200.100.1.1
  2. Destination IP Address = Limited Broadcast Address = 255.255.255.255

 

Problem-04:

 

A host with IP Address 10.100.100.100 wants to use loop back testing.

What will be-

  1. Source IP Address
  2. Destination IP Address

 

Solution-

 

  • Source IP Address = 10.100.100.100
  • Destination IP Address = Loopback Testing Address = 127.0.0.1

 

Problem-05:

 

How many bits are allocated for Network ID and Host ID in 23.192.157.234 address?

 

Solution-

 

Given IP Address belongs to class A.

Thus,

  • Number of bits reserved for Network ID = 8
  • Number of bits reserved for Host ID = 24

 

Problem-06:

 

Which devices can use logical addressing system?

  1. Hub
  2. Switch
  3. Bridge
  4. Router

 

Solution-

 

  • Devices which have network layer as the last layer can only use logical addressing system.
  • Devices which have data link layer as the last layer can only use physical addressing system.
  • IP Addresses are the logical addresses and MAC Addresses are the physical addresses.

 

Option-A:

 

  • Hub can neither use physical addressing system nor logical addressing system.
  • This is because it has physical layer as the last layer.

 

Option-B:

 

  • Switch can use physical addressing system but not logical addressing system.
  • This is because it has data link layer as the last layer.

 

Option-C:

 

  • Bridge can use physical addressing system but not logical addressing system.
  • This is because it has data link layer as the last layer.

 

Option-D:

 

  • Router can use physical addressing system as well as logical addressing system.
  • This is because it has network layer as the last layer.

 

Thus, option (D) is correct.

 

Problem-07:

 

What is the network ID of the IP Address 230.100.123.70?

 

Solution-

 

  • Given IP Address belongs to class D.
  • Class D IP Addresses are not divided into the Network ID and Host ID parts.
  • Thus, there is no network ID for the given IP Address.

 

Problem-08:

 

Match the following-

 

Column-I:

 

  1. 200.10.192.100
  2. 7.10.230.1
  3. 128.1.1.254
  4. 255.255.255.255
  5. 100.255.255.255

 

Column-II:

 

  1. Class A
  2. Limited Broadcast Address
  3. Direct Broadcast Address
  4. Class C
  5. Class B

 

Solution-

 

(I, D), (II, A), (III, E), (IV, B), (V, C)

 

Problem-09:

 

Suppose that instead of using 16 bits for network part of a class B Address, 20 bits have been used. How many class B networks would have been possible?

 

Solution-

 

  • Total 20 bits are used for Network ID of class B.
  • The first two bits are always set to 10.
  • Then, with 18 bits, number of networks possible = 218

 

Problem-10:

 

What is the default mask for 192.0.46.10?

 

Solution-

 

  • Given IP Address belongs to class C.
  • For class C, default mask = 255.255.255.0

 

Next Article- Classless Addressing

 

Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.

TCP Sequence Number | Wrap Around Time

Transmission Control Protocol-

 

Before you go through this article, make sure that you have gone through the previous article on TCP in Networking.

 

We have discussed-

  • TCP continuously receives data from the application layer.
  • It divides the data into chunks where each chunk is a collection of bytes.
  • It then creates TCP segments by adding a TCP header to the data chunks.

 

TCP segment = TCP header + Data chunk

 

Also Read- TCP Header

 

In this article, we will discuss about TCP Sequence Number.

 

TCP Sequence Number-

 

  • Each TCP segment sent by the sender contains some bytes of data.
  • TCP assigns a unique number to each data byte for its identification.
  • This unique number is called as TCP Sequence Number.

 

Purpose-

 

Sequence number serves the following purposes-

  • It helps to identify each data byte uniquely.
  • It helps in the segmentation of data into TCP segments and reassemble them later.
  • It helps to keep track of how much data has been transferred and received.
  • It helps to put the data back into the correct order if it is received in the wrong order.
  • It helps to request data when it has been lost in transit.

 

Maximum Number of Sequence Numbers-

 

  • In TCP header, sequence number is a 32 bit field.
  • So, maximum number of possible sequence numbers = 232.
  • These sequence numbers lie in the range [0 , 232 – 1].

 

NOTE-

 

  • Maximum number of possible sequence numbers = 232.
  • This does not imply that only 232 bytes = 4 GB data can be sent using TCP.
  • The concept of wrap around allows to send unlimited data using TCP.

 

Concept Of Wrap Around-

 

The concept of wrap around states-

 

After all the 232 sequence numbers are used up and more data is to be sent,

the sequence numbers can be wrapped around and used again from the starting.

 

In general,

  • If the initial sequence number chosen is X.
  • Then sequence numbers are used from X to 232 – 1 and then from to 0 to X-1.
  • Then, sequence numbers are wrapped around to send more data.

 

Example-

 

  • Consider the initial sequence number used is 0.
  • Then after sending 4 GB data, all the sequence numbers would get used up.
  • To send more data, sequence numbers are reused from the starting.
  • Wrapping around can be done again and again to send more and more data.

 

Wrap Around Time-

 

  • Time taken to use up all the 232 sequence numbers is called as wrap around time.
  • It depends on the bandwidth of the network i.e. the rate at which the bytes go out.
  • More the bandwidth, lesser the wrap around time and vice versa.

 

Wrap Around Time ∝ 1 / Bandwidth

 

Formula-

 

If bandwidth of the network = x bytes/sec, then-

 

 

Life Time Of TCP Segment-

 

In modern computers,

  • Life time of a TCP segment is 180 seconds or 3 minutes.
  • It means after sending a TCP segment, it might reach the receiver taking 3 minutes in the worst case.

 

How Wrap Around Is Possible?

 

It is possible to wrap around the sequence numbers because-

  • The life time of a TCP segment is just 180 seconds.
  • Wrap around time is much greater than life time of a TCP segment.
  • So, by the time the sequence numbers wrap around, there is no probability of existing any segment having the same sequence number.
  • Thus, even after wrapping around, the sequence number of all the bytes will be unique at any given time.

 

Reducing Wrap Around Time-

 

Wrap around time can be reduced to the life time of a TCP segment.

 

This is because-

  • After the life time of a segment completes, it is considered that the segment no longer exists.
  • So, sequence numbers used by the segment frees up and can be reused.

 

To reduce the wrap around time to the life time of segment,

  • There must exist as many sequence numbers as there are number of data bytes sent in time equal to life time of segment.

 

Formula-

 

Number of bits required in the sequence number field

so that wrap around time becomes equal to lifetime of TCP segment

= log2 (lifetime of TCP segment x Bandwidth)

 

  • The number of bits will be greater than 32 bits.
  • The extra bits are appended in the Options field of TCP header.

 

PRACTICE PROBLEMS BASED ON WRAP AROUND TIME IN TCP-

 

Problem-01:

 

Given the bandwidth of a network is 1 MB / sec. Calculate the wrap around time.

 

Solution-

 

We know,

  • Wrap around time = Time taken to use all the 232 sequence numbers.
  • TCP assigns 1 sequence number to each byte of data.

 

To calculate wrap around time, we just need to calculate how much time will be taken to send 232 bytes of data.

 

Now,

  • Given bandwidth = 1 MB / sec = 106 bytes / sec.
  • It means 106 bytes of data is sent in time = 1 sec.
  • So, 232 bytes of data will be sent in time = ( 1 / 106 ) x 232 sec.
  • On solving, we get 1.19 hours.

 

Thus,

  • It will take 1.19 hours to consume all the 232 sequence numbers if bandwidth = 1 MB / sec.
  • Wrap Around Time = 1.19 hours.

 

Alternatively,

Using the formula, we have-

Wrap Around Time

= 232 / 106 sec

= 1.19 hours

 

Problem-02:

 

If bandwidth of the network is 1 GBps, how many extra bits will have to be appended in the Options field so that wrap around time becomes equal to the life time of segment?

 

Solution-

 

For wrap around time to become equal to the life time of TCP segment,

Number of sequence numbers required = Number of bytes sent in life time of TCP segment

 

We know-

  • Life time of TCP segment = 180 sec.
  • Bandwidth of the network = 1 GBps (Given)

 

Now,

  • Number of bytes transferred in 1 sec = 1 GB
  • So, number of bytes transferred in 180 sec = 180 GB = 180 x 230 bytes
  • So, number of sequence numbers required = 180 x 230

 

Suppose y number of bits in the sequence number field are required to represent the value 180 x 230.

 

So, we have-

2y = 180 x 230

ylog2 = log(180 x 230)

y = log2(180 x 230)

y = log2180 + log2230

y = 7.49 + 30

y ≅ 38

 

From here,

  • Total number of bits required for sequence numbers = 38 bits.
  • In TCP header, sequence number field is a 32 bit field.
  • So, extra bits required to be appended in the Options field = 38 – 32 = 6 bits.

 

Alternatively,

Using the formula, we have-

Total bits required

= log2 (life time of TCP segment x bandwidth)

= log2 ( 180 x 230)

= log2180 + log2230

= 7.49 + 30

= 38

 

From here,

  • Total number of bits required for sequence numbers = 38 bits.
  • In TCP header, sequence number field is a 32 bit field.
  • So, extra bits required to be appended in the Options field = 38 – 32 = 6 bits.

 

Problem-03:

 

In a network that has a maximum TPDU size of 128 bytes, a maximum TPDU lifetime of 30 sec and 8 bit sequence number, what is the maximum data rate per connection?

(TPDU is Transport layer protocol data unit which is the segment.)

 

Solution-

 

Given-

  • Maximum segment size (MSS) = 128 bytes
  • Segment lifetime = 30 sec
  • Bits in sequence number = 8

 

Now,

  • Maximum number of possible sequence numbers using 8 bits = 28 = 256.
  • So, maximum number of bytes that can be uniquely identified = 256 bytes.
  • Lifetime of a segment = 30 seconds.
  • So, maximum amount of data that can be sent in 30 seconds = 256 bytes.

 

Thus,

Maximum data rate per connection

= 256 bytes / 30 seconds

≈ 68 bits/sec

 

Problem-04:

 

Suppose that the advertised window 1 MB long. If a sequence number is selected at random from the entire sequence number space, what is the probability that the sequence number falls inside the advertised window?

 

Solution-

 

We know,

  • Number of bits in sequence number field = 32 bits.
  • So, Maximum number of sequence numbers possible = 232.
  • 232 bytes of data can be labeled uniquely with these sequence numbers.
  • Advertised window size = 1 MB = 220 bytes which uses 220 sequence numbers.

 

Therefore,

Required probability

= 220 / 232

= 1 / 212

 

Next Article- Three Way Handshake

 

Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.

Unicast Broadcast Multicast | IP Address

IP Address in Networking-

 

Before you go through this article, make sure that you have gone through the previous article on IP Address.

 

We have discussed-

  • IP Address is a 32 bit address that uniquely identifies each device on the network.
  • It is assigned by ISP to each device present on its network.

 

In this article, we will discuss about casting.

 

Casting in Networking-

 

Transmitting data (stream of packets) over the network is termed as casting.

 

Types Of Casting-

 

 

  1. Unicast
  2. Broadcast
  3. Multicast

 

1. Unicast-

 

  • Transmitting data from one source host to one destination host is called as unicast.
  • It is a one to one transmission.

 

 

Example-

 

Host A having IP Address 11.1.2.3 sending data to host B having IP Address 20.12.4.2.

Here,

  • Source Address = IP Address of host A = 11.1.2.3
  • Destination Address = IP Address of host B = 20.12.4.2

 

2. Broadcast-

 

  • Transmitting data from one source host to all other hosts residing in the same or other network is called as broadcast.
  • It is a one to all transmission.

 

Based on recipient’s network, it is classified as-

  1. Limited Broadcast
  2. Direct Broadcast

 

A. Limited Broadcast-

 

  • Transmitting data from one source host to all other hosts residing in the same network is called as limited broadcast.

 

 

NOTE

Limited Broadcast Address for any network

= All 32 bits set to 1

= 11111111.11111111.11111111.11111111

= 255.255.255.255

 

Example-

 

Host A having IP Address 11.1.2.3 sending data to all other hosts residing in the same network.

Here,

  • Source Address = IP Address of host A = 11.1.2.3
  • Destination Address = 255.255.255.255

 

B. Direct Broadcast-

 

  • Transmitting data from one source host to all other hosts residing in some other network is called as direct broadcast.

 

 

NOTE

Direct Broadcast Address for any network is the IP Address where-

  • Network ID is the IP Address of the network where all the destination hosts are present.
  • Host ID bits are all set to 1.

 

Example-

 

Host A having IP Address 11.1.2.3 sending data to all other hosts residing in the network having IP Address 20.0.0.0

Here,

  • Source Address = IP Address of host A = 11.1.2.3
  • Destination Address = 20.255.255.255

 

3. Multicast-

 

  • Transmitting data from one source host to a particular group of hosts having interest in receiving the data is called as multicast.
  • It is a one to many transmission.

 

 

Examples-

 

  • Sending a message to a particular group of people on whatsapp
  • Sending an email to a particular group of people
  • Video conference or teleconference

 

MAC Address Vs IP Address-

 

The following table summarizes the differences between MAC Address and IP Address-

 

MAC Address IP Address
It stands for Media Access Control Address. It stands for Internet Protocol Address.
MAC Address identifies the physical address of a computer on the internet. IP Address identifies the connection of a computer on the internet.
Manufacturer of NIC card assigns the MAC Address. Network Administrator or ISP assigns the IP Address.
Reverse Address Resolution Protocol (RARP) is used for resolving physical (MAC) Address into IP address. Address Resolution Protocol (ARP) is used for resolving IP Address into physical (MAC) address.

 

NOTE-

 

  • Multicast makes use of IGMP (Internet Group Management Protocol) to identify its group.
  • Each group is assigned with an IP Address from class D of IPv4.

 

To gain better understanding about Unicast Broadcast Multicast,

Watch this Video Lecture

 

Next Article- Practice Problems On IP Address

 

Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.