IP Addressing
Photo by Ricardo Ortiz

IP Addressing

For hosts to communicate in a network, there are a couple of considerations. They need to identify who they want to message, and they need to identify themselves so the recipient knows who to reply to. That is done with a unique identifier called the IP Address.

An IP Address is a unique sequence of numbers used to identify the hosts on a network. In the actual sense, all nodes on the network (i.e. both hosts and network devices like routers) have IP Addresses except those that run solely on layers 1 and 2.

There are currently two major versions of IP Addresses. Version 4 (IPv4) and version 6 (IPv6). In this article, we’ll be talking about IPv4 which is the older and most common of the two.

To see your computer’s IP Address, open your command prompt by typing “cmd” in the search bar and run the command “ipconfig.” If you use Linux or Mac, open your terminal, type the command, “ifconfig,” and hit enter.

 

No alt text provided for this image

As with many things in networking, the IP Address of a host (phone, computer, IP camera, server, etc.) can be assigned statically or dynamically. Assigning statically means manually configuring an address unto a device. Dynamically means that the address is assigned automatically by a protocol. The Dynamic Host Control Protocol (DHCP) is used for that purpose.

To be able to assign an address, you need to know what it is and how it works. The IP Address, though written in decimals, is a binary number. It consists of 32 bits, that is 32 zeros and ones. It is arranged in a set of four octets (groups of eight) and separated by dots.

No alt text provided for this image

To quickly translate between base 10 (decimal) and base 2 (binary), there’s a method we use. It’s called the Doubling Method. This is how it goes. Take a binary number, say “1101.” To translate it to decimal with this method, write it down and assign values to each digit starting from the right hand side. Start with “1,” then double the number each time. So, the numbering would be “1, 2, 4, 8, 16, 32, …” from right to left in ascending order. Now, every one has the value of the number on it and every zero has no value. Add up the numbers. So, “1101” would be 1 + 0 + 4 + 8 = 13. So, 1101 is 13. 

No alt text provided for this image

Eight bits make one byte. In IP Addressing, we take every byte as a single decimal number. If those eight bits were all ones, the sum would be 255. That, however, doesn’t mean 255 individual values. It means 256 values because computers count from zero, not one. Humans count like this [1, 2, 3, 4, 5]. This array ends in five and is five numbers. Computers count like this [0, 1, 2, 3, 4, 5]. This ends in five too, but it’s six numbers.

The IP Address consists of two parts, the host ID and network ID, which is like your name and family name. Those parts are denoted by another sequence of numbers called the subnet mask.

No alt text provided for this image

Before the introduction of the Classless Inter-Domain Routing, there was the concept of Classful Addressing which divided the IP Address space for IPv4 into classes A, B, C, D and E. They are denoted by the first four bits of the first octet.

No alt text provided for this image

Classes A, B and C are can be assigned to hosts, class D addresses are for multicast, class E is for experimental purposes. Here, I show the first octet of each class with “x” representing positions from where the value can either be a one or a zero.

Class A : 0xxx xxxx . xxxx xxxx . xxxx xxxx . xxxx xxxx

Class B : 10xx xxxx . xxxx xxxx . xxxx xxxx . xxxx xxxx

Class C : 110x xxxx . xxxx xxxx . xxxx xxxx . xxxx xxxx

Class D : 1110 xxxx . xxxx xxxx . xxxx xxxx . xxxx xxxx

Class E : 1111 xxxx . xxxx xxxx . xxxx xxxx . xxxx xxxx

In every network or subnet, two addresses are not assignable to hosts. Those are the network address and the broadcast address. For example, in the network, 10.0.0.0 with mask 255.0.0.0, the network address, 10.0.0.0 cannot be assigned to a host. The broadcast address, 10.255.255.255 can also not be assigned to a host.

The broadcast address is gotten by setting all the Host ID bits to one. Remember what I said before. If you have all the digits in an octet set to ones, the resulting decimal number would be 255.

The network address is gotten by setting all the Host ID bits to zero. That means all the numbers there would be zero even in decimal form. The address we just used in this example is a Class A address, because, as you can see, the first number is between zero and 127.

To determine the number of hosts and number of networks a subnet can have, you just raise two to the power of whatever number. So, for a Class A address like this, the first bit must be zero in binary. Let’s write our network. The number 10 is 1010 in binary, so the network is 0000 1010.0000 0000. 0000 0000. 0000 0000. That is 10.0.0.0. The total number of hosts is 224 - 2 (broadcast and network address). The total number of networks is 27. That’s the total number of possible ones we can have in that network because the first digit in binary form cannot be a one. That’s 128 networks, but that includes 0.0.0.0 which is invalid. It also includes the range of 127.0.0.0 - 127.255.255.255 which have also been reserved for diagnostic purposes, so in actuality, we have just 126 possible networks.

When the internet began to grow too big, the Internet Engineering Task Force (IETF) decided to designate some addresses as private addresses so they can be used many times in many different private networks. For hosts with those addresses to access the internet, they would have to go through Network Address Translation (NAT).

No alt text provided for this image
No alt text provided for this image

