IP: Internet Protocol
Each device connected to another one has a IP address. It can be public or priavte.

Following are the two versions of IP:-
IPv4- It is a 32-bit number, separated by dots (.), into 4 parts, values ranging from 0 to 255 in each part. It supports Broadcast. It was older version of IP. Limited number of combinations were possible so the need if IPv6 was introduced.

IPv6- It is a 128-bit number, separated by colon (:), it is represented by aplhanumeric (hexadecimal). It doesn't support broadcast. It is newer version of IP. Almost infinite number of combinations are possible.

Classes:
Following are the 5 classes of IP-

Out of these 5 classe, only Class A, B & C are used by us, class D is reserved for multicast, while class E is reserved for research & development purposes. If you notice you will IP 127 is not anywhere in this list, beacasue it has been reserved for loopback testing.

How IP is distributed?
The organisation of IANA has the authority for assigning IPs to devices, it further depends as follows for completion of it's task.

Private IP:
It is used to communicate devices within the same netwrok. (LAN)
Following IPs has been reserved for private IP:
The first row is class A, second is class B and third is class C.
Class A is used for the largest network, meant if you are having numerous number of devices, which is absolutely not possible at home, it is used in big offices. Similarly Class B for medium level of network, and class C for smallest network. Most commonly at houses we use class C. And if you have noticed, you enter the IP, 192.168.1.1 or 192.168.0.1 to access your router, if you are using a Wifi, which is Class C. Later in this post you will get to know why these classes has been made based on number of possible devices can be connected.

Public IP:
It is used to communicate outside the network, it is assigned by ISP. A special range of IP has been reserved which is used by a protocol named Automatic private IP addressing (APIPA). This special range is 169.254.0.0 to 169.254.255.255 It has been done so, because in case the DHCP in your network fails to allot you a IP, you will be alloted this range of IP and you can communicate within the network (private network), but you can't access the internet in that case.

As discussed earlier whenever you connect to a network, an IP address is allocated to you, and when you reconnect (by turning off and on, or restarting your device) your IP gets changed. This type of IP which gets changes is named as Dynamic IP. In a private netwrok this task of assigning dynamic IP to each individual devices is done by DHCP server which is generally pre-installed in the router.
In several cases one wishes not to get his/her IP changed frequenlty, if they have made servers, done port fordwarding, created FTP, or any other scenario. In that case, they will need Static IP. This static IP is kept reserved for the user and not allocated to another user. You can create a static IP for your device free of cost (which would be private IP), for smooth communication within the same network, however in order to get a Static public IP you need to pay some amout (monthly or one time) to your ISP, and then you will be alloted a static IP.

Some more basics of IP:
The IP address is of 32 bits which is divided into 4 octets (8 bit each).


We write 1 next to the number by adding which we get the desired number, and zero next to the rest of those. We can get max value of 255 in this way. And now you would be known why we were writing 255 many times above.

Parts of an IP address:
1) Network ID- It identifies the specific network on which the device is located.
2) Host ID- It identifies a specific devices on that network.

Finding Network ID: 
1. First find to which class does that IP belongs.
For class A first octet is for network bit and rest 3 for host.
For class B first 2 octet is for netwrok bit and rest 2 for host.
For class C first 3 octet is for network bit and last octet is for host.

To tell the Network ID simply write the network bit as it is, and 0 to the host.
For example network ID for the IP 120.10.90.10 will be 120.0.0.0 (class A)
For example network ID for the IP 150.10.90.10 will be 150.10.0.0 (class B)
For example network ID for the IP 200.10.90.10 will be 200.10.90.0 (class C)

Assigning IP to a host:
In the network ID wherever there is zero, we can put values ranging from 1 to 255, we can allot IP to a host/device.

Subnet Mask:
It helps to know which portion of the address identifies the network and which portion of network identifies the host/node. It is a pre-defined number for each class of IP.
For Class A it is 255.0.0.0
For Class B it is 255.255.0.0
For Class C it is 255.255.255.0

Broadcast IP:
Used for broadcasting, me myself doesn't know much about this.
Finding broadcast IP:
1) Find the class to which that IP belongs.
2) Write the network bit as it is and 255 to the rest of it.
For example, for the IP 120.15.10.100,
        Network ID would be: 120.0.0.0
        Subnet would be: 255.0.0.0
        Broadcast IP would be: 120.255.255.255

Finding usable host:
1) Find the class.
2) Find network ID.
3) Let x be the number wherever it is zero in the network ID
4) So now, the total number of usable hosts on that network would be expressed as follows: 
(28)x - 2

For example for the IP 180.168.10.100, the network ID would be 180.168.0.0
Here there are two zeros, putting the the x to be 2 in above expression we get 65,534.
Meant we can use maximum of 65,534 hosts on that network.

At last let's have a quick recap of what we learnt above:
Q. For the IP 192.168.1.44, find all above things.
Class C
Network ID- 192.168.1.0
Subnet mask- 255.255.255.0
Broadcast IP- 192.168.1.255
no. of usable hosts- 254
IPs of usable hosts would be ranging from:
192.168.1.1 to 192.168.1.255