User:Schin/Internet Protocol

= Chapter on Internet layer and Internet Protocol =

Section 1: Overview
Link layer protocols solve the problems of computer communication in "a shared medium environment". These problems include: syncronizing sender and receiver, identificating sender and receiver, collision detection...etc. The "a shared medium environment" will be called "a network" insteadly in this chapter. If we want to build communication between computers located in different "networks", depanding on only Link layer protocols is not enough. In the four layers model, we provide solutions on upper layers of Link layer. This chapter will introduce the Internet layer. In the last chapter Ethernet is used as an example to describe Link layer, this chapter will mainly use IPv4 over Classful networks architecture to give you a basic concept of Internet layer.

In next section you will see an example of birthday card sending as an analogy to computer communication in "a network" and different "networks". Then it comes brief history of Internet Protocol(IP), which is the main protocol that dominates Internet layer function. From section 3 to section 5 are main sections. You will learn in subsection 3.1 the Classful network to give you a basic view of IPv4 adress and network classification. Subsection 3.2 introduces the limits and problems of Link layer protocols when we want to communicat between networks, that is, the motivatiion of internet. Section 4 talks about the role IP address plays in routing. Subsection 4.1 uses an example of IPv4 over Classful networks architecture to show the mechanism of communication between two computers which are located in different networks. Mechanism of routing table are introduced in subsection 4.2. After subsection 4.2, you might have question of how IP addresses be changed to MAC addresses during routing. Address Resolution Protocol(ARP) in subsection 4.3 will give you an answer. Then following subsections in section 5 are subjects about IP address adaption and IP address exhaustion preventing. Maybe you will think that Classful network is not so flexible to adapt different demands of network sizes, then the Classless Inter-Domain Routing(CIDR) which is more flexible than Classful network is introduced in subscetion 5.1. In subsection 5.2 you will know how to allocate IP addresses to computers in a network that does not link to public networks, that is a private network. Final part in section 5 is subsection 5.3 which gives you a rough concept of IPv6.

After section 5, you already have a basic concept of communication over internet, but it is still not enough to transport data reliably through Internet. Section 6 is the conclution and limitation of Internet layer protocols. Computers can communicate other computers which are located in different network by Internet layer protocols, but the communication is not reliable. For example, Internet layer protocols can niether reassamble packages received by receiver correctly nor make sure all packages have been received by receiver. Although there are problems lefted in this chapter, you will know how to solve them on Transport layer in the next chapter.

Section 2: Introduction
Just imaging that you write a birthday card during a class and then you give that birthday card to an identified classmate whose birthday is today, it would be not difficult. But if you write a birthday card for a foreign friend, almostly this card will be send by "international" post and of course you will need at least the address of your friend. The word "Internet" has the similar conception Concept of Internet minute 0:30-0:44. That means if your computer in a network wants to "interconnect" another computer located in another network, you need at least an "address" of that computer, then through a "transfer process" which is just like the international post card transfering through countries, and then you can connect the remote computer eventually. Figure 1. is a conceptual analogy between birthday card sending and computer communication. Subsection 3.1 will introduce you IP address (IPv4 address, see Appendix) through classful network.



Before 70's, there were only researchers and analysists who need to let there computers connected in a network. These computers were mostly based on a central processing system for centralization, and with terminal systems like input and output devices. Such a connection system originally appeared in the form of a network. Each network had their own communication rules, therefore these networks actually were independent of each other.

In 1969, it was the period of the Cold War. The USA military section was trying to develop a mechanism for connecting the various discrete network systems to meet the needs of expected war crisis, and this project was named ARPANET(Advanced Research Project Agency Network). The idea and principle that ARPANET built are also the idea and principle of Internet Invention of Internet minute 1:12-1:32. So the concept of Internet was started from military section but not civil section. After ARPANET developed in military section, the Institute of Electrical and Electronic Engineers(IEEE) published "A Protocol for Packet Network Intercommunication" which was written by Vint Cerf and Bob Kahn. This paper described the concept of Internet layer and Transport layer. It became known as Internet protocol suite informally known as TCP/IP, which built the foundation of Internet architecture.

