Network layer is the third layer (from bottom) in the OSI Model.

Responsibilities of Network Layer:

Packet forwarding/Routing of packets: Relaying of data packets from one network segment
                                      to another by nodes in a computer network

Connectionless communication(IP):     A data transmission method used in packet switched 
                                      networks in which each data unit is separately 
                                      addressed and routed based on information carried 
                                      by it

Fragmentation of data packets:        Splitting of data packets that are too large to be
                                      transmitted on the network

There are two types of network transmission techniques, circuit switched network and packet switched network.

[ad type=”banner”]

Circuit Switch vs Packet Switch
In circuit switched network, a single path is designated for transmission of all the data packets. Whereas, in case of a packet switched network, each packet may be sent through a different path to reach the destination.

In a circuit switched network, the data packets are received in order whereas in a packet switched network, the data packets may be received out of order.

IPv4:
IPv4 is a connectionless protocol used for packet switched networks. It operates on best effort delivery model, in which neither delivery is guaranteed, nor proper sequencing or avoidance of duplicate delivery is assured.
IPv4 uses 32-bit (4 byte) addressing, which gives 232 addresses. IPv4 addresses are written in the dot decimal notation, which comprises of four octets of the address expressed individually in decimal and separated by periods, for instance, 192.168.1.5.

[ad type=”banner”]

IPv4 Datagram Header
Size of the header is 20 to 60 bytes.

VER:   Version of the IP protocol (4 bits), which is 4 for IPv4

HLEN:  IP header length (4 bits), which is the number of 32 bit 
       words in the header. Minimum value for this field is 5
       and the maximum is 15

Type of service: Low Delay, High Throughput, Reliability (8 bits)

Total Length:    Length of header + Data (16 bits), which has a 
                 minimum value 20 bytes and maximum is 65,535 bytes

Identification:  Unique Packet Id for identifying the group of 
                 fragments of a single IP datagram (16 bits)

Flags:           3 flags of 1 bit each : reserved bit (must be zero),
                 do not fragment flag, more fragments flag (same order)

Fragment Offset: Specified in terms of number of 8 bytes, which has 
                 the maximum value of 65,528 bytes

Time to live:  Datagram’s lifetime (8 bits), It prevents the datagram 
               to loop in the network

Protocol:     Name of the protocol to which the data is to be passed 
              (8 bits)

Header Checksum:  16 bits header checksum for checking errors in the 
                  datagram header

Source IP address: 32 bits IP address of the sender

Destination IP address: 32 bits IP address of the receiver

Option: Optional information such as source route
[ad type=”banner”]