MultiCloud Classroom notes 30/Nov/2024

Networking contd

  • Any device connected to a network will get an ip address which is a unique id to access that device
  • An Ipaddress can be public or private
  • public ip (unique globally)
  • private ip (unique within network)
  • Our discussion will be on private network so private ip’s primarily
  • IP Address = network id + host id
  • IP Address are of two formats
    • IPv4:
      • ip address is a 32 bit number which is divided into 4 parts (octect) x.x.x.x
      • each octet will have 256 numbers ranging from 0 to 255
      • ipv4 range is 0.0.0.0 to 255.255.255.255
    • IPv6:
      • ip address is 128 bit number
  • To determine what is network id and what is host id we need subnet masks
  • Examples
## 1
ip: 10.0.1.7
sm: 255.255.255.0
nid: 10.0.1
hid: 7


## 2
ip: 10.0.1.7
sm: 255.255.0.0
nid: 10.0
hid: 1.7

  • network id is constant for every device in the network and host id is variable, this determines the size of network.
  • size of network = 2 ^ (n) – 2
    • n = number of host id bits
  • we subtract from 2 because
    • all zeros is network id
    • all ones (255) is broadcast id
  • Examples
## 1
ip: 10.0.1.7
sm: 255.255.255.0
nid: 10.0.1
hid: 7
hid size = 1 octect = 8 bits
size = 2^8 - 2 = 256 - 2 = 254


## 2
ip: 10.0.1.7
sm: 255.255.0.0
nid: 10.0
hid: 1.7

hid size = 2 octets = 16 bits
size = 2^16-2 = 65536 - 2 = 65534

## 3
ip: 10.0.1.7
sm: 255.0.0.0
nid: 10
hid: 0.1.7

hid size = 3 octects = 24 bits

size = 2^24 -2 = 16777216 - 2 = 16777214

  • I want a network to connect 500 devices
size = 500

2 ^n - 2 ~ = 500
valid values of n = 8, 16, 24
in this case lets go with 16

n = 16 = 2 octects for host id

sm = 255.255.0.0
  • CIDR (Classless Interdomain routing was introduced). All clouds use CIDR to define network ranges

CIDR

  • look at ip address as bits not octets
  • lets go with the example
ip: 10.0.1.7
SM: 255.255.255.0 (older)
SM: 11111111.11111111.11111111.00000000
  • hostid : will have sequence of 1’s in SM
  • network id: will have sequence of zeros
  • I want a network with 500 devices
2 ^ n - 2 = 500

valid values of n are any where between 2 to 31

2^n ~= 500
n = 9
hid bits = 9
nid bits = 32 - 9 = 23

SM: 11111111.11111111.11111110.00000000
     255.255.254.0
  • I want a network with 100 devices what is SM
2^n - 2 ~ = 100
2^n ~= 100
n = 7

hid bits = 7
nid bits = 32 - 7 = 25

SM: 11111111.11111111.11111111.10000000
    255.255.255.128
  • I want a network of size 2000 devices find the subnet mask
2 ^ n -2 ~= 2000
n = 11
hid bits = 11
nid bits = 32 - 11 = 21

SM: 11111111.11111111.11111000.00000000
    255.255.248.0
  • CIDR is represented as x.x.x.x/N
    • N = number of network id bits
  • Expand CIDR 10.0.0.0/24:
ip:                     10.0.0.xxxxxxxx
ip:                     10.0.0.00000000 = 10.0.0.0
ip:                     10.0.0.11111111 = 10.0.0.255
SM: 11111111.11111111.11111111.00000000
range: 10.0.0.0 to 10.0.0.255
  • Expand CIDR: 10.0.0.0/8
ip:       10.xxxxxxxx.xxxxxxxx.xxxxxxxx
ip:       10.00000000.00000000.00000000 = 10.0.0.0
ip:       10.11111111.11111111.11111111 = 10.255.255.255
SM: 11111111.00000000.00000000.00000000
  • Expand CIDR: 172.16.0.0/12
ip       172.0001xxxx.xxxxxxxx.xxxxxxxx
ip:      172.00010000.00000000.00000000 = 172.16.0.0
ip       172.00011111.11111111.11111111 = 172.31.255.255
SM: 11111111.11110000.00000000.00000000
  • Expand CIDR: 192.168.128.0/18
ip:           192.168.10xxxxxx.xxxxxxxx
ip:           192.168.10000000.00000000 = 192.168.128.0
ip:           192.168.10111111.11111111 = 192.168.191.255
SM: 11111111.11111111.11000000.00000000
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Exit mobile version
%%footer%%