From next section you will learn the basic concept of Internet layer include "IP address" and "routing algorithm" which you know are necessary in communication over Internet. Transport layer and TCP are subjects of next chapter.

Learning Objectives of this Section

 * 1) Understand basic concept of Classful network, especially the the number of bits of network address and host address in each class.
 * 2) Understand the the motivation of Internet layer, that includes limitation of Link layer and decentralization.

Subsection 3.1: IP address and Classful networks
In the early stages of development of the Internet Protocol (see Appendix), network administrators interpreted an IP address in two parts: network number portion and host number portion. The highest order octet (most significant eight bits) in an address was designated as the network number and the remaining bits were called the rest field or host identifier and were used for host numbering within a network.

This early method soon proved inadequate as additional networks developed that were independent of the existing networks already designated by a network number. In 1981, the Internet addressing specification was revised with the introduction of classful network architecture.

A classful network is a network addressing architecture used in the Internet from 1981 until the introduction of Classless Inter-Domain Routing in 1993. The method divides the address space for Internet Protocol Version 4 (IPv4) into five address classes. Each class, coded in the first four bits of the address, defines either a different network size, i.e. number of hosts for unicast addresses (classes A, B, and C), or a multicast network (class D). The fifth class (class E) address range is reserved for future or experimental purposes.



The "Size of Network Number bits Field" in above figure is actually the "Prefix" of network. From "Start Address" and "End Address" attributes of every class in Figure 2. one can understand which class a network is belonged to in a classful network. For example, the 67.0.0.0 network in subsection 3.2 is a class A network with prefix 67, 141.71.0.0 network is a class B network with prefix 141.71, and 141.0.0.0 network is also a class B network with prefix 141.0. The "Leading bits" attribute in Figure 2. tells you the first bit of a class A network will always be 0, the first two bits of a class B network will always be 10, and the first three bits of a class C network will always be 110.

Subsection 3.2: From Link layer to Internet layer


Like the four layers architecture which is showed in Figure 3., Internet layer is the upper layer of Link layer. If we want computers to communicate to each other in a global scale, it will be not possible depending only on Link layer protocols because of their limitations. There are mainly two limitations:

1. Limited transfer distance. So every network grouped by their own Link layer protocols and then they connect all together as an Internet. Maximum length of Ethernet minute 0:07-0:12.

2. Limit of scalability. Figure 4. shows that collisions will almostly always happen if we try using only Link layer protocols to connect computers around the world. It is because when some computer wants to sent some data, then the computer has to occupy the entire network. If there are too many client computers there, collisions will arise all the time with the result that no computer will be able to pass any message like the following figure. Collision of global scale Ethernet minute 0:44-1:07.



Besides the limitation of Linklayer, another requirement to create Internet was to have it decentralized. Actually the concept of decentralization was commissioned by the Department of Defense of USA. They developed ARPANET to achieve that when one part of networks was paralyzed, it is still able to transmit data through other lines which are not paralyzed.



In the decentralized system of Figure 5., we can see that if one network fails, the other networks will still be with some connection to each other at least. In a star topology, if one central network fails, then you are in trouble because your system has no way of communicating anymore.

All above are reasons about why we need Internet layer protocols, you can also see Motivation of Internet layer and Internet protocol. Next section will introduce you basic concept of machenism about communication of two computers locate in different networks, which we also call "Routing".

Learning Objectives of this Section

 * 1) Understand the roles of IP address and router play in routing mechanism.
 * 2) Understand the basic concept of routing table and routing algorithm.
 * 3) Understand basic concept of ARP and the role MAC address plays in routing.

Subsection 4.1: Mechanism in communication between networks
If we want one computer to communicate to the other computers which are located in different network, we must have the "adderess" of the remote computer and know the "transfer process" when messages are transfered from one network to ahother. The "address" and "transfer process" are "IP address" and "routing algorithm" accordingly. This subsection uses an example of IPv4 over Classful networks architecture as an introduction. The different kinds of addresses in a network is like Figure 6.:



