Before we start to Find First Address and Last Address of an IP, we have to know about the IP address. IP means a distinctive string or a series of a number , separated by full stops. It allows one computer to communicate with others via internet. IP stands for Internet Protocol. Each IP address is unique for each computer or device. The format of an IP address is a 32-bit numeric address written as four numbers separated by periods. Each number can be zero to 255. For example, 220.127.116.11 could be an IP address.
Do you know What’s Your IP address :
To know your IP address you can use the ipconfig (IPCONFIG) command line into the run. Ipconfig displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) .
To launch the command prompt from a Windows-based computer click:
Start > All Programs > Accessories > Command Prompt. Type ipconfig and press the Enter key.
You can also use Google search to know your IP address. Type “what is my IP address” as a search query and Google will show the IP address of the computer from which the query was received as the top search result.
Step 1 :
We first have to know the IP address belongs to in which classes.There are two types of addresses are there IPv4 it means (internet protocol version 4) and ipv6 and their different classes like class A, class B, class C, class D, class E.
Basically 1st octet decimal range defines the classes.
Class 1st Octet Decimal Number
Class A 1 – 127
Class B 128-191
Class C 192-223
Class D 224-239
Class E 240-255
Suppose the IP address of your Computer – 18.104.22.168(First octet decimal number is 182 , So the Address is in class B).
Step 2 :
Suppose an IP address is given : 192.168.0.1/24 where 24 defines the prefix which helps us to calculate the first address and last address and it’s basically 32 bi.
The 1st octet Decimal number is 192. So, it is in Class C.
First, we make the decimal number into its corresponding binary number. We all Know How Do we solve it :
In this way We will get all the binary digits to its corresponding decimal numbers. Here the rest of the numbers are 168,0,1. Always mind it the address is 32 bit numbers and divided into 4 parts. And all parts should contain 8 digits of binary form to its decimal number.
Now rest 3 digits binary forms are :
168 : 10101000 0 : 00000000(make it 8 digits) 1 : 00000001
So the corresponding binary number is :
11000000 . 10101000 . 00000000 .00000001
192 168 0 1
Step 3 :
Now we will find the net mask of the IP address. So, to find the netmask, it is important to know the prefix which is declared in step 1. That is also known as the netmask. Netmask is : 24
The address is always 32 digit. And the net mask is 24. So, the netmask address should be 24 digits will be 1 and the rest are the 0. So, the result will be.
Net mask is : 11111111.11111111.11111111.00000000 (255.255.255.0)
Step 4 :
To find the First address, it will be AND operation Between the IP address and Net mask. First address also known as network Address .
So, the first address will be : 11000000.10101000.00000000.00000000
And it’s decimal number is – 192.168.0.0/24 and it’s also known as a network address.
To find the last address, apply a NOT operation on the netmask. It means the net mask is : 11111111.11111111.11111111.00000000, and after NOT operation resultant will be
00000000.00000000.00000000.11111111 and then apply OR operation with an IP address.
The last address is also known as Broadcast Address. Now, Try it Yourself . Here is an example :
22.214.171.124/26 , find the last address and last address. The result is (first address is : 126.96.36.199) and the (last address is : 188.8.131.52).
Here is our asp.net tutorial for beginners.