An organization that has a Class A or Class B network address is very likely to have a fairly complex network made up of many LANs and several WAN links.
It makes sense to partition the address space in a way that matches the network's structure as a family of subnetworks. To do this, the local part of the address is broken up into a subnet part and a system part in any convenient way.
Subnet addressing is often done at a byte boundary for a Class A or Class B network). For example, an organization with a Class B network might use its third byte to identify subnets. A Class C address, on the other hand, has only a 1-byte address space. An organization might choose to do no subnetting at all or perhaps might use 4 bits for subnet addresses and 4 bits for host addresses.
Traffic is routed to a host by looking at the network and the subnet part of its IP address. In order for hosts and routers to differentiate between the network/subnetwork part of an address and the host part, a parameter called the subnet mask is used.
The subnet mask is a sequence of 32 bits. The bits corresponding to the network and subnet fields of an address are set to 1, while the bits for the system field are set to 0.
For example, if we will use the third byte of addresses starting with 128.121 to identify subnets, the mask is:
11111111 11111111 11111111 00000000 255.255.255.0 in dotted decimal notation ffffff00 in hexadecimal notation
Hosts and routers connected to a subnet are configured with the mask for the subnet. It is common practice to use a single subnet mask throughout an organization's internet.
Not every number can be assigned to a subnet or to a host. For example, some addresses are used for broadcasting while others are reserved for use in routing tables.
A good rule of thumb is: stay away for using a block of 0s or a blocks of 1s in either your subnet field or your host field. Also, there are no network numbers consisting of all 0s or all 1s. Hence, to be usable a network, subnet or host field must contain at least 2 bits.
Use | Description | Example |
---|---|---|
Identifying Networks and Subnets | It is convenient to use a dotted address format to refer to a network, by filling in the local part of the address with zeroes. |
8.0.0.0 (Class A network) 130.24.0.0 (Class B network) 192.197.62.0 (Class C network) |
Broadcasting | By setting the local address, or all bits of an address to 1s, an IP datagram can be sent to all hosts on the local subnet or to all hosts on a remote subnet. |
255.255.255.255 (to all hosts on local subnet) 130.24.255.255 (to all hosts on Class B network 130.24.0.0) 130.24.8.255 (to all hosts on subnet 130.24.8.0) |
Loopback Address | At the opposite extreme to broadcasting are messages that never leave the local host. There are many hosts that contain both client and server processes. The local clients and servers communicate via IP within the host. To do this, they use a special address called the loopback address. |
127.0.0.0-127.255.255.255 (reserved for loopback)
127.0.0.1 (the only one actually used) |
Address | Description |
---|---|
0.0.0.0 | Used as the source address in a boot configuration request. Also denotes the default route in a routing table. |
127.0.0.0 | Reserved. |
127.0.0.1 | Loopback. Client and server are in the same host. |
127.0.0.2-127.255.255.255 | Reserved. |
128.0.0.0 | Reserved. |
191.255.0.0 | Reserved. |
192.0.0.0 | Reserved. |
255.255.255.0 | Reserved. |
240.0.0.0-255.255.255.254 | Reserved. |
255.255.255.255 | Broadcast on locally attached LAN. |