Understand IP, IPv4, and IPv6
Learn the fundamentals of the IP, IPv4, and IPv6 protocols.
We'll cover the following
Understanding networking fundamentals is essential for designing available and network-resilient infrastructure architectures. In a cloud environment, unlike traditional application infrastructure, we don’t need to maintain physical servers, physical networking, or their connectivity since AWS has taken care of that for us.
However, it’s essential to plan for the minimum number of virtual resources our application infrastructure requires, capacity planning for network design, and networking addresses and protocols that should be employed to set up communication between and to the servers.
In this lesson, we’ll learn the fundamentals of Internet Protocol (IP), which network devices use to communicate in AWS and over the internet.
Internet Protocol
Let’s assume that we want to connect to a remote Linux server running on AWS, such as an EC2 instance, in order to apply package updates. Internet Protocol is the communication protocol that enables us to route and transmit data packets to a remote server over a network.
Every physical or virtual device connected to a network is assigned a unique addressable identifier known as an IP address. The Internet Protocol routes the packets to the desired location, in this example, a remote Linux server, using the provided IP address. Upon delivery, packets are treated in accordance with the chosen transport protocol, either
Every network-connected device, such as our local PC or smartphone, has an IP address.
Run the following command in the terminal to check your device’s private IP address:
ifconfig
Note: For Linux, we can use the
ifconfig
command, and for Windows, we can use theipconfig
command.
The output of the command will show the private IP address of your device, along with additional details about network interfaces. The private IP address can be found under the eth0
section preceded by an inet
label.
The following command can be used to check the public IP address if your device is connected to the internet:
curl -s ifconfig.io
There are two versions of the Internet Protocol:
IPv4
IPv6
IPv4 address
Internet Protocol version 4 (IPv4) supports a 32-bit number IP address represented by a dotted decimal notation, holding four numbers from 0 to 255, each separated by a period. For example, 192.168.0.108
is an IPv4 address.
The equivalent binary representation of 192.168.0.108
is 11000000 10101000 00000000 01101100
. Each decimal number can be represented using 8 bits, also known as an octet.
An IPv4 address contains 32 bits, resulting in an availability of a total of 232 or 4294967296
IP addresses. Although this is a sizable amount of IP addresses, the IPv4 address space appears to be running out soon, given the rise in network-connected devices like smartphones, PCs, tablets, and Internet of Things (IoT) devices.
IPv6 address
Internet Protocol version 6 (IPv6) supports a 128-bit number IP address represented by a hexadecimal notation, holding eight sections of 16 bits (4 digits/letters), each separated by a colon :
. For example, fe80:8fe0:7113:0000:8990:0000:99bf:3264
is an IPv6 address.
The equivalent binary representation of fe80:8fe0:7113:0000:8990:0000:99bf:3264
is 1111111010000000 1000111111100000 0111000100010011 0000000000000000 1000100110010000 0000000000000000 1001100110111111 0011001001100100
. Each hexadecimal number can be represented using 16 bits, also known as a hextet.
An IPv6 address contains 128 bits, resulting in an availability of a total of 2128 or 340282366920938463463374607431768211456
IP addresses, which is 296 times more than the IPv4 address space.
Along with other protocol enhancements, the IP address exhaustion issue is resolved by IPv6’s relatively larger address space than IPv4’s.