IP
plays an important role in transmitting data across internetworks.
Packets are exchanged and processed on each computer by using IP at
the Internet layer on the source computer, at routers along the path
to the destination, and at the destination computer. To send data
between two computers that are on different network segments, IP
consults a local routing table for a route to the remote computer.
If it finds a route, it sends the packet using that route.
Otherwise, it forwards the data packets to its default router.
IP at
the Source Computer
In
addition to adding such information as the TTL, IP always adds the
IP address of the destination computer to the packet. In the case of
a direct delivery, ARP is used to add the MAC address of the
destination computer. In the case of indirect delivery, ARP is used
to add the MAC address of the router to which the packet will be
forwarded.
IP at
the Router
After the packet reaches a router, IP on the router determines where
the packet is to be sent next. For this purpose, IP performs the
following steps:
1.
IP verifies the checksum and destination IP address. If the IP
address is the router’s IP address, the router processes the packet
as the destination computer (IP at the destination).
2.
IP then decreases the TTL and checks its routing table for the best
route to the destination IP address.
3.
In the case of a direct delivery, ARP is used to add the MAC address
of the destination computer. In the case of indirect delivery, ARP
is used to add the MAC address of the router to which the packet
will be forwarded.
This
entire process is repeated at each router in the path between the
source and destination computer until the packet reaches a router on
the same segment as the destination computer.
Fragmentation and Reassembly
When
a packet that is too large to be transmitted on the network arrives
at a router, IP breaks up the packet into smaller packets before
transmitting it onward. This process is known as fragmentation. All
of the small packets are then routed to the remote network. Even if
they travel through multiple routers, the fragments are reassembled
only when all of the small packets that make up the entire data
transmission reach the destination
computer. This process is known as reassembly.
IP at
the Destination
When
a packet is received at the destination computer, it is passed up to
IP. IP on the destination computer verifies the checksum and
destination IP address. IP then passes the packet to either TCP or
UDP. Finally, the packet is passed to the destination application,
based on the port number, for final processing. If at any time the
TTL drops below zero or a step fails, such as if the destination
application is not found, the packet is dropped and an ICMP packet
may be returned. Although the delivery of an ICMP packet is not
guaranteed, if TCP is used, then the original packet will be
retransmitted.