0 0
Read Time:8 Minute, 26 Second

In today’s technological era, we are witnessing a massive leap in the usage of the internet and networking devices. Every home has a laptop, smartphone, digital watch, IoT device, home automation component, and other devices that are connected to the home network or the Internet. Devices communicate with each other through various network protocols, with TCP and IP being the most frequently used protocols. Each device connected to the network must have an IP address that identifies the device on the network.

This article explains the Internet Protocol and how IPv6 differs from IPv4.

What is IP (Internet Protocol)?

Being humans, we identify and communicate with each other using our names. Likewise, in the computing world, devices use IP addresses to identify and interact with each other. A common language used by all computing devices to communicate with each other is known as a protocol. Akin to human languages, the protocol also has a set of rules that formats and processes the data.

The Internet Protocol (IP) is a set of rules that specifies addressing and routing the data between computers. It is mostly used with network transport protocols, such as TCP and UDP.

The Internet exists today because of this unique addressing pattern. The IANA manages the IP address ranges for networks/sites that connect to the Internet. However, if we run an isolated local network infrastructure, we can assign numbers according to our preference. Now, let’s get into the nitty-gritty of both architecture and its comparative analysis.

IPv4

The first major version of Internet Protocol (IP) is version 4 (IPv4). It uses a 32-bit network addressing schema that further splits into four 8-bit numbers known as octets. For instance, google.com has an IP address of 141.251.36.46. The format is known as dotted quad notation. These IP addresses can either be configured manually or automatically obtained through a DHCP server.

To check the live status of the remote device, we can do an ICMP probing to that IP using the ping command:

ping -c 1 google.com
PING google.com (142.251.36.46) 56(84) bytes of data.
64 bytes from ams17s12-in-f14.1e100.net (142.251.36.46): icmp_seq=1 ttl=116 time=247 ms

...

IP addresses are broken into two parts, network, and host addresses for creating sub-networks. The subnet numbers help to decide the network and host parts of the IP. Also, the available IP space is divided into five different classes as tabulated below.

Address ClassIP RangesSubnet MaskNo of NetworksNo of hosts per Network
Class A1.0.0.0 to 126.0.0.0255.0.0.012616,777,214
Class B128.0.0.0 to 191.255.0.0255.255.0.016,28265,534
Class C192.0.0.0 to 223.255.255.0255.255.255.02,097,150254
Class D224.0.0.0 to 239.255.255.255Multicasting
Class E240.0.0.0 to 255.255.255.255Research/Reserved/Experimental

The calculation of subnet involves a few mathematical rubrics behind the screen. To ease our computation, we can use tools like ipcalc or subnetcalc for IPv4 subnetting. The below snippets shows how to use the tools:

ipcalc 110.0.20.18/24
Address: 110.0.20.18 01101110.00000000.00010100. 00010010
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111
=>
Network: 110.0.20.0/24 01101110.00000000.00010100. 00000000
HostMin: 110.0.20.1 01101110.00000000.00010100. 00000001
HostMax: 110.0.20.254 01101110.00000000.00010100. 11111110
Broadcast: 110.0.20.255 01101110.00000000.00010100. 11111111
Hosts/Net: 254 Class A
subnetcalc 192.168.10.15/24
Address = 192.168.10.15
11000000 . 10101000 . 00001010 . 00001111
Network = 192.168.10.0 / 24
Netmask = 255.255.255.0
Broadcast = 192.168.10.255
Wildcard Mask = 0.0.0.255
Hosts Bits = 8
Max. Hosts = 254 (2^8 - 2)
Host Range = { 192.168.10.1 - 192.168.10.254 }
Properties =
- 192.168.10.15 is a HOST address in 192.168.10.0/24
- Class C
- Private
GeoIP Country = Unknown (??)
DNS Hostname = (Name or service not known)

Usually, IP addresses are given to the end host machine and router gateway interface, as illustrated below.

Here, the traffic from Machine A (10.235.64.58) hits the router gateway interface (10.235.64.57) at the left side of the internet cloud. It reaches Google Server gateway through Internet routing and finally to the destination server.

To identify the network interface IP you can use commands such ifconfig , hostname or ip .

