## Networking contd

### Network size

• sample
``````ip: 192.168.0.11
sm: 255.255.255.0
nid: 192.168.0
hid: 11
``````
• All the devices in the network will have same network id i.e network id is fixed
• Network size => 2 ^ (number of host id bits) – 2
``````hid = 1 octet = 8 bits
network size  = 2^8 - 2 = 256 - 2 = 254
``````
• the two which we have subtracted represents two ips

• zero (192.168.0.0) => network id
• To design networks we have two approaches

• classful networking
• classless interdomain routing (CIDR)
• Figure out number of bits for host id and for network id
``````# a network of 200 devices

2^n - 2  ~= 200
n = 8 ( number of zeros)
N = 32 - 8 = 24
SM: 11111111.11111111.11111111.00000000
255.255.255.0

# a network of 500 devices
2^n -2  ~= 500
n = 9
N = 32 - 9 = 23
SM: 11111111.11111111.11111110.00000000
255.255.254.0

# a network of 25000 devices
2^n - 2 ~ = 25000
n = 15
N  = 32 -15 = 17
SM: 11111111.11111111.10000000.00000000
255.255.128.0

# a network of size 32 devics
2^n-2 ~= 32
n=6
N = 32-6 = 26
SM: 11111111.11111111.11111111.11000000
255.255.255.192

# a network of size 200000 devices
2 ^n -2 ~ = 200000
n = 18
N = 32 - 18 = 14
SM: 11111111.11111100.00000000.00000000
255.252.0.0

``````
• Public network: This is accessible from internet
• private network: This is private network meant for internal use. For this there are reserved ip ranges

### CIDR Notation

• The CIDR notation is represented as `x.x.x.x/N` where `N = number of 1's i.e. network id`
• Expand CIDR
``````192.168.0.0/24

ip:        192.     168.       0.       0
range:     192.     168.       0.xxxxxxxx
start:     192.     168.       0.00000000 => 192.168.0.0
end:       192.     168.       0.11111111 => 192.168.0.255
sm:   11111111.11111111.11111111.00000000

172.16.0.0/22
ip:      172.      16.       0.       0
range:   172.      16.000000xx.xxxxxxxx
start:   172.      16.00000000.00000000 => 172.16.0.0
end:     172.      16.00000011.11111111 => 172.16.3.255
sm: 11111111.11111111.11111100.00000000

ip: 10.128.0.0/13
N = 13 (1's)
n = 32-13 (0's) = 19

ip:       10.     128.       0.       0
range:    10.10000xxx.xxxxxxxx.xxxxxxxx
start:    10.10000000.00000000.00000000 = 10.128.0.0
end:      10.10000111.11111111.11111111 = 10.135.255.255
sm: 11111111.11111000.00000000.00000000

ip: 192.168.130.0/23
range:   192.     168.1000001x.xxxxxxxx
start:   192.     168.10000010.00000000 = 192.168.130.0
end:     192.     168.10000011.11111111 = 192.168.131.255
sm: 11111111.11111111.11111110.00000000

ip: 10.100.100.128/26
range:    10.     100.     100.10xxxxxx
start:    10.     100.     100.10000000 = 10.100.100.128
end:      10.     100.     100.10111111 = 10.100.100.191
sm: 11111111.11111111.11111111.11000000

# waiting till 10:23 AM
``````

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

## About continuous learner

devops & cloud enthusiastic learner