What Are IP Addresses: Basic Concepts and Terms Explained (Versions, Type, Subnetting, Ports)

What Are IP Addresses Basic Concepts and Terms Explained (Versions, Type, Subnetting, Ports)

If you’re reading this article, chances are, you’ve come across many different terms associated with the IP address on the internet.

In this article, we will cover the basic concepts and terms related to IP addresses, and we will also explain how IP addresses work and where they fit into the big puzzle of the internet.

What is a protocol?

The first thing to know about the IP is that IP, in fact, is a protocol.

A protocol is a set of rules that defines how devices are supposed to work. HTTP, HTTPS, and FTP are some of the protocols that you may have heard of.

Take HTTP for example, it is a protocol through which the browsers and the servers communicate with each other. It stands for Hyper Text Transfer Protocol.

The client and servers use this protocol to communicate and transfer web content. However, HTTP does not offer any type of encryption, i.e., anyone could intercept the traffic to see the contents of the communications. HTTPS is the protocol that encrypts the communication between web servers and clients with SSL encryption.

Similarly, IP is a protocol, and it stands for Internet Protocol, sometimes also known as TCP/IP protocol. It is one of the most fundamental protocols – essentially establishing the internet.

TCP/IP protocol

TCP/IP protocol is known as a suite of Internet Protocol that is formed by the communication protocols of the internet. The two protocols that consist of the Internet Protocol suite are the TCP (Transmission Control Protocol) and IP (Internet Protocol).

Currently, the Internet Protocol suite is succeeded by the OSI (Open Systems Interconnection) model.

OSI Model

The OSI model is a conceptual model that standardizes the communication functions of a computing system.

There are 7 layers in the OSI model. Each layer describes a network system.

The IP protocol is implemented in the 3rd layer (network layer), while the TCP protocol is the 4th layer (transport layer) protocol.

The network layer

This is the 3rd layer of the OSI model. It takes data from the Transport layer (4th) and sends them to the Data link layer (2nd).

The network layer performs a number of tasks. The main functionality of this layer is communicating the data between networks.

Some the functionalities of this layer are:

  • Logical addressing: This is where the IP addresses are used to logically separate different hosts. IP addresses works like a literal address for the devices on the network. They are used to send data to the intended receiver. There are two versions of the IP addresses. The IP version 4 (IPv4) and the version 6 (IPv6). We will be focusing on this functionality in the later sections of our article.
  • Routing: The routing of the data packets is also done in this layer. This task is performed by the routers. They all have a routing table that indicates where should the next destination be for the packets.
  • Fragmentation: The sent packets are fragmented to according to a limit size before sending. The packets are merged together once it arrives at its destination. This way the data communication is faster and more reliable.

Logical Addressing: What is the IP address?

The IP protocol uses the IP address to identify each machine in the network layer.

Analogy: You can literally think of the IP address to work like the address of your home in the city. Imagine your friend wants to send you a letter. They must specify your address and name in the cover as the receiver.

The IP address for the computers/hosts work in the same way. Just like you need an address to receive the letter, each device on a network requires an IP address to communicate.

When a network device sends data, it is sent with the sender’s and receiver’s IP addresses. The router knows how to transfer the sender’s data to the receiver. We’ll discuss how the router works briefly in the later sections.

IP address versions: IPv4 vs IPv6

IP addresses have two different versions – version 4 (IPv4) and version 6 (IPv6).

IPv4 is the most used version of today. However, it has some limitations. It can only provide us with 4 billion unique addresses. The world population is roughly 7 billion, and many of us have multiple devices that are connected with the internet.

Thus, IPv6 was invented. This version eliminates the unique address limitations – IPv6 could have 3.4*10^38 unique addresses.

IPv4 structure

IPv4 is a 32-bit address. It looks like the following:

There are 4 fields of numbers separated by a . sign.

The numbers in each field can be anywhere from 0-255. So, the number of unique values for each field is 256, and there are four fields. Thus, the number of unique combinations for IPv4 would be 256^4, which is 4,294,967,296 or roughly 4 billion.

These four fields are called the octets. That is because each of the fields are represented in a block of 8-bit binary number, i.e., 8-bit octet or 1 byte. For representing 256 in binary, we would need 8 binary digits or bits (256 = 2^8). Thus, the IPv4 address in total is 8*4 = 32-bit address.

IPv6 structure

IPv6 is a 128-bit address. An IPv6 address may look like the following:


