## Networking Contd

• Consider the following details
``````ip:  172.16.0.100
sm:  255.255.0.0

nid: 172.16
hid:        0.100

host = 2 octets => 16 bits
network size = 2^n-2 = 2^16-2 = 65536-2 = 65534

``````

## Classless InterDomain Routing

• Consider the following example
``````ip:  192.168.0.100
sm:  255.255.255.0
11111111.11111111.11111111.00000000

cidr:  192.168.0.100/24

bits for hosts =  32-24 = 8
network size = 2^8-2 = 256-2 = 254

cidr: 192.168.0.100/23
sm: 11111111.11111111.11111110.00000000
255.255.254.0
bits for hosts = 32-23 = 9
network size = 2^9-2 = 512-2 = 510

cidr: 192.168.0.0/26
sm: 11111111.11111111.11111111.11000000
255.255.255.192

host bits = 32-26 = 6
network size = 2^6-2 = 64-2 = 62
``````
• Now lets try to identify a network capable of connecting 30000 devices
``````2^n-2 ~= 30000
2^n ~= 30000
n = 15 ( number of host bits)
x.x.x.x/(32-15)
x.x.x.x/17
sm: 11111111.11111111.10000000.00000000
255.255.128.0

``````
• And also 120000 devices
``````2^n-2 ~= 120000
2^n ~= 120000
n = 17 ( number of host bits)
x.x.x.x/(32-17) = x.x.x.x/15
sm: 11111111.11111110.00000000.00000000
: 255.254.0.0
``````
• We always create private networks. There are some fixed cidr ranges for private networking
• Consider the following scenario
``````total network = 1000
2^n ~= 1000 => host bits = 10 network id bits => 32-10 = 22
ip range => cidr range = 192.168.0.0/22
sm office network = 11111111.11111111.11111100.00000000
``````

* Now identify the cidr for rooms

``````2^n ~= 200
n (host bits) = 8
network id = 32-8 = 24
cidr: x.x.x.x/24

office: 192.168.0.0/22
sm office network = 11111111.11111111.11111100.00000000
room 1: 192.168.0.0/24
sm room: 11111111.11111111.11111111.00000000

11111111.11111111.11111100.00000000
11111111.11111111.11111111.00000000
-----------------------------------
XXXXXXXX.XXXXXXXX.XXXXXX00.YYYYYYYY => 11111111.11111111.11111100.00000000 => 192.168.0.0/24
XXXXXXXX.XXXXXXXX.XXXXXX01.YYYYYYYY => 11111111.11111111.11111101.00000000 => 192.168.1.0/24
XXXXXXXX.XXXXXXXX.XXXXXX10.YYYYYYYY => 11111111.11111111.11111110.00000000 => 192.168.2.0/24
XXXXXXXX.XXXXXXXX.XXXXXX11.YYYYYYYY => 192.168.3.0/24
``````

This site uses Akismet to reduce spam. Learn how your comment data is processed.