Beruflich Dokumente
Kultur Dokumente
Chap -4 Internet Protocol Chapter 4 Internet Protocol Virtual network Internet architecture and philosophy Purpose of internet protocol, IPv4 Internet datagram options Direct and indirect delivery UDP
COCSIT
A Virtual Network
The focus should be on the interface that an internet provides to users, not on the interconnection technology.
A user thinks of an internet as a single virtual network that interconnects all hosts, and through which communication is possible; its underlying architecture is both hidden and irrelevant. In a sense, an internet is an abstraction of physical networks because, at the lowest level, it provides the same functionality: accepting packets and delivering them. Higher levels of internet software add most of the rich functionality users perceive.
M.No. 9970702247
BCA SY 2013-14
Page 1
Jafar Shaikh
COCSIT
Datagram Format
M.No. 9970702247
BCA SY 2013-14
Page 2
Jafar Shaikh
COCSIT
Now that we have described the general layout of an IP datagram, we can look at the contents in more detail. Figure 7.3 shows the arrangement of fields in a datagram:
Because datagram processing occurs in software, the contents and format are not constrained by any hardware. For example, the first C bit field in a datagram (VERS) contains the version of the IP protocol that was used to create the datagram. It is used to verify that the sender, receiver, and any routers in between them agree on the format of the datagram. All IP software is required to check the version field before processing a datagram to ensure it matches the format the software expects. If standards change, machines will reject datagrams with protocol versions that differ from theirs, preventing them from misinterpreting datagram contents according to an outdated format. The current IP protocol version is 4. Consequently, the term IPv4 is often used to denote the current protocol. The header length field (HLEN), also 4 bits, gives the datagram header length measured in 32-bit words. As we will see, all fields in the header have fixed length except for the IP OPTIONS and corresponding PADDING fields. The most common header, which contains no options and no padding, measures 20 octets and has a header length field equal to 5. The TOTAL LENGTH field gives the length of the IP datagram measured in octets, including octets in the header and data. The size of the data area can be computed by subtracting the length of the header (HLEN) from the TOTAL LENGTH. Because the TOTAL LENGTH field is 16 bits long, the maximum possible size of an IP datagram is 216 or 65,535 octets. In most applications this is not a severe limitation. It may become more important in the future if higher speed networks can carry data packets larger than 65,535 octets.
The fields of the OPTION CODE consist of a 1-bit COPY flag, a 2-bit OPTION CLASS, and the 5-bit OPTION NUMBER. The COPY flag controls how routers treat options during fragmentation. When the COPY bit is set to I, it specifies that the option should be copied into all fragments. When set to 0, the COPY bit means that the option should only be copied into the first fragment and not into all fragments. The OPTION
M.No. 9970702247
BCA SY 2013-14
Page 3
Jafar Shaikh Chap -4 Internet Protocol COCSIT CLASS and OPTION NUMBER bits specify the general class of the option and a specific option in that class. The table in Figure 7.1 1 shows how option classes are assigned
The table in Figure 7.12 lists examples of options that can accompany an IP datagram and gives their OPTION CLASS and OPTION NUMBER values. As the list shows, most options are used for control purposes.
1.
M.No. 9970702247
BCA SY 2013-14
Page 4
Jafar Shaikh
COCSIT
Whenever a machine handles a datagram that has the record route option set, the machine adds its address to the record route list (enough space must be allocated in the option by the original source to hold all entries that will be needed). To add itself to the list, a machine first compares the pointer and length fields. If the pointer is greater than the length, the list is full, so the machine forwards the datagram without inserting its entry. If the list is not full, the machine inserts its Coctet IP address at the position specified by the POINTER, and increments the POINTER by four. When the datagram arrives, the destination machine can extract and process the list of IP addresses. Usually, a computer that receives a datagram ignores the recorded route. Using the record route option requires two machines that agree to cooperate; a computer will not automatically receive recorded routes in incoming datagrams after it turns on the record route option in outgoing datagrams. The source must agree to enable the record route option and the destination must agree to process the resultant list.
2.
Another idea that network builders find interesting is the source route option. The idea behind source routing is that it provides a way for the sender to dictate a path through the internet. For example, to test the throughput over a particular physical network, N, system administrators can use source routing to force IP datagrams to traverse network N even if routers would normally choose a path that did not include it. The ability to make such tests is especially important in a production environment, because it gives the network manager freedom to route users' datagrams over networks that are known to operate correctly while simultaneously testing other networks. Of course, source routing is only useful to people who understand the network topology; the average user has no need to know or use it. IP supports two forms of source routing. One form, called strict source routing, specifies a routing path by
M.No. 9970702247
BCA SY 2013-14
Page 5
Jafar Shaikh
COCSIT
Strict source routing means that the addresses specify the exact path the datagram must follow to reach its destination. The path between two successive addresses in the list must consist of a single physical network; an error results if a router cannot follow a strict source route. The other form, called loose source routing, also includes a sequence of IP addresses. It specifies that the datagram must follow the sequence of IP addresses, but allows multiple network hops between successive addresses on the list. Both source route options require routers along the path to overwrite items in the address list with their local network addresses. Thus, when the datagram arrives at its destination, it contains a list of all addresses visited, exactly like the list produced by the record route option. The format of a source route option resembles that of the record route option shown above. Each router examines the POINTER and LENGTH fields to see if the list has been exhausted. If it has, the pointer is greater than the length, and the router routes the datagram to its destination as usual. If the list is not exhausted, the router follows the pointer, picks up the IP address, replaces it with the router's address?, and routes the datagram using the address obtained from the list. Timestamp Option The timestamp option works like the record route option in that the timestamp option contains an initially empty list, and each router along the path from source to destination fills in one item in the list. Each entry in the list contains two 32-bit items: the IP address of the router that supplied the entry and a 32-bit integer timestamp. Figure 7.15 shows the format of the timestamp option
3.
In the figure, the LENGTH and POINTER fields are used to specify the length of the space reserved for the option and the location of the next unused slot (exactly as in the record route option). The 4-bit OFLOW field contains an integer count of routers that could not supply a timestamp because the option was too small. The value in the 4-bit FLAGS field controls the exact format of the option and tells how routers should supply timestamps. The values are:
Timestamps give the time and date at which a router handles the datagram, expressed as milliseconds since midnight, Universal Time?. If the standard representation for time is unavailable, the router can use any
M.No. 9970702247
BCA SY 2013-14
Page 6
Jafar Shaikh
COCSIT
representation of local time provided it turns on the high-order bit in the timestamp field. Of course, timestamps issued by independent computers are not always consistent even if represented in universal time; each machine reports time according to its local clock, and clocks may differ. Thus, timestamp entries should always be treated as estimates, independent of the representation. It may seem odd that the timestamp option includes a mechanism to have routers record their IP addresses along with timestamps because the record route option already provides that capability. However, recording IP addresses with timestamps eliminates ambiguity. Having an address recorded along with each timestamp is also useful because it allows the receiver to know exactly which path the datagram followed.
An application program that uses UDP accepts full responsibility for handling the problem of reliability, including
message loss, duplication, delay, out-of-order delivery, and loss of connectivity. Unfortunately, application programmers often ignore these problems when designing software. Furthermore, because programmers often test network software using highly reliable, low-delay local area networks, testing may not expose potential failures. Thus, many application programs that rely on UDP work well in a local environment but fail in dramatic ways when used in a larger TCP/IP internet.
The SOURCE PORT and DESTINATION PORT fields contain the 16-bit UDP protocol port numbers used to demultiplex datagram among the processes waiting to receive them. The SOURCE PORT is optional. When used, it specifies the port to which replies should be sent; if not used, it should be zero. The LENGTH field contains a count of octets in the UDP datagram, including the UDP header and the user data. Thus, the minimum value for ENGTH is eight, the length of the header alone. The UDP checksum is optional and need not be used at all; a value of zero in
M.No. 9970702247
BCA SY 2013-14
Page 7
Jafar Shaikh
COCSIT
the CHECKSUM field means that the checksum has not been computed. The designers chose to make the checksum optional to allow implementations to operate with little computational overhead when using UDP across a highly reliable local area network. Recall, however, that IP does not compute a checksum on the data portion of an IP datagram. Thus, the UDP checksum provides the only way to guarantee that data has arrived intact and should be used. Begi~erso ften wonder what happens to UDP messages for which the computed checksum is zero. A computed value of zero is possible because UDP uses the same checksum algorithm as IP: it divides the data into 16-bit quantities and computes the one's complement of their one's complement sum. Surprisingly, zero is not a problem because one's complement arithmetic has two representations for zero: all bits set to zero or all bits set to one. When the computed checksum is zero, UDP uses the representation with all bits set to one.
M.No. 9970702247
BCA SY 2013-14
Page 8