Saturday, November 7, 2009

IP addresses and network masks


IP addresses and network masks

1.2.10 This page will explain the relationship between IP addresses and network masks.


When IP addresses are assigned to computers, some of the bits on the left side of the 32-bit IP number represent a network. The number of bits designated depends on the address class. The bits left over in the 32-bit IP address identify a particular computer on the network. A computer is referred to as a host. The IP address of a computer consists of a network and a host part.

To inform a computer how the 32-bit IP address has been split, a second 32-bit number called a subnetwork mask is used. This mask is a guide that determines how the IP address is interpreted. It indicates how many of the bits are used to identify the network of the computer. The subnetwork mask sequentially fills in the 1s from the left side of the mask. A subnet mask will always be all 1s until the network address is identified and then it will be all 0s to the end of the mask. The bits in the subnet mask that are 0 identify the computer or host.

Some examples of subnet masks are as follows:

11111111000000000000000000000000 written in dotted decimal as 255.0.0.0

11111111111111110000000000000000 written in dotted decimal as 255.255.0.0

In the first example, the first eight bits from the left represent the network portion of the address, and the last 24 bits represent the host portion of the address. In the second example the first 16 bits represent the network portion of the address, and the last 16 bits represent the host portion of the address.

The IP address 10.34.23.134 in binary form is 00001010.00100010.00010111.10000110.

A Boolean AND of the IP address 10.34.23.134 and the subnet mask 255.0.0.0 produces the network address of this host:

00001010.00100010.00010111.10000110

11111111.00000000.00000000.00000000

00001010.00000000.00000000.00000000

The dotted decimal conversion is 10.0.0.0 which is the network portion of the IP address when the 255.0.0.0 mask is used.

A Boolean AND of the IP address 10.34.23.134 and the subnet mask 255.255.0.0 produces the network address of this host:

00001010.00100010.00010111.10000110

11111111.11111111.00000000.00000000

00001010.00100010.00000000.00000000

The dotted decimal conversion is 10.34.0.0 which is the network portion of the IP address when the 255.255.0.0 mask is used.

This is a brief illustration of the effect that a network mask has on an IP address. The importance of masking will become much clearer as more work with IP addresses is done. For right now it is only important that the concept of the mask is understood.

This page concludes this lesson. The next page will summarize the main points from the module.

No comments:

Post a Comment