Monday, January 25

Study Notes for - Computer Networks

Given a Class what is the total number of IP address present
Class A -> 2^31 -> IP address start with 0
Class B -> 2^30 -> IP address start with 10
Class C -> 2^29 -> IP address start with 110
Class D -> 2^28 -> IP address start with 1110
Class E -> 2^28 -> IP address start with 1111

IP address is of 32 bits.
Divide it into four parts of 8 bits i.e octats. Take each octat and convert it into decimal number representation and put a dot. It is called as dotted number decimal system. To find which class an IP address belongs to, take the first octate and convert it into a binary format.



Class A:
Number of IP adderess in Class A is 2^31
Take 32 bits and divide it into two parts
8 bits for Network ID
24 bits for Host ID

Out of the 8 bits of Network ID, first bit is 0 so 7 bits remain. So there are total 2^7 i.e 128 networks of Class A present
In a Network, how many IP addresses are present? It is 2^24 which is 16 million, therefore, 16 million IP address present in one network of IP address.

Range of Class A network is 1 - 126 Network ID

Class B:
Number of IP address present in Class B is 2^30
Class B always starts with 10

32 bits is Divided into 16 bits of Network ID and 16 bits of Host ID
In Network ID, first two bits is 10, so total 2^14 bits remain which is nearly 16k bits

Total number of IP address 2^16 per Network ID

First Octate will be 10_ _ _ _ _ _
So
10 0 0 0 0 0 0 -> 128
10 0 0 0 0 0 1 -> 129
...
...
...
10 1 1 1 1 1 1 -> 191

Range of Class B is 128 - 191
Please note, we have considered only the first octate.

Banks like SBI, IRCTC use this Class B IP addresses.

Class C:
Total IP address present in Class C is 2^29

32 bits, are divided into 24 bits of Network ID and 8 bits of Host ID
First 3 bits are 110 so total Network Bits remaining are 21 bits

First Octate
110 _ _ _ _ _
110 0 0 0 0 0 -> 192
110 0 0 0 0 1 -> 193
...
...
...
110 1 1 1 1 1 -> 223

Range is 192 - 223

Class D and Class E:
Did not divide into Network Id or Host Id, Entire IP address is left as is. So total IP address is 2^28
Range of Class D is 224 - 239
Class D is used for Multicasting

Range of Class E is 240 - 255
Usage of Class E is unknown


Number of Host that can be configured are 2 less than the number of Network ID available.



Types of Casting
1) Unicast - Sending a packet from one host to another host

Consider a netwrok with ID 11.0.0.0 - It is CLASS A
We have a host in this network - > 11.1.2.3

From this host we want to send a packet to other host
Consider the Network ID to be 20.0.0.0
Consider the Host to be 20.1.2.3

We have a packet with Data (D) and Source Address (SA) and Destination Address (DA). Refer below image of Unicast example.


2) Broadcasting - Two types of Broadcast
a) Limited Broadcasting
b) Directed Broadcasting

Limited Broadcasting
Consider a network and a host. If we want to send message from this host to multiple other host in the same network. If we had to use Unicasting in this scenario, then note that in Class A there are nearly 2^24 i,e 16 million host available and using unicasting would mean that the host would have to send nearly 16 million packets. This may hurt the hardware and software. In such scenario, we use limited broadcasting.

In limited broadcasting, the packet will have message, followed by the Network ID as the source address and since it wants to send to all the host in that Network, so the destination address will be 32 bits of all 1's. If we encode it to dotted decimal number it will be 255.255.255.255. So now this packet will be received by all the hosts in the network

So the limited broadcast address is 255.255.255.255

Directed Broadcasting
Consider a Network 11.0.0.0 with some host which wants to be able to send message to another network to all the host, the network ID being 20.0.0.0. So the packet will have one part with the message, the source address will be the network ID i.e 11.0.0.0 and the Destination address will be 20 (which is network ID of destination) followed by all 1's i.e 255.255.255.255 so it will be 20.255.255.255

So the Directed Broadcast address is (NID).255.255.255


Subnet:
Dividing a big network into smaller networks. A big network will have maintenance cost along with security cost. So the idea is to divide a big network into smaller networks. So maintenance of a small network is easier.

Disadvantage of Subnet:
Consider in a big network, if you had to reach a host, the identification can be achieved in 3 steps. Identify the Network, Identify the host and then the process in that host. However if you have a subnet, the identification becomes complex. Reach the network first, then the subnet, then the host and finally the host. So this requires 4 steps. This is a disadvantage, but the advantages of Subnet are more prominent.

Subnet Mast
32 bit number,
1's represent - Network ID and Subnet ID
0's represent - Host ID

Router uses a subnet mast to find out which IP address it will forward the packet to.

Routing table will contain, network ID, Subnet mast, and what is the interface.

Be the first one to Comment!!!

Post a Comment