In our previous chapter of the LFCA series, we defined a computer network and briefly brushed over some of the general Linux networking commands that you can use to retrieve useful network information such as your IP address, subnet mask, open ports and so much more.
In an interconnected world, networks play a huge role in enhancing seamless communication, access to information, and file-sharing. Because of computer networks, you can check your email, purchase a plane ticket, and download files.
To better understand computer networks, we go a step further and look at the following salient points.
- Demonstrate a basic understanding of IP addressing.
- Binary and decimal dotted quad notation.
- Understand Subnet masks.
- Understand different classes of IP address & “dotted quad”.
- Differentiate between Private and Public IP addresses.
- The TCP/IP model. Get a better understanding of commonly used TCP ( Transmission Control Protocol ) ports & services for example ports 21, 22, 53, 80, 110 and so much more.
Understanding Basics of IP Addressing in Linux
One of the most fundamental concepts in TCP/IP is IP addressing. So, what is an IP address? An IP address, simply an IP, is a 32-bit binary number that is assigned to a computing device such as a PC, Tablet, or smartphone in an IP network.
It can be dynamically assigned by a router using the DHCP protocol or manually configured by a Linux user or systems administrator. An IP address is a unique identifier that allows a host to be identified in a local area network (LAN) as well as over the internet. An IP address is a software address and is not hardcoded on the PC, unlike the MAC address which is associated with the network interface card.
IP Terminologies
Before we proceed further, let us check out some key concepts that will help you get a better understanding of the Internet protocol.
- Bit – This is a single digit, represented either as 1 or 0.
- Byte – This is a collection or series of 8 bits. 1 byte = 8 bits.
- Octet – An octet comprises 8 bits or 1 byte.
An IP address is segmented into 4 octets or bytes. Each octet has 8 bits, therefore 1 octet = 8 bits.
As IP address can be depicted in the following ways:
- As a dotted-decimal. For example 192.168.1.5.
- As a binary, as in 11000000.10101000.00000001.00000101.
- As a hexadecimal value: c0.a8.01.05.
All the above notations represent the same IP address. However, in most cases, the hexadecimal format is rarely used to represent IP addresses, and therefore, our focus will be on the first two formats: the dotted-decimal and the binary.
IP addresses can be broadly categorized into two:
1. IPv4 Address
An IPv4 (IP version 4) IP address is a 32-bit digit that is segmented into 4 octets. Each octet has 8 bits which can be represented either as a dotted-decimal or binary format.
Examples of IPv4 addresses include:
10.200.50.20 172.16.0.20 192.168.1.5
IPv4 address can be categorized into 5 classes:
Class A Class B Class C Class D Class E
However, we will only cover the first 3 classes – Class A, B, and C – which are mostly used in host systems. The remaining classes are beyond the scope of this certification. Class D is used for multicast and E is mostly for research and experimental purposes.
Let’s begin with Class A. This is the biggest class boasting of 16,777,216 IP addresses that can be assigned to hosts and the least number of assignable networks which are 126 by default.
Next, we have Class B which has the second-highest number of possible IP addresses which are 65,534 and 16,384 assignable networks by default.
Lastly, we have Class C which is the smallest class yielding only 254 possible IP addresses and 2,097,152 assignable networks by default.
We will come back to the classes of IPv4 addresses later on.
2. IPv6 Address
In sharp contrast to an IPv4 address, an IPv6 address uses 128-bits against 32-bits in IPv4. It is represented in hexadecimal format with each hexadecimal comprising 4 bits.
An IPv6 address is segmented into 8 portions, each having 4 hexadecimal numbers. An example of an IPv6 address is shown:
2041:130f:0000:3f5d:0000:0000:875a:154b
This can be further simplified as follows. The leading zeros are substituted by a double full colon as shown.
2041:130f::3f5d::875a:154b
IPv6 addresses were created to replace IPv4 addresses which, according to experts, will soon run out. The larger number of bits will significantly increase the address space. We are yet to get to that point and we will largely dwell on IPv4 addresses.
An IP address is divided into two main sections: The network part and the host part. In a simple IP address of 192.168.1.5 with a subnet mask or netmask of 255.255.255.0 ( we will come to subnet masks later on in this part ), the first three octets from the left represent the network part, and the remaining octet is the portion that is assigned to host machines on your network. Each host receives a unique IP, different from the rest but shares the same network address with other hosts in the same network.
192.168. 1 5 Network part Host part
This concludes the first part of our networking series. We have so far defined what an IP address is, brushed over the various classes of IP addresses and the two main types of IP addresses- IPv4 and IPv6. In the next section, we will dive into binary and decimal quad notation.
Hi,
Thanks a lot..
As per RFC 3513 section 2.2 bullet point 2, you cannot shorten an IPv6 address with 2 sets of double colons. double colons are only allowed once so your example above:
would be incorrect
2041:130f:0:3f5d::875a:154b would be the correct abbreviated form of the address to comply with the aforementioned RFC