IP encapsulates the segment which received from the transport layer by adding an IP header. The header is used to carry the packet to the appropriate host. The IP header remains in packet until it arrives at the destination host.
Figure 1 illustrates how the transport layer PDU and how encapsulated by the network layer PDU to create an IP packet.
The process of encapsulating data, layer by layer enables the services at the different layers to grow and scale without disturbing the other layers. This means the transport layer segments easily packaged by IPv4 or IPv6.
Routers can apply these different network layer protocols to operate at the same time as over a network. The routing depends on only the contents of the network layer packet header. In all cases, the data portion of the packet; that is, the encapsulated transport layer PDU remains unchanged during the network layer processes.