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.
|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.||
22.214.171.124 (Class A network)
126.96.36.199 (Class B network)
188.8.131.52 (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)
184.108.40.206 (to all hosts on Class B network 220.127.116.11)
18.104.22.168 (to all hosts on subnet 22.214.171.124)
|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)
|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.1||Loopback. Client and server are in the same host.|
|255.255.255.255||Broadcast on locally attached LAN.|