IP ADDRESS (Internet Protocol Address) & Subnet Mask

There are 2 versions of IP addresses. IP version 4 and Version 6.

Ip version 6 will be soon introduced in real times. I will discuss ip version 6 on a later chapter. As of now lets discuss the ip version 4 which is the addressing scheme in use now.

Ip stands for Internet protocol. Formed by IANA(Internet Assigned Numbers Authority and ICANN(Internet Corporation for Assigned Number and Names).

* IPV4 is a logical address of 32 bits.
* An ip address is a combination of Network id and Host id just like a telephone number is a combination of area code and telephone number.
* First part is always the network part.

Each bit denotes a value of either 1 or 0. The 32 bit address is divided equally into 4 bytes.








IPv4 has 2 types.

1. Private which is used within a LAN. eg: at home
2. Public used in WAN. eg: Internet

PRIVATE IP address has 3 classes

Class A : 10.0.0.0 - 10.0.0.255

Class B : 172.16.0.0 - 172.31.255.255

Class C : 192.168.0.0 - 192.168.255.255

Apart from the above discussed ranges rest of the ip addresses are all public ip addresses.

PUBLIC IP address has 5 classes

Class A : 1.0.0.0 - 126.255.255.255 (1-126 network)
(127 network is reserved for loop back)

Class B : 128.0.0.0 - 191.255.255.255 (128-191 network)

Class C : 192.0.0.0 - 223.255.255.255 (192-239 network)

Class D : 224.0.0.0 - 239.255.255.255 (224-239 network)

Class E : 240.0.0.0 - 255.255.255.255 (240-255 network)






SUBNET MASK

When you assign an ip address to a system, the system identifies the network part and host part of the ip address by looking at the subnet mask address.

All 1s on the network part and all 0s on the host part makes a subnet mask.

Look at the table.




DEFAULT GATEWAY

A default gateway can be termed as an access point to another network.

Suppose a computer in the 10 network needs to communicate with a computer in 20 network. Here comes the use a router. A router is used to connect 2 different networks. In the below picture you can see 2 networks. A connection is possible between these 2 networks using a router in between.



The interface where the 10 network is connected has an ip address 10.0.0.1 and the interface where 20 network is connected has an ip address 20.0.0.1.

10.0.0.1 is the gateway for computers in 10 network and
20.0.0.1 is the gateway for computers in the 20 network.


BROADCAST IP ADDRESS

As the term means, a broadcast ip address is used to sent a broadcast packet. In other words, if a packet or data needs to be sent to all computers in a specified network, broadcastip address is used.

By now you must be able to identify the network part and host part of an ip address. For an ip address 10.0.0.1, the first octet is the network part and the last 3 octets is the host part. Hence this ip belongs to the network 10.0.0.0. The broadcast ip for 10 network would be 10.255.255.255.

Similarly for an ip address 192.16.20.3, the network part is the first 3 octets and last octet is the host. Hence this ip belongs to the network 192.16.20.0. The broadcast ip for the network 192.16.20.0 is 192.16.20.255.

When you get all 1s on the host part and not changing anything on the network part you get the broadcast ip.