IP Address: IP address is a 32 bit number assigned to a particular network devices. IP address are usually shown broken upto four 8-bit number ranging from 0 to 255. It is easier for our human brain to wrap around the number such as 192.168.0.1 than 11000000101010000000000000000001.
Netmask: A netmask is a way of saying how many IP address you have in a particular block. Generally you have seen a netmask of 255.255.255.0. This was standard for corporate network for many years. This means you have 256 IP address in your network block.
For example, if the IP address of your machine is 192.168.9.79 and it has the netmask of 255.255.255.0 , you know that your local network has other 255 IP addresses.
A netmask is a simply a line between the network and the host IP address. The classic 255.255.255.0 netmask means that the IP number is fixed for the first 24 bits, and that you can change the last 8 bits.
Still you have problem in understanding ? Let us look at the following example:
Suppose your admin issue you the block of ipaddress 192.168.9.0 to 192.168.9.255 with the netmask of 255.255.255.0. The first 24 bit of the addres(192.168.9.0) are fixed and you can do anything with the last 8 bits. Look at netmask as a binary number and it will start make a whole lot of sense.
255.255.255.0 = 11111111.11111111.11111111.00000000
In this case any digit 1 has been set by the admin that issued you yor IP address; any digit that is a 0 can be changed by you. The first 24 bits are all 1s, meaning that you cannot change that part of the IP address on a machine on your local network. You can change the numbers that are in 0 section of the netmask. The 192.168.9 part of the IP is all in the part of the netmask marked by 1s, so you can’t change those numbers. The last chunk of the IP address, the part after the last period, is in the section marked off by 0s. so you can change this.
The part of the IP address under the 1s in the netmask is called network address, the remainder is called the host address.
The netmask size is measured by the number of 1s in the netmask. This netmask has 24 1s, so it is a 24 bit netmask or a /24 (pronounced ”slash 24“). Your network block would be written as 192.168.9.0/24
Here’s is tough part: there is no reason why the boundary between the network number and the host number must lie on the convenient 8 bit bounday. The following is also a perfect netmask
If you convert this from binary to decimal you will get the netmask of 255.255.255.128. It is perfectly a right netmask, and it has 7 bits of address for your machines. That is 2 to the power of 7 is 128, so you have 128 IP address for this network.
Note: The first and last address of any block is unusable. You cannot assign a machine on a network with a netmask of 255.255.255.0 and IP ending in .0 or .255
More on netmasks: The end result of netmasks being in binary is that IP address are issued in a block that are multiples of 2. If you have 5 bits to play with, you will have 32 (2*2*2*2*2 = 32) IP address on your network, and your net mask will be a /27 (32-5 = 27). If you have 8 bits for your hosts, you have 256 (2*2*2*2*2*2*2*2 = 256)IP addresses.
1,582 total views, 2 views today