There are 8 fields separated by colons. Each of these 8 fields contains a 4-digit hexadecimal. The value of the fields can be anywhere from 0000 to FFFF (Hexadecimal has 16 characters – 0-9,a,b,c,d,e,f). You can also visualize an IPv6 address like:


Where each X represents the 4-digit hexadecimal numbers. Recall that you can represent 256 of numbers with an 8-bit binary number (2^8 = 256).

Now, there are 16 characters in the hexadecimal system. So, you will need 2^4 = 16, or 4 bits to represent 16 characters. Thus, 4 bits for 1 hex character. Each of the X fields will have 4 hex characters. So, in total, you’ll need to use 4*4 = 16 bits of binary digits to represent each field. There are 8 “X” fields, which makes the IPv6 a 16*8 = 128-bit address.

Now, there are 128 places where you can put either 0 or 1 to make different binary numbers. So, the combination of unique numbers with the IPv6 would be 2^128. In other words, you can have 2^128 unique IP addresses with the IPv6 version. To put that into perspective, 2^128 is roughly equivalent to a number that is 3 followed by 38 zeros.

IPv6 has some extra advantages – it allows the same device to have both versions of the IP address. We can also communicate if we have different versions of the IP address.

Subnet: Logical Subdivision

IP addresses can be divided to use in different smaller networks. This process of dividing large networks into smaller networks with IP addresses is called subnetting. These networks are called subnets (subnetworks). Both IPv4 and IPv6 support subnetting. In this section, we’ll explain how subnetting is done and what they are, especially from the IPv4 perspective.

Why subnet?

But first let’s talk about why we need the smaller subnetworks in the first place. First of all, networks can be divided based on their functionalities or other categories, which becomes more manageable. Furthermore, huge networks may become slow due to huge traffics such as multiple host broadcasts. Thus, in practice, larger networks are often divided into smaller networks. These networks are then connected with the help of routers or gateways.

Subnetting: IP addresses

To create network subdivisions, the IP addresses are used in a clever way. Each IP address is divided into two parts. One part is to identify the network, and the other part is for the host. In this way, each smaller subnetworks have a unique IP address identifier. Let’s take a look at how that looks like:

Here, the red part is the Network part and the teal part is the Host part of the IP address. In this network, all the devices will have an IP address that starts with 192.168.1. The hosts will have the last field of the IP address. So, this network can have 256 devices connected to it. The IP addresses of the hosts would look like this:

Host A –
Host D –
Host Z –

At this point, you might ask, how to identify which part of the IP address is the Network and which part is the Host? That would be a great question. This is where the subnet mask comes in.

Subnet mask allows us to identify the network and the host part in an IP address. In the previous network, the subnet mask would have been:

Here, the values of 255 in the first three octet indicates the network part, while the 0 in the last octet indicates that this will be the host part. Let’s take a look at another network and its subnet mask:

Network Address –

Subnet mask of the network –

Can you tell the Network and the Host part of this IP address ranges?

Here, in this IP address of, the red part (172.10) is the network part and the teal (0.0) is the octet used for the hosts in the network. Some of the IP addresses of hosts from this network would be:

Host A –
Host B –
Host X –
Host Z –

In this network, the subnet mask is, which indicates the first two octets to be the Network octets and the last two octets to be the Host octets.

Now you may wonder, what would happen if the subnet mask of a network were to look like this:

Subnet mask –

Network Address –

In this case, we would need to convert the Subnet Mask address to its binary form:

Subnet mask in binary – 11111111.11111111.11000000.00000000 (192 is 11000000 in binary). Now, we take a look at the binary mask and the Network part will be the bits that are “1“. The Host part of the IP address is denoted by the 0 in the binary form.

Now, in the 3rd octet, there are two 1s and six 0. Those 6 zeros will be used for indicating the hosts.

Recall that with 6 bits, you can create 2^6 = 64 different numbers. So, the 3rd octet can hold 64 different numbers. The network address was, so the third octet will have values ranging from 0 to 63, i.e., 64 different addresses.

For the fourth octet, they are all zeros. So, we know that there will be 256 unique numbers this octet can have (2^8 = 256). So, the 4th octet will have values ranging from 0 to 255, or 256 addresses. Total number of combinations for IP addresses or maximum possible hosts in this network will be = 64*256 = 16,384.

Among these, one host will be the gateway (router) and another address will be the broadcast address. So, the total usable hosts in this network will be 16,382.

Now, let’s put what we know in a list for this network:

  • Subnet mask:
  • Network Address:
  • IP Address range: –
  • Maximum possible hosts: 16,384
  • Usable hosts: 16,382
  • Broadcast address:

In general, a subnet mask of could have the following IP addresses:

Network Address Usable Host Range Broadcast Address: – – – –
You can learn more and calculate the IP ranges from subnet masks online. Here’s an online IP subnet calculator.

Types of IP addresses

IP addresses can be classified in different ways. In this section, we’ll be covering some of the ways they can be differentiated and classified.

Private IP

Today, we use private IPs extensively. If you’re reading this article, chances are that you are using a private IP address. LANs, WiFi, etc. use private IP addresses in their internal networks. All the devices within the private network connect to a single router, which is generally responsible for the connections to and from the outside public internet.

Your personal device’s private IP address is concealed when you connect to the internet using your router’s public IP address. This scenario is demonstrated in the following picture:

word image 30 word image 31

As you can see, the devices inside the private network (Host 1, Host 2, Host 3, and Host 4) are assigned with a private IP address. This IP address is generally provided by the Router/Gateway.

The router is connected to your ISPs (Internet Service Providers) network, and it has access to the outside Public Internets through the ISP. Your ISP provides you with a single public IP address that is shared between a lot of devices on the private network. This way we don’t require public IPs for each and every device to connect to the Internet. There might be multiple gateways/routers connected to your network.

Private IPs are generally used in an internal network that are non-routable, that is, they cannot be reached from the outside networks directly.

The private IP divides the internet into public and private domain, which is often helpful – the private networks also work as an extra shield against outside cyber-attacks. The Internet Assigned Numbers Authority (IANA) has allocated several address ranges to be used by private networks.

These private IP ranges (IPv4) are:

Class A: –

Class B: –

Class C: –

So, you know any IP address that starts with a 192.168 is going to be a private IP address. The concept of public and private IP also makes it easier to set up our own networks as we want.

For these private IP addresses, you don’t need to register with the IANA or an Internet Registry. Furthermore, these IP addresses will not be unique. Any IP address outside of this range are considered to be public IPs.

What is a gateway?

Gateways are similar to routers. It is just a connection point that allows two different networks to communicate in between themselves. When you turn on the tethering/hotspot of your mobile devices, it becomes a gateway to the connecting devices.

How to find your private IP address?

If you want to find out the private IP address of the device you’re using there are some commands you can try on the terminal of the system:

Windows OS

In windows, start the command prompt and type in ipconfig and hit enter:


Windows IP Configuration
Ethernet adapter Ethernet 3:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter Ethernet 4:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . :
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . :

Ethernet adapter Ethernet 5:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . :
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . :

Ethernet adapter Ethernet 6:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . :
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . :

You might be confused by seeing multiple IP addresses in the output. In fact, they are assigned to different network devices (Ethernet, WiFi, etc.) that are present on my computer. However, the active connection is the “Ethernet 4”, as we can see the default gateway. So, the private IP address of our active network device (Ethernet 4) is, and the subnet mask is, which indicates only the fourth octet will be used for the hosts in this network.

Linux/Mac OS

In Linux or Mac operating system, open up your terminal of choice and type in the command ifconfig:


eth1 Link encap:Ethernet HWaddr 00:50:56:c0:00:01
inet addr: Bcast: Mask:
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

eth2 Link encap:Ethernet HWaddr 52:43:f4:ab:a8:f9
inet addr: Bcast: Mask:
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

eth3 Link encap:Ethernet HWaddr 00:50:56:c0:00:08
inet addr: Bcast: Mask:
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

lo Link encap:Local Loopback
inet addr: Mask:
inet6 addr: ::1/128 Scope:Global
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
In this example, the output shows multiple IP addresses as well. Each of the network interfaces have their own IP addresses.

We can see the MAC address (Physical Address) of these network interfaces marked in yellow.

You have to know which network interface is connected to the Gateway/Router. That is your private IP address. In my case, the private IP of my device is

Public IP

A public IP address can be directly accessible over the internet. It is issued to your network router by your internet service provider (ISP). The public IP addresses are all assigned by the Internet Assigned Numbers Authority (IANA). It is a standards organization that oversees global IP address allocation.

It is your public IP that can be traced back to your general location. Generally, the ISPs will have a specific range of IP addresses that are registered to them. All the websites you visit will have one or multiple IP addresses. These are all public IP addresses.

Generally, public IP addresses can be of two types. Static and Dynamic IP addresses. When you get your IP address from your ISP, you either get a Static or a Dynamic IP address. However, private IPs can also have static or dynamic IP addresses.

Static IP

Static IPs are static as their name suggests, i.e., they do not change. Static IP addresses have some certain advantages over dynamic IPs. As your address does not change, anyone can find you using the same IP address. Websites and servers on the internet do have static IP addresses.

Dynamic IP

Dynamic IPs are changing over time. If you find yourself seeing different IP addresses at different times, you have a dynamic IP address. Dynamic IPs are more common at the consumer level. Your ISP has a certain range of IP addresses. It assigns one dynamically to you for temporary use.

Static IPs generally cost more than the Dynamic IPs. Dynamic IPs are assigned by a protocol name DHCP (Dynamic Host Configuration Protocol). Your router also has this protocol that assigns different IPs to different devices.

How to find out your Public IP address?

The easiest way to find your Public IP address is to take the help from online websites. One of the websites that will show your public IP is whatismyip. I’ll show how my public IP lookup looks like (obviously hiding the location and other information): word image 32

As you can see from the photo, from my Public IP address, the websites we visit know our location, ISP name, time zones, etc. The information, however, does not generally provide a location with very good accuracy. This is because your ISP could be based from anywhere, not necessarily from where you live. This can often be misleading.

What are ports?

Now that you have learned most of the concepts there are about IP addresses, have you noticed that only IP addresses are not enough to identify the receiver correctly?

In the previous example of your friend sending a letter, recall that your friend must also specify your “name” along with your address. If your friend were to mention only the address but forgot to write your name on the cover, the letter would reach your home but it may not reach you. Because there might be multiple people living in your home.

For a computer or a device, the home address corresponds to the address of the computer or the device as the IP address. Those multiple people living in the same home would be the plethora of applications running on our computer at the same time. If all those applications were not identified by something, the data would not reach the intended application.

In short, a single machine/computer might have multiple programs or applications running on it that are connected to the internet. These programs might require communicating different messages. This is accomplished with ports. Ports operate in the Transport Layer (4th layer) of the OSI model.

For example, imagine you are using your web Browser and Email app at the same time. Your Browser and Email app are sending and receiving different data.

In this case, your browser may use the port 80 (HTTP) or 443 (HTTPS) for the connection, and your email client would probably use port 465 (SMTP) for outgoing mails and port 993 (IMAP Secure) for incoming ones.

How it works: Combining the IP address and Port for communication

In this section, let us take a look at how the IP addresses and ports work together for the communication between two devices. We’ll take the example of a client server model here and simplify the communication with the Internet Protocol suite to help us better understand.

The Internet Protocol suite is shown in the picture below.

The OSI model has 7 layers, while the Internet Protocol suite only has 4 more simplified layers.

word image 33 word image 34

Sender side

Here, we’ll talk about what happens on the sender’s side of the communication. The communication starts with the sender application deciding to send some data. This happens in the Application Layer. Then the data moves down the layers. The Transport Layer adds the necessary port information with the data. After that, the data with the port information comes down to the Internet Layer (equivalent to Network Layer in the OSI model). In this layer, the IP address information is included in the IP header. The IP header consists of both the sender’s (source) and the receiver’s (destination) IP addresses. Apart from that, the header also includes information about the IP version, time-to-live, etc.

This is how the port and IP address come together for the communication between networks. After the Internet Layer, the data comes to the Link Layer and units of data (frame) are sent from here. In the OSI model the last layer is the Physical Layer, which is responsible for sending and receiving the data physically.

Receiver side

Now, let’s talk about what happens on the receiver’s side. The process is completely reversed in this case. Here, the process starts with the Link Layer (It actually starts with the Physical Layer in the OSI model).

The data is received and its headers are stripped out step by step. At the Internet Layer (Network Layer in the OSI model) the IP address information is extracted. If the data packet has the same destination IP address as the host, the packet is processed further and sent to the Transport Layer. In this layer, the port determines which application to send the data to.

If the specified port is not open or not listening for incoming connections, the connection is dropped with the data discarded. At the end of the process, if the port is indeed listening for incoming connections, the data is received by the intended application operating in the Application Layer.

This is how the port and IP address come together for the communication between networks.


There are many more IP address concepts you could know about, that we could not fit in this article. However you can definitely find more info online, if you want to go more in-depth.

In this article, we covered some of the most used terms and concepts there is to know about the IP address. If you read the article thoroughly, you already know a lot more about the IP addresses than others. You should also be able to understand the basics of how the internet works by now. We hope you liked the article.

If you have any questions or comments for us, leave them down below, and we’ll get back to you as soon as possible. Thank you for reading.

Notify of
Inline Feedbacks
View all comments
You May Also Like