Monday, June 1, 2020

Internet Protocol 6 for IoT

IPv6 stands for Internet Protocol version 6
Helps interconnect different data networks.


IP is standardized by the IETF (Internet Engineering Task Force)

IP is to guaranteeing interoperability of software.

Support to send and receive data between devices.

IP address
Each internet connected device uses a unique address to send and receive data. IPV6 uses 128 bit address.

Find your IP

Type

Ipconfig in windows
Ifconfig in linux


IP addresses are representation 

IPv4, IPv6, integer, and hex formats.

IPv4 format

Each address is 32 bits with four 8-bit octets. 

Examples :

192.168.1.0, 198.51.100.0, and 203.0.113.0.

IPv6 

IPv6 addresses are 128-bits.
4 times long as IPv4 addresses (32 bits).


IPv4 addresses can be written in IPv6 notation. 

Two colon characters (::)  eliminates groups of zeroes. 

::ffff:c000:200
::ffff:c633:6400 0000:0000:0000:0000:0000:ffff:cb00:7100.

Integer format

Each section is multiplied by 256n

n is the position of the section from right to left,
starting with 0. 

192.168.1.1 = (192 * 256^3) + (168 * 256^2) + (1 * 256^1) + (1 * 256^0)

Hexadecimal format - IP address in base-16 format.

IPv4 192.168.1.1

IPv6 short  ::ffff:c0a8:101

IPv6 long 0000:0000:0000:0000:0000:ffff:c0a8:0101

Integer 3232235777



Hex   0xC0A80101


MAC address
48 bit unique id of each network card.
Given by the manufacturer.


MAC addresses are unicast Ethernet address.
Represents one interface to the Ethernet LAN.

Each device MAC Address should be unique in order to send/receive data successfully.
8 bits can store one octet. 

MAC addresses are unicast Ethernet address.
Represents one interface to the Ethernet LAN.

Each device MAC Address should be unique in order to send/receive data successfully.
8 bits can store one octlet.






Interface ID
An IPv6 device use the MAC address to generate a unique 64-bit interface ID.



Take the MAC address,
Split it into two.
Insert “FFFE” in between.
You have a unique 64 bit address for the host.



Do it for your computer
Find mac address
C0-d9-62-91-30-f4
divide in middle
c0-d9-62  91-30-f4
add FF FE (11111111 11111110)
c0-d9-62 FF FE 91-30-f4
Now We have 64 bit host Address

Enable IPV6 in your computer
CP > Network & Sharing > LAN Connection

In Raspbian
By default, an IPv6 address is configured in Debian using StateLess Address AutoConfiguration (SLAAC)
See https://wiki.debian.org/DebianIPv6


Explain Following Info on your computer
Host Name : shilpa64
Physical Address : C0-D9-62-91-30-F4
DHCP Enabled  : Yes
Autoconfiguration Enabled: Yes
Link-local IPv6 Address: fe80::39f1:1df2:d62:dcf3%13
IPv4 Address  : 192.168.1.105
Subnet Mask: 255.255.255.0
Default Gateway  : fe80::3861:86ff:fe5e:9964%13
                  192.168.1.1
DHCP Server: 192.168.1.1
DHCPv6 IAID: 331405666
DHCPv6 Client DUID : 00-01-00-01-1C-20-0C-59-02-6E-04-7C-02-08
DNS Servers: 192.168.1.1




fe80::39f1:1df2:0d62:dcf3%13 
13 after % is the interface name whose index is 13.

on Linux fe80::15c3:6bea:aaac:a016%eth0.

ping -6 localhost
ping -6 fe80::39f1:1df2:0d62:dcf3

Use ping6 in linux

https://www.vultr.com/tools/
https://www.ultratools.com/
http://ipv6-test.com




Find IPV4 address of google.com
Convert IP to IPV6, integer and hex formats
Ping -6
Ping 0xDEA5A358


IPv6 addresses

An IPv6 address is 128 bit long

It has 3 main parts

  • Network address -
    the first three groups (first 48 bits) 

  • Subnet address -
    the fourth group (next 16 bit)

  • Device address -
    the last four groups (next 64 bits)

Example:

2001:db8:abcd:0012:0000:0000:0000:0000

.
The network address = 2001:db8:abcd
Subnet address is 0012

IPv6 prefix.
Each network device has a unique device address.

The network address = subnet address for every device in the network. 

First four groups of IPV6 is constant network id.
The last four groups vary with device gives host id. 

Prefix provides indication of range of devices.
/1  to 1/128 

2001:db8:abcd:0012::/64  used in LANs
It divides the network into 64 subnetworks. 

Example
Network
001:0DB8:ABCD:0012:0000:0000:0000:0000     

Network Prefix
2001:db8:abcd:0012::0/64   

0012  is subnet

IP Range

start 2001:0DB8:ABCD:0012:0000:0000:0000:0000 

end  2001:0DB8:ABCD:0012:FFFF:FFFF:FFFF:FFFF


IPV6 Summary address
Example
2001:DB8:1234:ABA2::/64
2001:DB8:1234:ABC3::/64
Each hextet represents 16 bits.
The first three hextets are the same (2001:DB8:1234)
so we have 16 + 16 + 16 = 48 bits 

Look at last hextet:

ABA2
ABC3
convert these from hexadecimal to binary
ABA2    1010101110100010
ABC3    1010101111000011
first 9 bits are the same

To get summary address
zero out last 7 bits
AB80    1010101110000000
The first three hextets are the same and
in the 4th octet we have 9 bits that are the same.
48 + 9 = 57 bits.
summary address is 2001:DB8:1234:AB80::/57





ipconfig /all




No comments:

Post a Comment