Don‘t worry, it doesn’t look easy, but it is.
#IPv6 ADDRESS TRANSORMATION
#
#IPv6 address types:
# -global unicast
# -unique local
# -link local
# -multicast
# -others
#IPv6
# Binary/Base 2/0b
# Uses: 0 and 1
# Decimal/Base 10/0d
# Uses: 0,1,2,3,4,5,6,7,8,9
# Hexadecimal/Base 16/0x
# Uses: 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E,F
# Means: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
#Examples for the practice:
#Example 1:
# 0b11011011 = 0x?
# ____ <---Convert each 4 bit group to decimal
# | ____
# | |
# | 0d11 <---Convert each decimal to hexadecimal
# 0d13 | <---Convert each decimal to hexadecimal
# | 0xb \
# oxd - = oxdb
#Example 2:
# 0b00101111 = 0x?
# ____ <---Split to 2 groups 4 bits each
# | ____
# | |
# | 0d15 <---Convert each decimal to hexadecimal
# 0d2 | <---Convert each decimal to hexadecimal
# | 0xf \
# ox2 - = ox2f
#Example 3:
# 0b10000001 = 0x?
# ____ <---Convert each 4 bit group to decimal
# | ____
# | |
# | 0d1 <---Convert each decimal to hexadecimal
# 0d8 | <---Convert each decimal to hexadecimal
# | 0x1 \
# ox8 - = ox81
#Example 4:
# 0xec =ob?
# || <---Split
# | \
# | 12 <---Convert each value to decimal
# 14 | <---Convert each value to decimal
# | 1100 <---Convert each value to binary
# 1110 <---Convert each value to binary
# 0b11101100
#Example 5:
# 0x2b ob=?
# ||
# | \
# 0x2 0xb
# | \
# 0d2 od11
# | \
# 0b0010 0b1011
# ob00101011
#Example 6:
# 0xd7 ob=?
# ||
# | \
# 0xd 0x7
# | \
# 0d13 od7
# | \
# 0b1101 0b0111
# ob11010111
# IPv6 is 128 bits (You are become anut if you try to use binary or decimal format/ The solition is to use hexadecimal format)
# 2001:0DB8:5917:EABD:6562:17EA:C92D:59DB
# 1 2 3 4 5 6 7 8 # 8 blocks, each block=16 bits
#
# Mask /64
# First portion (1-4 blocks) = net address
# Second portion (5-8 blocks) = host address
#RULES:
# 1. Leading 0`s can be removed
# 2001:0DB8:000A:001B:20A1:0020:0080:34BD
# 2001:DB8:A:1B:20A1:20:80:34BD
# 2. Consecutive quarters of all 0`s can be replaced with double colon (::)
# 2001:0DB8:0000:0000:0000:0000:0080:34DB
# 2001:DB8::80:34DB
# 3. Consecutive quarters of 0`s can only be abbreviated once in IPv6 address
# 2001:0000:0000:0000:20A1:0000:0000:34BD
# 2001::20A1:0:0:34BD
#GLOBAL UNICAST ADDRESS
# IPV6 address will recieve /48 blocks
# IPv6 subnets use a /64 prefix length
#That means an enterprise has 16 bits to use to make subnets
#The remaining 64 bits can be used for hosts
#
# 2001:0DB8:8B00:0001:0000:0000:0000:0001 /64
# --------------
# | ----
# | | -------------------
# | | |
# | | host portion of the address (64 bits interface identifier)
# | |
# | subnet identifier (16 bits used by the interprise to make various subnets
# |
# 48 bits global routing prefix aasignet by the ISP
#How to find the IPv6 prefix?
#Example 1:
# 2001:0DB8:8B00:0001:0000:0000:0000:0001 /56
# 16 32 48 4400 <--each block has 16 bits, to get 56bits=48bits+4bits+4bits
# 2001:0DB8:8B00:00|01:0000:0000:0000:0001 /56 # after | (56 bits, all bits become 0)
# 2001:0DB8:8B00:0000::/56
#Example 2: When the network prefix is odd
# 2001:0DB8:8B00:0001:FB89:017B:0020:0011 /93
# 16 32 48 64 80 |STOP HERE AND SPLIT 017B
#
# 017B
# ||||
# 444 -B CONVERT TO DECIMAL, 0xB=0d11, THEN CONVERT TO BINARY, 0d11=0b1011.
# TO GET 93, WE NEED ONLY 1 BIT, CHANGE 0b1011 --> 0b1000
# CONVERT TO DECIMAL ob1000=0d8
# CONVERT TO HEXADECIMAL 0d8=0x8
# 2001:DB8:8B00:1:FB89:178:: /93
#Modified EUI-64
#EUI-64 is a method of converting a MAC address (48 bits) in to 64 bits interface identifier
#The interface identifier can then become the "host portion" of a /64 IPv6 address
#HOW TO CONVERT THE MAC ADDRESS
# 1. Devide the MAC address in half
# 1234567890AB --> 123456 | 7890AB
# 2. Insert FFE in the middle
# 123456FFFE7890AB
# 3. Invert the 7-th bit (if 0, make 1; if 1 make 0)
# 1234 56FF FE78 90AB
# ||
# 44 <--break the second 4. in binary 2 is 0010.
# ||||
# 5678 <-The 7-th bit is 1, make it 0, and the result is 0000
# 1034 56FF FE78 90AB
#Example 1
# 782B CBAC 0867
# 782BCB AC0867 -SPLIT IN HALF
# 782BCBFF FEAC0867 -ADD FFFE IN THE MIDDLE
# |
# 1000 -CONVERT 8 TO BINARY
# ||||
# 5678 -THE 7-th BIT IS 0, CONVERT IT TO 1, AND IT WILL BECOME TO 1010
# -1010 - CONVERT TO DECIMAL = 10, CONVERT IT TO HEXADECIMAL = A
# 7A2BCFF FEAC0867
#Example 2
# 00FF 6BA6 F456
# 00FF6B A6F456 -SPLIT IN HALF
# 00FF6BFF FEA6F456 -ADD FFFE IN THE MIDDLE
# |
# 0000 -CONVERT 8 TO BINARY
# ||||
# 5678 -THE 7-th BIT IS 0, CONVERT IT TO 1, AND IT WILL BECOME TO 0010
# -0010 - CONVERT TO DECIMAL = 2, CONVERT IT TO HEXADECIMAL = 2
# 02FF6BFF FEA6F456
#WHY INVERT THE 7-th BIT?
# UAA - assigned by the manufacterer
# LAA - aasigned localy by an admin
#
# U/L bit - Universal / Local bit
# U/L set to 0 = UAA
# U/L set to 1 = LAA
#
# More information eui-64.packetlife.net #