Networking contd..
- We have three possible subnet masks
255.255.255.0 => 256
255.255.0.0 => 65536
255.0.0.0 => 16777216
- To Create networks we have two addressing mechanisms
- Classful
- Classless
- Classful:
- In this mechanism all the IPv4 addresses are divided into 5 classes
- A
- B
- C
- D
- E
- In this mechanism all the IPv4 addresses are divided into 5 classes
| Class A | Class B | Class C | |
|---|---|---|---|
| Address Range | 0.0.0.0-127.255.255.255 | 128.0.0.0-192.255.255.255 | 192.0.0.0 – 223.255.255.255 |
| Defult Subnet Mask | 255.0.0.0 | 255.255.0.0 | 255.255.255.0 |
| Maximum Number of Hosts | 16777214 | 65534 | 254 |
| private address range | 10.0.0.0 – 10.255.255.255 | 172.16.0.0 – 172.31.255.255 | 192.168.0.0 – 192.168.255.255 |
-
Private networks vs Public networks:
- Public network is accesible from the internet
- Private network cannot be accesed from internet and is designed for internal communication.
-
Classless Inter-Domain Routing (CIDR):
- Was introduced in 1993 to replace the classful addressing. It uses Variable lenght subnet masks
- It has CIDR Notation which helps in representing subnet masks and ip ranges
192.168.0.0/24
192.168.0.x
255.255.255.0
192.168.0.0/16
192.168.x.x
255.255.0.0
10.0.0.0/8
10.x.x.x
255.0.0.0
- Advantage of viewing subnet mask as binary
200 devices
(254, 65534, 16777214)
255.255.255.0 (decimal reprsentation)
11111111.11111111.11111111.00000000 (8 zeros) => 2^8 -2 => 256-2 => 254
11111111.11111111.11111110.00000000 (9 zeros) => 2^9-2 => 512-2 => 510
11111111.11111111.11111100.00000000 (10 zeros)
11111111.11111111.11111000.00000000 (11 zeros)
- Lets assume we want to have a network with 2000 devices
2^11 ~= 2000
we need 11 bits for host id
So my subnet mask will be
11111111.11111111.11111000.00000000
255.255.248.0
- We need to create a network with 9000 devices
2^14 = 16384
i.e 14 bits for host id
11111111.11111111.11000000.00000000
255.255.192.0
- Exercise: We need to create a network with 100 devices
2^7 ~= 126
i.e 7 bits for host id and 32-7 (25) bits for network id
11111111.11111111.11111111.10000000
255.255.255.128
- Possible SM’s in a octect
11111111 => 255
11111110 => 254
11111100 => 252
11111000 => 248
11110000 => 240
11100000 => 224
11000000 => 192
10000000 => 128
- Lets look at the following cidr notation
192.168.0.0/25
SM: 11111111.11111111.11111111.10000000
IP: 11000000.10101000.00000000.00000000
11000000.10101000.00000000.0 xxxxxx
11000000.10101000.00000000.0 0000000 => 192.168.0.0
11000000.10101000.00000000.0 1111111 => 192.168.0.127
192.168.128.0/22
SM: 11111111.11111111.11111100.00000000
IP: 11000000.10101000.10000000.00000000
11000000.10101000.100000 xx.xxxxxxx
11000000.10101000.100000 00.00000000 => 192.168.128.0
11000000.10101000.100000 11.11111111 => 192.168.131.255
10.10.0.0/18
SM: 11111111.11111111.11000000.00000000 => 255.255.192.0
IP: 00001010.00001010.00000000.00000000
IP: 00001010.00001010.00xxxxxx.xxxxxxxx
00001010.00001010.00000000.00000000 => 10.10.0.0
00001010.00001010.00111111.11111111 =>10.10.63.255
- Exercise:
172.16.0.0/12
192.168.0.0/16
10.0.0.0/8
10.100.192.0/20
10.10.0.0/21