From figure 6. you can see the IP address is different from MAC address. IP address has a shorter length than MAC address. In IPv4 is basically 32 bits integer, so it consists of 4 bytes and each byte is denoted as the number separated with dot (67.68.50.1). It is easier than MAC address to be read. Each number between the dots presents one byte and can be presented between 0 and 255 in decimal IPv4 address minute 1:00-1:27.

Because IP address is shorter than MAC address, one could doubt that is IP address enough for identifying hosts on global Internet? It is a question about IP address exhausting, and a new version of IP, that is, IPv6 will solve it. Subsection 5.4 will introduce you IPv6.

But MAC address is longer than IP address, can we use MAC address for routing over Internet? It is a good question, and actually it will be impossible due to the fact that MAC address consists vendor code in the first 3 Bytes and the rest part is just a serial number. You can wonder that computers with similar MAC addresses of Ethernet devices exist in networks all over the world, so there is no way to identify a network, and that means routing is impossible! MAC address minute 3:32-4:04.

It is true that every network are identified by IP address in routing. All the IP addresses in one network start with the same number called network prefix Network prefix minute 1:44-1:54. A network IP address is presented by a prefix follows by 0 or 0s till least significant Byte Network address minute 2:42-2:51 as figure 7.:



Figure 7. also shows that all IP addresses of computers in the same network starting with the same network part (67 for example). IP address 67.0.0.0 is a network IP address. This IP address will never be assigned to any host in the network. The same situation is also in network 141.71.0.0. So in order to interconnect these two networks we need to introduce one further computer called router. The router in this example has 2 network devices, which means the router has two IP addresses and two MAC addresses. Each network devices will belong to one of those networks. If packages are from 67.0.0.0 network and their destination is 141.71.0.0 network, they can just go to the router and the router would forward them to the 141.71.0.0 network according to routing table inside that router Router and routimg table minute 4:24-5:17.

Untill now you have known the basic concept of IP address and router. IP address is an analog of "address" in an international post card, in Figure 8. router is an analog of "forward post office" in international post transfer.



You can also see the topic of prefix and simple mechanism of communication between networks in IPv4 network. The routing table mechanism will be introduced in next subsection.

Subsection 4.2: Basic concept of routing algorithm
In last subsection we see the router belongs to two networks as a bridge for communication between these two networks. That is a simplized example. A router actually belongs to many networks in real world, so problem is which network should be selected to route? The answer is really depanding on the routing table Function of routimg table minute 2:22-2:24.

For example, we want forward data from one computer in 67.0.0.0 network to another computer located in 205.34.55.0 network as Figure 9.:



Wherever the package arrives the router, the router needs to decide whether this package needs to stay at this network and be delivered to some host there or it has to be passed to the next network. In order to make this decision router maintains the routing table.

We assume that computer 67.68.50.1 in network 67.0.0.0 as sender and computer 205.34.55.1 in network 205.34.55.0 as receiver. They also have routing tables because every host on the Internet has to have a routing table:



In figure 10., the data from sender will first go to destination network 0.0.0.0 that means that this is the default route Default route minute 3:36-3:42 and the destination for the next hop will be 67.68.50.13. It means that whatever package is sent that is not for 67.0.0.0 network and what the computer will do is it will assemble an Ethernet frame that goes to 67.68.50.13 computer, and which is a router in this example. These computers which are in 67.0.0.0 network are obligatory to know the MAC Address of that router. But there is another protocol, that is, Address Resolution Protocol(ARP) that resolves this problem. You can know more about ARP in next subsection.

The 67.68.50.1 computer sends its package to 67.68.50.13 router according to its routing table Mechanism of routimg minute 4:34-4:44. The router starts to read the IP header and sees that this package is supposed to be send to 205.34.55.1 computer.

The 67.68.50.13 router looks inside its routing table and sees the entrance for 205.34.55.0 network. So it forwards package to the next host with IP address 141.71.30.58. Again you forward package to 141.71.30.58 computer, and it is also a router. The 141.71.30.58 router also blongs to the 205.34.55.0 network. So it already knows where to forward the package.

