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.
The Internet Control Message Protocol
- The Internet Control Message
Protocol (ICMP) is responsible for generating control messages.
- Advisory messages (slow
down, better route, etc).
- If desired, applications can
interface with ICMP directly.
- For example, the ping
command is a TCP/IP application. It sends an ``echo'' packet to a
specified server machine via the ICMP protocol.
- Although applications can
interface with ICMP directly, it is not a transport-layer protocol. It
does not provide a consistent interface for end-to-end communication.
- The TCP/IP protocol suite
has several routing protocols. the Gateway-to-Gateway Protocol (GGP), the
Exterior Gateway Protocol (EGP), the Routing Information Protocol (RIP).
- They are used between router
machines to pass and establish routing information, and they are generally
of little concern to applications.
Applications and security
- TCP/IP does not provide any
information about the identity of a user sending a packet.
- This may seem odd for a
protocol that was developed by the U.S. Department of Defense, but the
rationale was to let each application determine its own security
- Each application must
implement the identification and authentication features and the security
constraints it deems appropriate.
- Earlier, we described how an
IP address uniquely identifies a machine on a network.
- Unfortunately, we can't use
the IP address to form a complete transport address, because you must also
specify the service on the server machine with which you want to
- TCP/IP solves this problem
by assigning a 16-bit port number to each service.
- A complete transport address
for a TCP/IP service consists of a 32-bit IP host address and a 16-bit
- The 32-bit IP address
identifies a machine interface, and the 16-bit port number identifies a
service on that machine.
- Both TCP and UDP provide
16-bit port numbers that services use when listening for messages.
- A service associates itself
with a port number, and all messages sent to that port number are
delivered to the associated service.
- The TCP/IP protocol reserves
ports 1 through 255 for "standard" services.
- A standard service is
one that has been approved by the Internet Engineering Task Force, a group
of users and implementors that meet several times a year.
- Once approved, the Internet
Assigned Numbers Authority at the Information Sciences Institute of the
University of Southern California assigns a port number to the service.
- For example, the ftp service
allows file transfer using the TCP/IP protocol.
- It is approved by the
Internet Engineering Task Force and is assigned the port number 21.
- Every system offering
the ftp service has it available on port number 21.
- The TCP/IP specification
states that port numbers over 255 are not reserved.
- However, UNIX restricts
these port numbers by using the following BSD convention s:
- Port numbers 1
through 1024 are considered ``privileged ports.''
- Your application can
use these ports only if your effective user-id is 0.
- Ports 1025 through
5000 are used by applications that want to get an arbitrary, unused port.
- Although these are
sometimes used by server processes, ports over 5000 are reserved for
- The TCP and UDP protocols do
not share port numbers.
- One application can
associate itself to a port number over TCP, and another can associate
itself to the same port number over UDP.
- This doesn't pose a
problem, because applications must choose to use either TCP or UDP for
- Most TCP/IP applications
allow you to specify a machine name instead of an IP address.
- These applications consult
databases to translate machine names into IP address.
- To solve the problem of name
collisions in large networks like the Internet, the ARPANET Domain Name
System (DNS) associates domain names with machines.
- A domain name is a
period-separated list of names that represent administrative authorities,
and it is read right to left.
- For example, the machine
- shows that an
initial administrative authority has created the name com and given the
responsibility for the name space of com to another administrative
- The administrative
authority for com has created the name att and delegated responsibility
for that name space to yet another administrative authority.
- Finally, the
administrative authority for att has created the name farside.
- Naming a service is easier
than naming a machine, because the name space is much smaller.
- Service names generally
correspond to the service provided, such as ftp for the file-transfer
protocol and rlogin for the remote-login protocol.
- New services must come up
with unique names.
- If a new service is
approved by the Internet Engineering Task Force, the name and port number
are assigned by the Internet Assigned Numbers Authority at the
Information Sciences Institute of the University of Southern
- If a new service is a local
service used only at your installation, the name can be any string that
does not conflict with other services.