They later came up with the concept of Classless Inter-Domain Routing (CIDR). With Classful Networks, you can only assign blocks of networks according to classes. With a Class A address, you have 8 network bits and 24 host bits. That means you have potentially 2 to the power of 24 hosts per network. That is 16, 777, 216 hosts. When we remove the broadcast address and the network address, that’s 16, 777, 214 hosts per network. If you have just 5000 computers in your network, that’s a waste—especially if you have more than 126 Local Area Networks. You can no longer have enough networks to serve all the LANs.

Classless Inter-Domain Routing solves this problem by replacing classful boundaries with address prefixes. So, 10.1.1.2 which is supposed be Class A (which is 255.0.0.0) can now become 10.1.1.2 255.255.255.0. That is not possible with the original Class A. Before CIDR, as long as the first number is between 0 and 127, it is a Class A address and has to have the last three octets as Host ID. CIDR also came with a new notation. So, instead of writing 255.255.255.0 as subnet mask, you could just write /24 to represent the number of network bits (or the network prefix).

In Classless Inter-Domain Routing notation, Class A is a /8 address, Class B is a /16 address and Class C is a /24 address. But now, you can have 10.0.0.0 /24 or 192.168.2.2 /16. It defies the classes and allows you to do that division anywhere you want. This allows us to assign addresses with less wastage.

We no longer use Classful Addressing, but some of the concepts still remain. For example, the address range 224.0.0.0 - 239.255.255.255 is still used for IP multicast. That was Class D, and it was the class for multicast addresses. Also, private address ranges still remain the way they are.

With Classless Inter-Domain Routing, we can also divide addresses outside the standard or default class boundaries. For example, you can now have 192.168.2.4 /27 (or in subnet mask form: 192.168.2.4 255.255.224.0). Twenty-seven network bits means it has the 24 bits plus three bits from the last octet as the prefix (network ID).

Default subnet masks can be broken down in two ways—Fixed Length Subnet Mask (FLSM) or Variable Length Subnet Mask (VLSM). With Fixed Length Subnet Mask, all subnets have the same mask. For example, if a company has three departments with Local Area Networks for each of them, all of them will use the same mask, say /27.

With Variable Length Subnet Mask, however, each subnet (or subnetwork) can use a different mask. So, the marketing department can use /27, finance department use /29 and human resources, /28. All the subnets do not have to use the same subnet mask.

No alt text provided for this image

IP Addressing is one of the basic things in networking. It seems tough when you’re encountering it for the first time, but after then you don’t really pay much attention to it, just like you don’t really pay much attention to the English alphabets by now. You just use them everyday. When you’ve been dealing with calculus on a daily basis, you sometimes forget how to teach basic arithmetic operations, so I hope I did a good job explaining IP Addressing.

If I got something wrong, please critique me. Leave a comment, message me, email me. If you enjoyed the article, please share and subscribe for more. Thanks.

Favour Abigail Ohemu

Creating Awareness on Business Security | Cybersecurity Researcher | Operations Manager at Speak Perfect International

3y

Nice one

To view or add a comment, sign in

More articles by Chidiadi Anyanwu

  • Route Tables: Cloud & Networking

    Route Tables: Cloud & Networking

    One of the major mechanisms through which routing works is the route table. Route tables exist both in traditional…

  • How Domain Name System (DNS) Works

    How Domain Name System (DNS) Works

    DNS is something the internet lives and breathes on. It is one of the fundamental technologies that makes our present…

    1 Comment
  • Is HTTP A Networking Protocol (Pt 2) - The Evolution of HTTP

    Is HTTP A Networking Protocol (Pt 2) - The Evolution of HTTP

    In the last article, we introduced HTTP, talked about its working principle, methods and status codes. Now, we want to…

  • Is HTTP A Network Protocol?

    Is HTTP A Network Protocol?

    What is the difference between the web and the internet, or isn't it just two interchangeable names for the same thing?…

    9 Comments
  • The Point-to-Point Protocol

    The Point-to-Point Protocol

    The Point-to-Point Protocol (PPP) is one of many protocols used in Wide Area Network (WAN) connections. It is a…

    6 Comments
  • VPN Technologies - IPSec

    VPN Technologies - IPSec

    In my last article, we talked about GRE, its features and principles, its configuration and why it is usually used with…

  • VPN Technologies - Generic Routing Encapsulation (GRE)

    VPN Technologies - Generic Routing Encapsulation (GRE)

    Virtual Private Networks (VPN) are private networks built on top of public networks. These networks are called logical…

  • The Common, But Nameless Network Protocol

    The Common, But Nameless Network Protocol

    Unlike other protocols I’ve encountered in networking, there is one that people know but can't really tell you the…

    1 Comment
  • Virtual Local Area Network (VLAN)

    Virtual Local Area Network (VLAN)

    The concept of VLANs can be explained from two viewpoints; the viewpoint of scaling and that of isolation. I’ll explain.

  • The Dynamic Host Configuration Protocol (DHCP)

    The Dynamic Host Configuration Protocol (DHCP)

    Using the internet shouldn’t be so easy. You have to obtain an IP Address, configure it, configure your network…

    2 Comments

Insights from the community

Others also viewed

Explore topics