ifconfig ens160
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.235.64.58 netmask 255.255.255.252 broadcast 10.235.64.59
inet6 fe80::fc7f:d8da:a969:1c1d prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:23:6f:30 txqueuelen 1000 (Ethernet)
RX packets 35607241 bytes 34540488400 (34.5 GB)
RX errors 0 dropped 12 overruns 0 frame 0
TX packets 24701952 bytes 15008379564 (15.0 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
hostname -I
10.235.64.58

There are special purposes network IP addresses like 0.0.0.0 or 127.0.0.1. The former is the default route or quad-zero route, whilst the latter is called the loopback address.

In the below snippet, we’ll see the Kernel IP routing table with the default route for that network. The flag ‘U’ represents that the network route is UP, whilst G signifies that the network route is the network gateway.

netstat -rn | grep ens160
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 10.235.64.57 0.0.0.0 UG 0 0 0 ens160
10.235.64.56 0.0.0.0 255.255.255.252 U 0 0 0 ens160

Usually, the IPv4 datagram consists of a header field with 20 bytes, options field, and data fields with a variable length. The sample packet format is shown below.

Below, Wireshark capture helps to decipher the packet header information from the live traffic.

IPv6

Internet Protocol version 6 is the updated version of Internet Protocol (IP). Version 6 of the Internet Protocol is intended to replace the older version (IPv4), which carries 75% of total internet traffic as of 2018 (Source: Google IPv6 Stats).

The IPv6 address is 128 bits (16 bytes) using 32 hexadecimal digits, whilst these digits are further divided into eight groups of four digits each for ease of management. A brief illustration is shown below.

There are few basic steps involved in the IPv6 naming convention.

Rule 1: All letters are case insensitive. For example, ‘ab41’ equals ‘AB41’ Rule 2: Successive fields with ‘0’ can be visualized as “::”, but only once in an addressing Rule 3: Representing leading zeros in a field are optional. For instance, ‘001a’ equals ‘1a’

For Instance, let’s take the IPv6 address, 45ab:0000:a179:0000:0000:c1c0:abcd:0876

Apply Rule 1 => 45ab:0000:a179:0000:0000:c1c0:abcd:0876 Apply Rule 2 => 45ab:0:a179:0:0:c1c0:abcd:876 Apply Rule 3 => 45ab:0:a179::c1c0:abcd:876

There are three types of IPv6 addresses: Unicast, Multicast, and Anycast. The unicast address is the single network interface and packets delivered to that specific interface. Additionally, unicast addresses have local(link-local) and global scope levels. Multicast address is the group interfaces to which the packets get delivered. Anycast address is the group interface and packet delivered to the nearest interface.

Few well-known addresses are tabulated below.

]::1/128Loopback address
ff00::/8Multicast addresses
fe80::/10Link-local addresses
2001::/16Regular IPv6 unicast addresses
2002::/166to4 Unicast addresses
subnetcalc 2001:4860:4860::8888/64
Address = 2001:4860:4860::8888
2001 = 00100000 00000001
4860 = 01001000 01100000
4860 = 01001000 01100000
0000 = 00000000 00000000
0000 = 00000000 00000000
0000 = 00000000 00000000
0000 = 00000000 00000000
8888 = 10001000 10001000
Network = 2001:4860:4860:: / 64
Netmask = ffff:ffff:ffff:ffff::
Wildcard Mask = ::ffff:ffff:ffff:ffff
Hosts Bits = 64
Max. Hosts = 18446744073709551616 (2^64 - 1)
Host Range = { 2001:4860:4860::1 - 2001:4860:4860:0:ffff:ffff:ffff:ffff }
Properties =
- 2001:4860:4860::8888 is a HOST address in 2001:4860:4860::/64
- Global Unicast Properties:
+ Interface ID = 0000:0000:0000:8888
+ Sol. Node MC = ff02::1:ff00:8888
GeoIP Country = United States (US)
DNS Hostname = dns.google

Again, the IPv6 packet has both header and payload. The header size is fixed to 40bytes, with source and destination address taking 32bytes. The sample packet format is shown below.

Though IPv6 has umpteen advantages, it cannot supplant IPv4. Both protocol versions have to co-exist for some time for seamless migration. Hence, the service providers are offering a dual-stack support system that possesses a network interface that can understand both IPv4 and IPv6 packets.

There are few smart transition mechanisms, namely IPv6 Tunneling, IPv4 mapped IPv6 addresses, etc. The former encapsulates the IPv6 packet in IPv4, whilst the latter maps the IPv6 to IPv4 addresses in the dual-stack implementations.

IPv4 vs IPv6 – Quick Comparative Analysis

FeaturesInternet Protocol – Version 4 [IPv4]Internet Protocol – Version 6 [IPv6]
Deployment & allocation19811999
Length32-bit128-bit
Address Space4.29 x 10^93.4 x 10^38
FormatDotted Decimal / [10.235.64.56]Hexadecimal / [2400::4]
Number of Octets416
Header SizeVaries from 20 – 60 bytes40 bytes
ClassesFive classes: Class A, Class B, Class C, Class D, Class ENone
Security Features / Authentication and encryptionNot availableAvailable
Check sumAvailableNot available
IPSecExternal and optionalInbuilt feature
Hop CountIndicated by TTL fieldIndicated by Hoplimit field
FragmentationPerformed by sender and forwarding routersDone by sender only
Option FieldsProvided in the IPv4 headerThere are no optional fields, but IPv6 Extension headers are available
MulticastIGMP manages the multicast group membershipMLD replaces the IGMP
Broadcast messageAvailableNot available. Multicast is used
IP to MAC MappingAddress Resolution ProtocolNeighbour Discovery Protocol

Conclusion

We explored the basics of Internet Protocol and its versions. Along the way, the article elucidates the addressing schema, packet format, functioning of the IPv4 and IPv6 with comparative analysis. Though IPv4 is carrying the majority of Internet traffic today, IPv6 is the future of the networking world.