Internet Protocol (IP) is a fundamental protocol used for communication between devices on a network. It assigns unique addresses to each device, enabling them to send and receive data packets. There are two main versions of IP in use today:
IPv4 (Internet Protocol version 4)
IPv6 (Internet Protocol version 6).
What is the purpose of IP addressing?
Device Identification:
IP addresses uniquely identify devices (computers, smartphones, servers, etc.) connected to a network. This identification enables data packets to be sent to the intended recipient.
Routing:
IP addresses aid in the routing of data packets across the internet. Routers examine the destination IP address in each packet to determine the appropriate path for delivery.
IPv4
IPv4 addresses are 32-bit binary numbers that are typically represented in decimal format for easier human understanding (192.168.15.1). Each IPv4 address consists of four sets of eight binary digits (bits), separated by periods, resulting in a total of 32 bits. It can therefore be referred to as a 32-bit address. Due to its size, IPv4 has a theoretical maximum number of unique addresses of approximately 4.3 billion. This is calculated by 2^32.
Understanding Binary:
In the binary system, each digit represents a power of 2, starting from the rightmost digit. The rightmost digit is in the 2^0 position, the next digit to the left is in the 2^1 position, followed by 2^2, 2^3, and so on. Each digit can be either 0 or 1, indicating the absence or presence of that power of 2, respectively.
Understanding binary and being able to convert between binary and decimal is essential in various computer-related fields, including programming, networking, and digital systems. It allows us to comprehend how computers represent and process data at the most fundamental level.
When we see binary values such as 01010101 we can convert this to decimal by understanding which digit corelates to which decimal value. The table below shows the decimal value for each bit in a byte (a byte is 8 bits) and shows the binary value of 11
128 64 32 16 8 4 2 1
0 0 0 0 1 0 1 1
An example of an IPv4 address would be
192.168.15.1
To understand the binary representation of an IPv4 address, we convert each decimal value in the dotted-decimal notation into its corresponding binary representation. Each decimal value is converted into an 8-bit binary number.
192 (in decimal) converts to 11000000 (in binary)
128 64 32 16 8 4 2 1
1 1 0 0 0 0 0 0
168 (in decimal) converts to 10101000 (in binary)
128 64 32 16 8 4 2 1
1 0 1 0 1 0 0 0
15 (in decimal) converts to 00001111 (in binary)
128 64 32 16 8 4 2 1
0 0 0 0 1 1 1 1
1 (in decimal) converts to 00000001 (in binary)
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 1
The resulting binary representation is:
11000000.10101000.00001111.00000001
IPv6
IPv6 is the latest version of IP addressing that offers an expansive address space and improved features compared to its predecessor, IPv4. To comprehend IPv6 addresses effectively, understanding hexadecimal (hex) representation is crucial.
IPv6 addresses are 128-bit binary numbers divided into eight sets of four hexadecimal digits, separated by colons (fe80:0000:0000:0000:020c:29ff:feec:8cd5). With its larger address space of approximately 3.4 x 10^38 unique addresses, IPv6 supports the growing needs of the internet and enables efficient routing and network configuration. IPv6 also incorporates built-in security features and simplified header format for improved performance.
Understanding Hex
Hexadecimal is a numbering system that uses 16 digits: 0-9 and A-F, where A represents 10, B represents 11, and so on, up to F representing 15. Hex is commonly used in computer systems because it conveniently represents 4 bits in a single digit. Each hexadecimal digit corresponds to a 4-bit binary number.
As a quick reference, the below shows the decimal value of each Hex value
· 0 = 0
· 1 = 1
· 2 = 2
· 3 = 3
· 4 = 4
· 5 = 5
· 6 = 6
· 7 = 7
· 8 = 8
· 9 = 9
· A = 10
· B = 11
· C = 12
· D = 13
· E = 14
· F = 15
When we see hex values such as 3F we can convert this to decimal by understanding which character corelates to which decimal value and multiplying that to the appropriate power of 16. The following shows how we can understand the decimal value of 3F
256(16^2) 16(16^1) 1 (16^0)
3 F
3*16 (16^1) + F*1 (16^0)
48 + 15 = 63
Therefore 3F = 63
Simplifying IPv6
Understanding IPv6 addresses can be simplified through a few techniques:
Zero Suppression
Zero suppression in IPv6 refers to the removal of leading zeros within each block of the IPv6 address. It allows for a more concise representation while preserving the value of each block. The purpose of zero suppression is to simplify the address and improve readability.
Let's consider the following IPv6 address:
2001:0db8:0000:0000:0000:0000:1428:57ab
By applying zero suppression, we can remove the leading zeros within each block:
2001:db8:0:0:0:0:1428:57ab
In this example, all leading zeros within each block have been suppressed, resulting in a shorter representation of the address.
Zero Compression
Zero compression in IPv6 involves replacing consecutive blocks of zeros with a double colon (::). It simplifies the representation further by compressing multiple blocks of zeros into a single occurrence of the double colon (::). However, it should be used cautiously to avoid ambiguity, as the double colon can only be used once within an IPv6 address.
Let's take the same IPv6 address as in the previous example: 2001:0db8:0000:0000:0000:0000:1428:57ab
Applying zero compression, we can compress the consecutive blocks of zeros:
2001:db8::1428:57ab
In this example, the consecutive blocks of zeros (0000:0000:0000:0000) have been replaced with a double colon (::), reducing the address length and enhancing readability.
It's important to note that zero suppression and zero compression are complementary techniques that can be applied together to simplify IPv6 addresses. They make the addresses more manageable, especially when dealing with long strings of zeros. However, it's crucial to use them appropriately to maintain the uniqueness and clarity of the addresses.