MultiCloud Classroom notes 02/Jan/2025

Private Networking

  • Private networks have predefined ip ranges

    • 192.168.0.0 to 192.168.255.255
    • 10.0.0.0 to 10.255.255.255
    • 172.16.0.0 to 172.31.255.255
  • When we get an ip address it carries network id and host id
  • To find the network id and host id we use subnet mask
    Preview
  • The above case
     1   2  3  4
ip: 192.168.0.167
sm: 255.255.255.0
-------------------

nid: 255 is in octets 1,2,3
     192.168.0 (nid)
    this is constant for all devices in network

hid: 0 is in octet 4
       167 (hid)
    this represents the variable part

size = 2^8 - 2
     = 256 - 2
     = 254

network id = 192.168.0.0
broadcast ip = 192.168.0.255
  • We can use the above to calculate the size of network
size = 2 ^ n - 2
n = number of bits reserved for host id

  • Two ips cannot be allocated

    • all 0’s represent network id
    • all 1’s represent broadcast ip
  • Lets try for the following ip info
ip: 192.168.10.17
sm: 255.255.0.0

nid: 192.168
hid: 10.17

size: 2^n - 2 = 2^16 - 2
      = 65536 - 2  = 65534
  • I want to create a private network for 1000 devices, possible values of n are 8,16,24
size = 2 ^ n - 2
1000 ~= 2 ^ n 
n = 16

  • CIDR (Classless interdomain routing) can help in creating networks closer to required sizes

CIDR

    • I want to create a private network for 1000 devices, possible values of n are 2 to 31
size = 2 ^ n - 2
1000 ~= 2 ^ n 

n (host id) = 10
N (network id) = 32 - 10 = 22

SM = 11111111.11111111.11111100.00000000
   = 255.255.252.0
  • Total SM possibilities in an octet
11111111 = 255
11111110 = 254
11111100 = 252
11111000 = 248
11110000 = 240
11100000 = 224
11000000 = 192
10000000 = 128
  • I want a network of 50 devices
2^n ~= 50
n = 6
N = 32 - 6 = 26

SM: 11111111.11111111.11111111.11000000
     255.255.255.192
  • Choosing an ip can happen over 3 possibilities
    • 192.168.0.0 to 192.168.255.255
    • 10.0.0.0 to 10.255.255.255
    • 172.16.0.0 to 172.31.255.255
  • For a network with 1000 devices the host bits are 10
size = 2 ^ n - 2
1000 ~= 2 ^ n 

n (host id) = 10
N (network id) = 32 - 10 = 22

SM = 11111111.11111111.11111100.00000000
   = 255.255.252.0

ip =           192.168.000000xx.xxxxxxxx
sip =          192.168.00000000.00000000 = 192.168.0.0
eip =          192.168.00000011.11111111 = 192.168.3.255
SM = 11111111.11111111.11111100.00000000
  • For a network with 50 devices
2^n ~= 50
n = 6
N = 32 - 6 = 26


ip:                     10.0.0.00xxxxxx
sip:                    10.0.0.00000000 = 10.0.0.0
eip:                    10.0.0.00111111 = 10.0.0.63
SM: 11111111.11111111.11111111.11000000
     255.255.255.192
  • Try the same for a private network with 500 devices
2^n ~= 500
n = 9
N = 32 - 9 = 23

ip:           192.168.0000000x.xxxxxxxx
sip:          192.168.00000000.00000000 = 192.168.0.0
eip:          192.168.00000001.11111111 = 192.168.1.255
SM: 11111111.11111111.11111110.00000000 = 255.255.254.0
  • I want a private network with 100000 devices

2^n ~= 100000
n = 17
N = 32 - 17 = 15


ip:        10.0000000x.xxxxxxxx.xxxxxxxx
sip:       10.00000000.00000000.00000000 = 10.0.0.0
eip:       10.00000001.11111111.11111111 = 10.1.255.255
SM : 11111111.11111110.00000000.00000000 = 255.254.0.0
  • CIDR has a notation which is expressed as Start-IP/N
  • Example 1
10.0.0.0/8
N (fixed bits)  = 8
n (variable) = 32 - 8 = 24

ip: 10.0.0.0/8
ip:       10.xxxxxxxx.xxxxxxxx.xxxxxxxx
sip:                                   = 10.0.0.0
eip:      10.11111111.11111111.11111111 = 10.255.255.255
SM: 11111111.00000000.00000000.00000000
  • Example 2: 192.168.0.0/18
sip = 192.168.0.0

N = 18
n = 32 -18 = 14

ip:           192.168.00xxxxxx.xxxxxxx
sip:                                   = 192.168.0.0
eip:          192.168.00111111.1111111 = 192.168.63.255
SM: 11111111.11111111.11000000.00000000
  • Example 3: 10.10.10.0/23
sip = 10.10.10.0
N = 23
n = 32 - 23 = 9

ip:             10.10.0000101x.xxxxxxxx
                                        = 10.10.10.0
eip:            10.10.00001011.11111111 = 10.10.11.255
SM: 11111111.11111111.11111110.00000000
  • All private ip ranges can be expressed in cidr ranges
    • 192.168.0.0/16 = 192.168.0.0 to 192.168.255.255
    • 10.0.0.0/8 = 10.0.0.0 to 10.255.255.255
    • 172.16.0.0/12 = 172.16.0.0 to 172.31.255.255

I want to create a private network of size 100 devices

  • Calculate n (variable bits)
2^n - 2 ~= 100
2^n ~= 100
n = 7
N = 32 - 7 = 25

172.16.0.0/25
ip:                   172.16.0.0xxxxxxx
sip:                                    = 172.16.0.0
eip:                  172.16.0.01111111 = 172.16.0.127
SM: 11111111.11111111.11111111.10000000

I want to create a network of size 2000 devices

2^n  = 2000
n = 11
N = 32 - 11 = 21

ip: 10.100.0.0/21
sip: 10.100.0.0
ip:            10.100.00000xxx.xxxxxxxx
eip:           10.100.00000111.11111111 = 10.100.7.255
SM: 11111111.11111111.11111000.00000000

  • Exercises: Create private networks of following sizes

    • 25
    • 70000
  • Default gateway represents the ipaddress of router

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube