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.
Table of Contents
- What is a protocol?
- OSI Model
- Logical Addressing: What is the IP address?
- Subnet: Logical Subdivision
- Types of IP addresses
- What are ports?
- How it works: Combining the IP address and Port for communication
What is a protocol?
The first thing to know about the IP is that IP, in fact, is a protocol.
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 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.
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.
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 is a 32-bit address. It looks like the following:
There are 4 fields of numbers separated by a
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 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
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
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.
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 – 192.168.1.1 Host D – 192.168.1.2 ……… Host Z – 192.168.1.255
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 – 188.8.131.52
Subnet mask of the network – 255.255.0.0
Can you tell the Network and the Host part of this IP address ranges?
Here, in this IP address of 184.108.40.206, 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 – 220.127.116.11 Host B – 18.104.22.168 … Host X – 22.214.171.124 Host Z – 126.96.36.199
In this network, the subnet mask is 255.255.0.0, 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 – 255.255.192.0
Network Address – 188.8.131.52
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
184.108.40.206, 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: 255.255.192.0
- Network Address: 220.127.116.11
- IP Address range: 18.104.22.168 – 22.214.171.124
- Maximum possible hosts: 16,384
- Usable hosts: 16,382
- Broadcast address: 126.96.36.199
In general, a subnet mask of
255.255.192.0 could have the following IP addresses:
|Network Address||Usable Host Range||Broadcast Address:|
|188.8.131.52||184.108.40.206 – 220.127.116.11||18.104.22.168|
|22.214.171.124||126.96.36.199 – 188.8.131.52||184.108.40.206|
|220.127.116.11||18.104.22.168 – 22.214.171.124||126.96.36.199|
|188.8.131.52||184.108.40.206 – 220.127.116.11||18.104.22.168|
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.
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:
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: 10.0.0.0 – 10.255.255.255
Class B: 172.16.0.0 – 172.31.255.255
Class C: 192.168.0.0 – 192.168.255.255
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:
In windows, start the command prompt and type in
ipconfig and hit enter:
C:\Users\edxd>ipconfig 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. . . . . . . . . . . : 192.168.42.105 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.42.129 Ethernet adapter Ethernet 5: Connection-specific DNS Suffix . : IPv4 Address. . . . . . . . . . . : 192.168.56.1 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : Ethernet adapter Ethernet 6: Connection-specific DNS Suffix . : IPv4 Address. . . . . . . . . . . : 192.168.74.1 Subnet Mask . . . . . . . . . . . : 255.255.255.0 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 192.168.42.105, and the subnet mask is 255.255.255.0, which indicates only the fourth octet will be used for the hosts in this network.
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:192.168.56.1 Bcast:192.168.56.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions: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:192.168.42.105 Bcast:192.168.42.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions: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:192.168.74.1 Bcast:192.168.74.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Global UP LOOPBACK RUNNING MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
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 192.168.42.105.
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 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 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):
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.
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.
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.
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.