This subsection describes routing only with IP address mechanism for easier underestanding the routing concept. Next subsection will introduce you ARP. You can also see IP forwarding algorithm.

Subsection 4.3: ARP
Address Resolution Protocol (ARP) is a protocol used for change IPv4 addresses into MAC addresses. ARP was defined by RFC 826 in 1982. In most operating systems you can execute ARP program. For example, you can see ARP cash in cmd shell of MS Windows by typing "arp -a".

The basic function of ARP is essential in IPv4, but in IPv6 is no longer applicable. ARP was replaced by Neighbor Discovery Protocol(NDP) in IPv6.

How does ARP work in IPv4? It is true that in an IPv4 Internet layer environment, ARP is necessary even communicating within "a network". For example, in an Ethernet protocol communication, we must know the MAC address of the target host, but the Internet layer is only interested in the subject of IP address. This leads to the use of IP protocol over an Ethernet network, but the Ethernet protocol or Link layer protocol receives the information provided from the upper Internet layer which contains only the IP address of the destination host. So you need a way, according to the IP address of destination host to obtain its MAC address. This is what the ARP protocol does.

In addition, when sending host and destination host are not located in the same network, they can not communicate without the router. So the sending host will first get the MAC address of the router through the ARP protocol, and then the sending host sends the frame with the router's MAC address as MAC destination address to the router.

For example, a sender with IP address 67.68.50.1 sends package through router 67.68.50.13. The computer can assemble an Ethernet frame and use the MAC address of router by broadcasting an ARP request, and then the router answers with its MAC address. The sender assemble Ethernet frame and send it to the router. Inside this frame you put an IP package. A new Ethernet frame is assembled. The IP address will not be change, but MAC address are changed Function of ARP minute 6:52-7:14. Figure 11. shows the ARP request.



ARP uses a simple message format that contains one address resolution request or response. The size of the ARP message depends on the upper layer and lower layer address sizes, which are given by the type of Internet layer protocol in use and the type of Link layer protocols that the upper layer protocol is running on.

The principal structure of ARP message is shown in the following table which illustrates the case of IPv4 networks running on Ethernet. In this scenario, the packet has two 48 bits fields for the sender hardware address (SHA) and target hardware address (THA), and two 32 bits fields for the corresponding sender and target protocol addresses (SPA and TPA). SHA, THA, SPA, and TPA are Source MAC address, Destination MAC address, Source IP address, and destination IP address accordingly. Thus, the ARP message size in this case is 28 bytes.

1.Hardware type (HTYPE): This field specifies the network protocol type. Example: Ethernet is 1. 2.Protocol type (PTYPE): This field specifies the internetwork protocol for which the ARP request is intended. For IPv4, this has the value 0x0800. The permitted PTYPE values share a numbering space with those for EtherType. 3.Hardware length (HLEN): Length (in octets) of a hardware address. Ethernet addresses size is 6. 4.Protocol length (PLEN): Length (in octets) of addresses used in the upper layer protocol. (The upper layer protocol specified in PTYPE.) IPv4 address size is 4. 5.Operation : Specifies the operation that the sender is performing: 1 for request, 2 for reply. 6.Sender hardware address (SHA): Media address of the sender. 7.Sender protocol address (SPA): Internetwork address of the sender. 8.Target hardware address (THA): Media address of the intended receiver. This field is ignored in requests. 9.Target protocol address (TPA): Internetwork address of the intended receiver.

After roughly introduced attributes in ARP, which of them you think are mostly related with the "address" concept in routing algorithm? Actually they are SHA, SPA, THA, and TPA. Especially MAC address in THA which directs next host in every step of route, is also the core role in routing algorithm.

IPv4 and ARP in this section give you more concrete image about the concepts of "IP address" and "routing algorithm". Next section will introduce you kinds of adaptive IP address and IPv6.

