This preview shows page 1. Sign up to view the full content.
Unformatted text preview: s OK (the reassembly algorithm handles this), most Berkeleyderived implementations have the IP layer increment a kernel variable each time an IP datagram is sent, regardless
of which layer passed the data to IP to send. This kernel variable is initialized to a value based on the time-of-day
when the system is bootstrapped. The time-to-live field, or TTL, sets an upper limit on the number of routers through which a
datagram can pass. It limits the lifetime of the datagram. It is initialized by the sender to some
value (often 32 or 64) and decremented by one by every router that handles the datagram. When
this field reaches 0, the datagram is thrown away, and the sender is notified with an ICMP message.
This prevents packets from getting caught in routing loops forever. We return to this field in
Chapter 8 when we look at the Trace-route program.
We talked about the protocol field in Chapter 1 and showed how it is used by IP to demultiplex
incoming datagrams in Figure 1.8. It identifies which protocol gave the data for IP to send.
The header checksum is calculated over the IP header only. It does not cover any data that follows
the header. ICMP, IGMP, UDP, and TCP all have a checksum in their own headers to cover their
header and data.
To compute the IP checksum for an outgoing datagram, the value of the checksum field is first set file:///D|/Documents%20and%20Settings/bigini/Docum.../homenet2run/tcpip/tcp-ip-illustrated/ip_inter.htm (4 of 19) [12/09/2001 14.46.37] Chapter 3. IP: Internet Protocol to 0. Then the 16-bit one's complement sum of the header is calculated (i.e., the entire header is
considered a sequence of 16-bit words). The 16-bit one's complement of this sum is stored in the
checksum field. When an IP datagram is received, the 16-bit one's complement sum of the header is
calculated. Since the receiver's calculated checksum contains the checksum stored by the sender,
the receiver's checksum is all one bits if nothing in the header was modified. If the result is not all
one bits (a checksum error), IP discards the received datagram. No error message is generated. It is
up to the higher layers t...
View Full Document
- Spring '12