top of page
Writer's pictureMukesh Chanderia

IPv4 & IPv6

IPv4


32 bit long & contains 4 octets.


Each octet has 8 binary bits


IPv4 class range





Subnetting



Host Bit = 0


Network Bit = 1


We got Class C ip address from ISP ---> 192.168.0.0/24


A) Break ip in such a way that I get 32 networks ---> How many hosts will be in each network?


Number of Network bits => 5 => 2*2*2*2*2 = 32



Now here network range will be of 8 (No of hosts in subnet)


1 Network -- 0 -7 ---> Number of hosts in each subnet is 8

2 Network --- 8 - 15

......................................


32 Network 248 - 255


B) Break ip address in such a way that I get max 8 hosts per subnet ----> How many subnets will be created?


Number of Host bits => 3 => 2*2*2* = 8



So here result is same as above . Hence , in short we need to find the network class range in both cases.


IPv6


128 bit long (4 times bigger than IPv6) has 32 nibbles


Here it's not stickly required to set 64 bits as network and 64 bits as host bit but if we do than ipv6 will be easy to work. Hence, followed everytime.



Rules to write ipv6 small


  1. Remove Leading O's




2. Eliminate O's with :: (Double Colon)



3. Only single Double Colon is allowed




Types of IPv6 Address


  1. IPv6 Global Unicast Address for Global Communication

  2. Link Local Address for local communication --> Just like Mac address confined to LAN --> FE80::/10

  3. Loopback Address --> "::/128"

  4. Unspecified means --> No address is being configured "::/128"

  5. Unique Local --> Just like Private Address of IPv4 --> "FC00::/7"

  6. Multicast Address --> One to many communications within organisation but not used globally.

  7. Anycast Address --> One IPv6 address assigned to many devices. It's used for load balancing.



How many IPv6 Addresses are present in host bit?




PING





Stateless Address Auto-Configuration ---> SLAAC


It is a way by which if we configure our Router with SLAAC ipv6 address then it will send advertisement to all other devices on the network and by this the devices will configure ipv6 address by itself.


Windows will use random ip address for host bit



Linux will make use of Mac Address to create host bit




IPv6 Subnetting


  1. Subnet ISP IPv6 space - /32

  2. Subnet company IPv6 space - /48

  3. Subnet site IPv6 space - /56



IPv6 Subnetting


  1. Default CIDR value is 64 bit


2. Just like ipv4 we need to assign different network to router interface.



3. ISP will obtain ipv6 from IANA regional registry.

Let's assume we are ISP and got ip address 2001:0DB8::/32 .


4. Now we do subnetting and are always going to give /48 address to companies




5. This will continue till "FFFF" which means that ISP could handover ip addresses to 65,536 companies.



6. Now as a company we got /48 address say 2001:0DB8:0002::/48



7. We will play with "0000" in between host and network bit to create subnets.



8) Since 4 binary bits is equal to one hexadecimal value. Hence, will use subnet as /48, /52, /56, /60 & /64


Now /60 will have 4 network bits. So will create a total of 16 networks.


Similarly


/60 --> 16

/56 --> 256

/52 ---> 4096

/48 ---> 65536



9) Let's say we want to build /56 i.e. 256 networks




First Network



Second



Now this will go on until we reach "FF" on pink portion.



Till Now : ISP gave /48 to company ... The company did subnetting /56 and assigned that to different sites.


Now we need to subnet /56 to assign networks within site.


Subnetting /56





Now this will go on until we reach "FF" on pink portion.



2 views0 comments

Recent Posts

See All

Interview Questions OSPF

Link-state routing protocols have a complete map of the network. Hence, it could calculate the shortest path to all the different...

Comments


bottom of page