Learning Objectives of this Section

 * 1) Understand basic concept of CIDR and how to calculate the prefix size of CIDR and its Last IP address, Mask, and Number of Addresses.
 * 2) Understand IP address used in private network.
 * 3) Understand basic concept of IPv6.

Subsection 5.1: CIDR
You might think that classful network is some how not so fit with real world. For example, a global business or organization may need more than 100,000 host addresses, this number excesses the number of host address in a class B network. Although a class A network can fit the demand, but there are only 128 class A networks, very limited!

It is still true that classful network defines different class of networks for application, but it is still not so flexible. CIDR in this subsection will show you a more flexble way.

In 1992, the Internet Engineering Task Force(IETF) noticed that the number of hosts was rapidly increasing on the Internet, and the Classful network addressing would not satisfy the trend because of its inflexibility.

In 1993, IETF announced a new set of standards, that is, Classless Inter-Domain Ruoting(CIDR). This specification uses variable length subnet mask technology(Variable Length Subnet Masks, VLSM), that allows IP address be used more effectively (RFC 1518 and RFC 1519). A new version of the specification was published as RFC 4632 in 2006.

CIDR notation is a compact representation of an IP address and its associated routing prefix. The notation is constructed from the IP address and the prefix size, the latter being equivalent to the number of leading 1 bits in the routing prefix mask. The IP address is expressed according to the standards of IPv4 or IPv6. It is followed by a separator character, the slash ('/') character, and the prefix size expressed as a decimal number.

For example, 192.168.100.0/24 represents the given IPv4 address and its associated routing prefix 192.168.100, or equivalently, its subnet mask is 255.255.255.0. And the IPv4 block 192.168.100.0/22 represents the 1,024 IPv4 addresses from 192.168.100.0 to 192.168.103.255. The "IPv4 CIDR" table shows you the formula of the prefix size of CIDR and its Last IP address, Mask, and Number of Addresses.

CIDR provides 33 ways to define subnet sizes. Besides /31 and /32, there are two reserved addresses in other CIDR network. One of them is the broadcast address which has 1s after prefix till the least significant bit, and the other is the network address which has 0s after prefix till the least significant bit. Actually, the broadcast address is the largest address and the network address is the smallest address. Between the network address and the broadcast address are addresses asigned to hosts.

In next subsection is the application that using CIDR to identify networks which would not like to connect to public networks.

Subsection 5.2: Allocating IP address in private networks
For networks which are not connected to Internet, IETF defined the Internet address for them with RFC 1918 for IPv4 and RFC 4193 for IPv6. The IP addresses of these standards are not registered like public IP address and are so called private IP addresses. Private IP addresses are not assigned in the Internet.

Private network which uses these private IP addresses can not be directly connected to the Internet. A private network needs a router which is connected to public network for public IP forwarding using Network Address Translation (NAT). Every LAN in every organization can be set to a private network and that really saves the IP address resource. Private IP can not be directly accessed from the Internet, and therefore, comparing to the public IP address, private IP address is more secure, and often used in homes, schools and businesses in the local area. Following is the addressing rule for IPv4 private network address:



Because Private network can be isolated from Internet, it is possible to use NAT(Network Address Translation) to extent IP address number in a Private network and this is helpful against IP exhausting.

The concepts of IP address be introduced untill now are all based on IPv4. And actually IPv4 address was exhausted in February, 2011. IETF developed Internet Protocol Version 6(IPv6) to deal with this problem. Last subsection gives you a basic introduction of IPv6.

Subsection 5.3: A simple introduction of IPv6
To solve the problem of IPv4 address exhausting, a sixth edition of Internet protocol(IPv6) was announced by IETF in 1996. IPv6 address which has 128 bits(4 times of IPv4 address) solves IPv4 address exhausting problem by expending the length of IP address. Although adoption of IPv6 has been slow, as of June 2008, all United States government systems have demonstrated basic infrastructure support for IPv6.

IPv6 has the following features:

