﻿ TCP/IP Tutorial

Source code editor     Website development ﻿

Main Page

### Converting a Subnet Mask to Dotted Decimal Notation

The network administrator typically assigns a subnet mask to each host as part of the TCP/IP configuration. If the host receives an IP address through DHCP (see Hour 12, "Dynamic Host Configuration Protocol (DHCP)"), the DHCP server can assign a subnet mask along with the IP address.

Subnet masks must be carefully calculated and must reflect the internal organization of the network. All the hosts within a subnet should have the same subnet ID and subnet mask. For the benefit of people, the subnet mask is usually expressed in dotted decimal notation similar to the notation used for an IP address.

```11111111111111111111111100000000
```

is expressed in dotted decimal notation as 255.255.255.0. Likewise, the subnet mask

```11111111111111110000000000000000
```

is expressed in dotted decimal notation as 255.255.0.0.

As you can see, it is very easy to determine the dotted decimal equivalent of a subnet mask that divides the address at an octet boundary. However, some subnet masks do not divide the address at an octet boundary. In that case, you must simply determine the decimal equivalent of the mixed octet (the octet containing both ones and zeros).

To convert a binary subnet mask to dotted decimal notation, follow these steps:

1. Divide the subnet mask into octets by writing the 32-bit binary subnet mask with periods inserted at the octet boundaries:

```11111111.11111111.11110000.00000000
```
2. For every all-ones octet, write down 255. For every all-zeros octet, write down 0.

3. Convert the mixed octet to decimal using the binary conversion techniques discussed in Hour 4. To summarize, add up the bit position values for all one bits (refer to Figure 4.5).

4. Write down the final dotted decimal address:

```255.255.240.0
```

In most cases, this dotted decimal subnet mask is the value you will enter as part of a computer's TCP/IP configuration.

Source code editor     Website development ﻿