Monday 26 December 2016

2:Computer Networks

Introduction, topology, OSI model, Concept of layering, Communication Media,LAN technologies
(Ethernet). Flow and error control techniques, switching. IPv4/IPv6, routers and routing algorithms
(distance vector, link state). TCP/UDP and sockets, congestion control. Application layer protocols

(DNS, SMTP, POP, FTP, HTTP). Basics of Wi‐Fi

Sub-netting :


What is the maximum number of IP addresses that can be assigned to hosts on a local subnet that uses the 255.255.255.224 subnet mask?

255.255.255.224 i.e Binary of 255 is 11111111 and Binary number of 224 is 11100000.


Here 1 Represent On bit and 0 represents Off bit.
Then how to calculate Host Id.

See Here,

Formula Host Id = 2^off bit - 2 i.e 2^5 = 32 - 2 = 30.
And Net Id is = 2^on bit = 2^3 = 8.
That's why Answer is 30.


Decimal to binary conversion:

255.255.255.255

128 64 32 16 8 4 2 1 2 to the power of 7 = 128.

2 to the power of 6 = 64 .

1 1 1 1 1 1 1 1

128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. 

11111111.11111111.11111111.11111111
255 255 255 255

Eg: 192.168.10.10

192-- 128 64 32 16 8 4 2 1
------> 1 1 0 0 0 0 0 0
168 --> 1 0 1 0 1 0 0 0
10 ---> 0 0 0 0 1 0 1 0
10 ---> 0 0 0 0 1 0 1 0






Remember This table
128 192 224 240 248 252 254 255
128 64 32 16 8 4 2 1

            
first line is incremented from right side i.e 255->255-1->254-2->252-4->248-4 and so on.
second line is incremented at 2 to the power 2 easy right :)

Also see this ip address structure

                 00000000. 00000000. 00000000. 00000000
                       8               16             24                32

Now we can look at an example here


Your router has the following IP address on Ethernet0: 153.34.173.242/17
find valid host IDs on the LAN interface attached to the router?

153.34.173.242/17

so where 17 is sitting it is 24 Octal in second table right
So subtract it from 24
24-17 = 7   i.e .  (2^7=128)
Now see what is in front of 128 it is 128 in table you memorised :)



and u already know that it is class B address so u need to write like 

255.255.128.0

So simple it is your subnet MASK : 255.255.128.0
And your network id is  : 153.34.128.0
First host Id is : 153.34.128.1
Last host id is : 153.34.255.255
Broadcast address is :153.34.155.155

Isn't it so easy :)

we can take one more example 192.168.192.10/29.
so where 29 is sitting it is 32 Octal in second table right
so 32-29 = 3 i.e 2^3 = 8


Now see what is in front of 8 it is 248 in table you memorised :)

So simple it is your subnet MASK : 255.255.255.248  (because it is class c address)
And your network id is  : 153.34.1.0
First host Id is : 153.34.192.1
Last host id is : 153.34.192.255
Broadcast address is :153.34.192.155





Que :What is the maximum number of IP addresses that can be assigned to hosts on a local subnet that uses the 255.255.255.224 subnet mask?

Easy it is substract it from 256-224 = 32 
32-2 (1 is broadcast add and one is self) = 30 is the correct answer :)


You need to subnet a network that has 5 subnets, each with at least 16 hosts. Which classful subnet mask would you use?
Network bits = 3.
Host bits = 5.
Formula:
To find number of subnet = 2^n(n = no>of borrowed network bits).
To find no.of host = 2^h-2(h = no>of borrowed host bits).

Did you get it ? no! lets try one more problem...

 If a class B network on the Internet has a subnet mask of 255.255.248.0, what is the maximum number of hosts per subnet?
(A) 1022
(B) 1023
(C) 2046
(D) 2047
Answer (C)
The binary representation of subnet mask is 11111111.11111111.11111000.00000000. 

By number of 0  we can find host and by number of 1 we can find network How lets see..
No of 0 is 11 so 2^11 = 2048
The address with all bits as 1 is reserved as broadcast address and address with all host id bits as 0 is used as network address of subnet.
Now 2048-2 = 2046 total number of host .
In general, the number of addresses usable for addressing specific hosts in each network is always 2^N – 2 where N is the number of bits for host id.

Formula :
To find number of subnet = 2^n(n = no>of borrowed network bits).
To find no.of host = 2^n-2 (n = no>of borrowed host bits  i.e 0).