1.Larger address space Address space is four times of IPv4 address space. 2.Integrated authentication and security mechanisms Authentication and encryption can be done by the "Authentication Header" and "Encrypted Security Payload Header" in Next Header attribute. 3.Better routing efficiency and optimization IPv6 supports the function of "anycast", which can chose a host address with shortest path or least cost actively during routing. 4.Service quality assurance The Traffic Class attribute and Flow Label attribute(which is compatible with Multiple Protocol Label Switch technology) can deal with various kinds of informations delivered over the Internet today. 5.Automatic configuration and mobility functions IPv6 supports the mechanisms of "Neighbor Discovery" and "Auto-configuration" to get IP address automatically in a mobile environment. 6.Stateful auto-configuration This is achieved by Dynamic Host Configuration Protocol(DHCP) in IPv4 and is supported by "Auto-configuration" mechanism in IPv6. 7.Stateless auto-configuration Also supported by "Auto-configuration" mechanism in IPv6.

An IPv6 packet has two parts: a header and payload.



The header consists of a fixed portion with minimal functionality required for all packets and may be followed by optional extensions to implement special features.

The fixed header occupies the first 40 octets (320 bits) of the IPv6 packet. It contains the source and destination addresses, traffic classification options, a hop counter, and the type of the optional extension or payload which follows the header. This Next Header field tells the receiver how to interpret the data which follows the header. If the packet contains options, this field contains the option type of the next option. The "Next Header" field of the last option, points to the upper-layer protocol that is carried in the packet's payload.

The 128 bits of an IPv6 address are represented in 8 groups of 16 bits each. Each group is written as 4 hexadecimal digits and the groups are separated by colons. The address 2001:0db8:0000:0000:0000:ff00:0042:8329 is an example of this representation.

For convenience, an IPv6 address may be abbreviated to shorter notations by application of the following rules:

1.One or more leading zeroes from any groups of hexadecimal digits are removed.

2.Consecutive sections of zeroes are replaced with a double colon.

3.The double colon may only be used once in an address, as multiple use would cause the address indeterminate.

4.A double colon must not be used to denote an omitted single section of zeroes.

5.The loopback address, 0000:0000:0000:0000:0000:0000:0000:0001, may be abbreviated to ::1.

An example of application of these rules:

Initial address: 2001:0db8:0000:0000:0000:ff00:0042:8329 After removing all leading zeroes: 2001:db8:0:0:0:ff00:42:8329 After omitting consecutive sections of zeroes: 2001:db8::ff00:42:8329

All above content gives you already basic concept of Internet layer, next section is a general conclution.

Section 6: Conclusion
This chapter introduces you the concept of Internet layer by IPv4, ARP, and a brief introduction of IPv6. Internet layer protocols serve you to find and to interconnect computers which are located on another network. What you should get first in this chapter is a basic concept of the roles MAC address and IP address played in routing. The second thing you should know is that there are different kinds of IP address for real world application, and IPv6 is included in these kinds also.

Now you know basically that how your computer finds another computer through Internet. But if you want to transfer data to that computer reliably, depending on only Internet layer protocols is not enough. It is a similar situation in the end of last chapter: There are limitations in Link layer protocols, and here are also in Internet layer protocols. For example, packages of a file from the sender will not arrive to the receiver in the original order after routing. How the receiver reassembles these packages correctly? How can the receiver makes sure that all packages have been received? And how to avoid overloading when the network of the sender is faster than the network of the receiver?

In the four layers model, we provide solutions on Transport layer. The subject of next chapter is Transport layer.

Quizzes
{When you send an international post letter, the role of "receiver address" on that letter is like what address in computer communication through Internet? - Source MAC address - Distination MAC address - Source IP address + Distination IP address
 * type="[]"}

{When you give a note to a classmate in classroom, the role of "name" of that classmate is like what address in computer communication through Internet? - Source MAC address + Distination MAC address - Source IP address + Distination IP address
 * type="[]"}
 * In this situation, Distination IP address has the same function with the "name" of the classmate.

{See https://en.wikiversity.org/wiki/Topic:Web_Science/Part1:_Foundations_of_the_web/Internet_Architecture/Internet_Protocol/Classfull_IPv4_networks minute 2:44-2:52, so address 17.40.0.0 is a network address. - True + False
 * type="[]"}

