Realistically, there are not 216 machines on a class B network (the
physical wire cannot support that many machines)
But, using subnet masks, the class B network can be configured as a class C
If your IP address is 22.214.171.124 (that's a class B), you can tell
IP to use 126.96.36.199 as the network number instead of 188.8.131.52.
You do that by specifying a mask of 255.255.255.0. The 1's tell the
network number. The 0's tell the host number.
So, the subnet mask is used to inform the IP software as to which bits
represent the network number and which bits represent the host number.
In a network, all machines must have the same subnet mask. If not, the
definition of the network number would vary from one machine to the next, and
that would cause the IP software to malfunction.
Note that subnet masks do not have to be contiguous. The subnet mask
can be used to have any bits in the host number act as the network number.
If you specify a subnet mask, then IP logically-ANDs that mask with the
destination IP address to get the network number.
Some more notes on the TCP/IP suite:
The Internet Protocol
- IP is the heart of the
- The higher-level protocols
and the lower-level device drivers interact only with IP.
- Given a packet from a
higher-level protocol, IP examines the destination address, looks at the
network number of the address, figures out the network to which the packet
should be delivered, passes it to the corresponding device driver, and
routes packets from one network to another.
- Because IP relays and routes
packets, it corresponds to the network layer of the OSI model.
- If the recipient is not on a
directly accessible network, IP sends the packet to an appropriate host
that can deliver the packet to its final destination.
- IP keeps information about routers
to which to send packets if the destination host is on a network that is
not directly attached to your machine.
- IP does not retransmit lost
packets, does no error checking of data consistency, and does not ensure
that packets arrive in sequence (the TCP layer provides those services).
- IP ensures that a packet does
not loop continuously through the network trying by maintaining a ``Time
to Live'' counter.
The Address Resolution Protocol
- ARP implements a ``dynamic
discovery'' procedure of mapping IP addresses into hardware addresses, and
it is usually used on Ethernet and Token Ring local area networks.
- Before IP sends a packet to
that network, ARP consults a local table to see if a mapping exists
between the destination IP address and the destination Ethernet address.
If it doesn't, ARP sends a broadcast packet requesting the Ethernet
address of the machine with the given IP address. Because it is a
broadcast packet, every machine in the network receives it.
- The host with the requested
IP address sends a reply, stating its Ethernet address. The originating
machine receives the reply, adds an entry into its mapping table that
associates the IP address with the Ethernet address, and sends the packet
to its destination.
The Transmission Control Protocol
- TCP provides virtual-circuit
- It handles flow control by
ensuring packets are received intact and in order, checks for errors in
received packets, and retransmits packets that are lost or damaged.
- The destination TCP module
sends an acknowledgment for every packet received.
- If the TCP module on the
originating machine does not receive the acknowledgment, it retransmits
- If the acknowledgment is not
received after several retransmissions, TCP assumes the data cannot be
delivered and passes an error indication to the application.
- There are no ``negative
acknowledgments'' in TCP/IP the TCP module on the destination machine does
not send a message if it detects an error in the packet. If the TCP module
on the originating machine does not get an acknowledgment, it assumes the
original packet was never received, the packet was corrupt, or the
acknowledgment was lost. In all cases, the TCP module on the originating
machine resends the packet.
There are several aspects of TCP that applications
must be aware:
- TCP provides virtual-circuit
service. The client must establish a connection with the server before any
communication can take place.
- TCP connections are
full-duplex. Data may be transmitted simultaneously in both directions.
- TCP maintains no record
markers and transmits no information about how many bytes were written.
So, an application may have to do several read requests to obtain all the
data sent with a single write request.
The User Datagram Protocol
- UDP only provides datagram
service. It does not do any error correction or retransmissions.
- The UDP module on the
destination machine can check for errors in packets, but it only delivers
error-free packets to the application. Erroneous packets are dropped.
- The application must specify
the recipient address on every message. Connection establishment is not
- UDP is datagram-based, so
every message is a discrete unit.
There are several aspects to UDP that applications
must be aware:
- Data sent may be lost If
your application sends a message to a service and expects a response, it
must be coded to time out and resend the request if it does not receive
- Data may arrive out of
sequence. If your application sends two messages to a service, the service
may not receive them in the order sent.