How to find your IP address and Subnet Mask in CIDR notation? | From basics| Windows | Linux

Arijit Sarkar
4 min readSep 15, 2021

In the “Who is on your WiFi/Network? Find out now!! Only in 3 min. | Netdiscover| Linux| Windows” writeup, I have used some terms like IP address and subnets. You must be wondering, how to find out yours.

FYI → I am explaining this basics thing because the next day(tomorrow) morning post is going to be ‘Nmap Network Scanning’. My morning post will be related to Penetration Testing and my evening post will be related to ’Linux Tutorial’.

Let’s get into the basics if you don’t know. Or if you know then you can skip the next 3 questions. —

What is an IP?

IP stands for Internet Protocol. There are two terms →
i) Internet → which we all are using in our day-to-day life.
ii) Protocol → It is a set of rules.

Well, so why does protocol require?
For living decently in our lives we all must follow a set of rules. Like for driving some country follows Left Hand Drive and some follow Right Hand Drive so that there should not be any congestion.
The same goes for the Internet. All connections should be in the Protocol. If something not following a protocol it will not work out.

What is an IP Address?

So we know the meaning of IP now. Let’s focus on the Address term.

Think of your home, if you want to receive a letter from your friend then you have to give him an address.
The same way the internet works the internet is all about sending and receiving messages(also known as packets, diving a message into smaller chunks called packets) like communication. So you need an address to communicate.

So in nutshell, an Address following the Internet Protocol is called IP Address.

What is a Subnet?

Let’s think about one very big hall of 12,000 sqft size with 1000 seat capacity. So you can only organize one booking at a time. But what if you got two bookings on the same day of 300 seat capacity each. Then you will be able to organize only one of them. So it’s a huge loss of money and also 700 seats will not going to use.
Now if you divide the same hall into smaller seat capacity of 400, 400 and 200. Then you can organize 3 in one day. So diving into chunks is the solution.

On the Internet, you have 4,294,967,296 addresses where if we give all the addresses to only one very big company then also a waste. So dividing into small chunks is also a solution. Because for a very large company total required IP addresses will be 20,000 max, for a medium company 1000-7000 max, and for the small company 300–500 max.
Now for a home, you would be requiring a maximum of 256 IP for 254 devices. But we do not have 254 devices must of our homes.
So to save the IP addresses scientist introduced a technique by dividing into smaller chunks the network.

Now you must be wondering we do have more than 4,294,967,296 no of people and devices on the Internet, so how it is possible to connect them. That is also an advance subnetting called ‘Classless Inter-Domain Routing’ Protocol (CIDR).

We do not need to know that much deep for finding our IP address and the Subnet Id.

Now it’s the final moment where I will show you how to find your IP address and Subnet Mask.

There is three famous OS out there. One is Windows and another Linux and lastly macOS. I used Linux and Windows so I am describing these two only. The first one is Linux and then Windows.

Linux →

i) open your terminal from the search box.
ii) Type the following in the terminal and hit enter.

ip a s

If you are connected via wired then you will find eth0 or ens3 terms, these are called adapters names.
Here ‘e’ indicates ethernet.

If you are connected via WiFi then you will find either wlan0 or wlan5 terms.
Here ‘w’ indicates Wireless.

After finding the appropriate adapter name go to its second line, which will start with ‘inet’ term in the 3rd line.

There you got your IP address and the subnet mask like this manner.
IP-Address/Subnet-Mask (in CIDR notation).
Which you can be used for finding the hosts in your Network from the previous “Who is on your WiFi/Network? Find out now!! Only in 3 min. | Netdiscover| Linux| Windows” post.

Windows →

i) Open your start menu and type cmd and hit enter.
ii) Then type down the following. And the output will be like the screenshot.

ipconfig

Here please focus on the IPv4 address and Subnet Mask. These two things you will be required.

So the IP address we got, but not like the format we want. Hmmm, don’t worry. The subnet-mak full length to short length table (CIDR notation) is added below.

So my Subnet Mask is 255.255.255.0 which is equivalent to /24.
Great!! Now we have to add the equivalent notation or short after the IP Address.
192.168.10.118/24
is my IP-Address/Subnet-Mask(in CIDR notation).

That’s it for today. Please let me know your views in the comment section regarding my write-up.

--

--

Arijit Sarkar

CS Engineer. 1 year of Linux Administration, 2 years of Windows Administration Work Experience. Next Goal → Junior Penetration Tester.