{See https://en.wikiversity.org/wiki/Topic:Web_Science/Part1:_Foundations_of_the_web/Internet_Architecture/Internet_Protocol/IP_forwarding_algorithm minute 11:37-11:44, maybe you are interested in routing algorithm, which of following are routing algorithms? + IGP + EGP - BOOTP + Shortest Path
 * type="[]"}

{The concept of "interconnect networks" is started from? - Business section + Military section - Civil section - Education section
 * type="[]"}

{When a host in a private network communicates another host on Internet through a router which connects the private network and Internet, this host always makes an ARP request. - True + False
 * type="[]"}
 * Only host in an IPv4 private network makes an ARP request, not in an IPv6 private network.

{All IPv4 address is less than or equal to 255.255.255.255. - True + False
 * type="[]"}
 * IPv4 address can be more than 255.255.255.255 by NAT.

{The attribute "Header Checksum" makes IPv6 address correct. - True + False
 * type="[]"}
 * "Header Checksum" is an attribute of IPv4 header.

IPv4
The Internet Protocol is one of the elements that define the Internet. The dominant protocol on the Internet layer in use today is IPv4, and the number 4 is the protocol version. IPv4 is described in RFC 791 (1981).

Like the Ethernet, the IPv4 protocol has header and data parts. But for getting more reliability, IPv4 header architecture is in a 32 bits word, which is different from Ethernet header 32 bits word architecture of IPv4 header minute 0:20-0:32.

Figure 14. is IPv4 header with its attributes in a 32 bits word architecture:



All IPv4 attributes have their meanings and functions:

1.Version Represents the version of Internet protocol. 4 bits length means that there are 16 possible values. The most versions you can see are version 4 and version 6. 2.IHL (Internet Header Length) IPv4 allows its header to have flexible size but it cannot be more than 15 words, that is, maximum length with 60 bytes. An IPv4 header length will be 5 words without option. 3.DSCP (differentiated services code point) Formally known as Type of Service. But it was not used too frequently so internet service providers come up with idea of putting priority of IP packages in this field. 4.ECN (explicit congestion notification) It is rarely used. But what it really does is if the part of the wire has too much traffic on it at the moment of time this can be put there in this field so then routers might be able to search for other routes to the destination network. 5.Total length This 16 bit field represents the binary length of the package in bytes. That means up to 65535 bytes are allowed, so a package with too long length will not be fit into Ethernet frame. So when you want to put IP packages inside the Ethernet frames and the IP packages are bigger than the Ethernet frames you might have problems. When you do routing you will not know what kind of link layer protocols you will use. So at the beginning you use DSL or ISDN and your package might fit link layer protocol. But at some network you might use Ethernet protocol with really small frame size so package will not be fit anymore. IPv4 can solve this problem with fragmentation. 6.Identification Is used for uniquely identifying fragments of original IPv4 datagram. 7.Flags DF:Only be set 0 in fragmentation. MF:Only in last fragment be set 0 in fragmentation. 8.Fragment Offset When you decide that package can be fragmented happens that packages that are being fragmented become an offset. When you have several fragmented offsets what you can do is to reassemble those packages. 9.Time to live This number usually is assigned 64. Every time a router forwards the package to the next router then this number is decreased by 1. Why do we need it? If a router is misconfigured, IP packages might be always forwarded inside a circle but never arrive at the final destination. This would mean that they blow up the network really fast. 10.Protocol Used to identify the upper level protocol. 11.Header checksum In the Ethernet you have a checksum for the entire package but here only the header is checked to avoid wrong route. 12.Source IP Address The IP address of sender in last section, and it's formal name in IPv4 is Source IP Address. It should not be changed during routing. 13.Destination IP Address The IP address of receiver in last section, and it's formal name in IPv4 is Destination IP Address. It should not be changed during routing. 14.Options (if IHL > 5) The options field is not often used. If the header length(IHL) is greater than 5, then the options field will present and must be considered.

You can also see IPv4 header.