Subnet masks are 32-bit values that allow the recipient of IP
packets to distinguish the network
ID portion of the IP
from the host
ID. Like an IP address,
the value of a subnet
frequently represented in dotted decimal notation. Subnet masks are determined by assigning 1's to
bits that belong to the network
ID and 0's to the bits that belong to the host
ID. Once the bits are
in place, the 32-bit value is converted to dotted decimal notation, as shown in the table
|Address class||Bits for subnet mask||Subnet mask
|Class A||11111111 00000000 00000000 00000000||255.0.0.0
|Class B||11111111 11111111 00000000 00000000||255.255.0.0
|Class C||11111111 11111111 11111111 00000000||255.255.255.0
Table - Default Subnet Masks for Standard IP
The result allows TCP/IP to determine the host
network IDs of the local computer. For example, when the IP
is 22.214.171.124 and the subnet
mask is 255.255.0.0, the network
ID is 102.54 and the host
ID is 94.97.
Keep in mind that all
of this with the subnet
masks is the principle and not necessarily the practice. If you (meaning
your company) has been assigned a Class B address,
then the the first two octets are assigned to
you. You could then breakdown the class
B net into Class C nets. If we take a look at Table 0\1, we
see that there are 65,534 possible nodes in that network.
That is really too many to manage.
However, if we considered each of the third octets to represent a sub-net of our class
network, they would all have 254 possible nodes per sub-net. This is basically what a class
C net is
anyway. We can then assign each sub-net to a department or building and then assign one person to
manage each of the class
C sub-nets, which is a little easier to do.
To keep the different
class C subnet
from interfering with each other, we give each sub-net a Class C
subnet-mask, although the first octet is in the range for a Class B network.
That way machines on
are only concerned with packets for the subnet. We can also break down the sub-nets
physically so that there is a gateway
between the subnets. That way the physical network
is not overburdened with traffic from 65,534 machines.
Let's look at an example. Assume your
company uses the Class B address
172.16.0.0. The different departments within the company are
assigned a class
that might look like this: 172.16.144.0. Although the first octet (172)
says that this is a class
it is really the subnet-mask that makes that determination. In
this case, our subnet
would be: 255.255.255.0. Therefore, any packet
that is destined for an
address other than one starting 172.16.144.0 is not on this network.
It is the responsibility
to ensure that each packet
ends up going to the right machine. This is accomplished, in part,
by assigned a unique address
to each machine. This address is referred to as the Internet address
gets a set of these IP addresses that are within a specific range. In
general, packets that are destined for an IP
within that range will stay within the local
network. Only when a packet
is destined for somewhere outside of the local network
is it "allowed"
In other words, IP
is responsible for the delivery of the packet.
It functions similar to the post office, whereby you have both a sending
and receiving address. Often times you
have many more letters than a single mail bag can handle. The mail carrier
(or someone else at the
post office) will break down the number of letters into sets small enough to fit in a bag. This is what IP does.
Since there are many people using the line all at once, IP will break down the TCP
packets into units of a specific size. Although often referred to also a packets, the more
correct terminology is to refer to IP packets as
datagrams. Just like bags of mail need
to go from one post office to the next to reach their final destination, IP
datagrams must often go
through different machines to reach their final destination.
Saying that IP routing can be
accomplished completely in software isn't entirely accurate. Although, no physical router
IP can't send a packet
to someplace where there is no physical connection. This is normally
accomplished by an additional network
card. With two (or more) network cards a single machine can be
connected to multiple networks. The IP
layer on that one machine can then be used to route
packets between the two networks.
Once configured (how that's done, we'll talk about later),
IP maintains a table of routing information, called (logically) a routing table. Every time the IP
layer receives a packet,
it checks the destination address