According to the OSI model, the transport layer divides the data into segments and then attaches the source IP and destination IP along with the port numbers. Also it is said that the network layer does the logical addressing which means the mapping of a address to a unique device on the network. Since IP's are associated already in the transport layer what is the network layer doing with the so called logical addressing. I am confused and would appreciate any kind of help.

  • OSI layer-2 (data-link) may have addressing (MAC address, DLCI, VPI/VCI, etc.). OSI layer-3 (network) has addressing (IPv4, IPv6, IPX, AppleTalk, etc. addresses). OSI layer-4 (transport) may have addressing (TCP and UDP have addresses called ports). Even the (off-topic) application layer may have some type of addressing. The addressing of each layer is independent of the other layers.
    – Ron Maupin
    Jun 9, 2018 at 19:57

3 Answers 3


Source and destination addresses are found in the IP packet, belonging to the network layer. A transport layer datagram or segment that uses port numbers (=host subaddresses) is wrapped into an IP packet and transported by it.

The network layer uses the IP packet information to transport the packet across the network (routing). Arriving at the destination host, the host's IP stack uses the transport layer information (port number) to pass the information to the application.

IP addresses (and port numbers of course) are referred to as logical addresses because they are assigned to a host by the network (or its administrator) and are used to structure a network. This is in contrast to physical addresses like Ethernet MAC addresses that are assigned by the manufacturer.

  • so basically the segement has port numbers which are wrapped in an IP packet by the transport layer. On reaching the network layer this packet is feeded with the ip address of source and destination. Is this what you are saying?? Jun 9, 2018 at 18:02
  • A socket connection runs from a source IP address/port to a destination IP address/port combination. The header in a transmitted segment indicates source and destination IPs/ports, so the stack knows which socket it belongs to.
    – Zac67
    Jun 9, 2018 at 19:30
  • it still doesnt answer. Lets try again - let say some port no is assigned at transport layer of source let say 11234 and destination port is 80. In transport layer we assigned these to the segement. Now ip address of the form for the source and destination, is it introduced at the transport layer or network layer?? Jun 9, 2018 at 21:11
  • A segment is part of the data stream of a socket. You don't assign port numbers to segments over and over again. The transport layer only uses protocol-specific port numbers (or not). The IP addresses are located in the IP packet.
    – Zac67
    Jun 9, 2018 at 21:15
  • So it is like IP attaches an IP header to the segment or packet’s header in addition to the information added by TCP or UDP. Jun 9, 2018 at 22:22

I'm afraid you're mistaken on some points. But first, remember two things:

  1. The OSI model is theoretical model. Nothing actually follows it.
  2. TCP/IP addressing, used almost everywhere today, uses the TCP/IP model.

Internet Protocol (IP) addressing is a function of the network layer (Internetwork layer in the TCP/IP model). The transport layer is where you find port numbers. The data link addresses (MAC addresses) are used only on the local network.


The transport-layer protocol provides for logical communication between application processes, a network layer protocol provides for logical communication between hosts. Transport layer protocols are implemented in end systems and not in network routers.

Each application process has an associated socket identified by a unique port number. When a process needs to send data the transport layer encapsulates the application data and necessary headers(such as source and destination port number) into segment and forwards it to the network layer. The network layer encapsulates the segment into a IP datagram(with headers such as source and destination IP address) and makes its best effort to transfer the datagram to the correct host.

At the end systems the Transport layer protocols use the IP address for transport layer multiplexing or demultiplexing. When a segment arrives at the host the transport layer depending on the type of protocol used(TCP or UDP) extracts the data and guides it to the correct socket(Demultiplexing).

Two UDP packets with the same destination IP address and port numbers but different source IP address and/or port number will be directed to the same destination socket. OTOH two TCP segments with different source IP address or port numbers will be directed to two different sockets.

Hence, we can conclude that at transport layer, IP addresses are used for multiplexing or demultiplexing the packets at the end systems whereas at the network layer IP addresses route the packet to the correct receiving host.

Transport Layer Multiplexing and Demultiplexing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.