This might sound dumb but how do each layer get the information? To give a context,

  1. Lets say I enter www.google.com, the browser sends a request to the Application layer and then the HTTPs request is formed which is our data.
  2. It is then passed onto the transport layer(Im skipping Session and presentation). Here, TCP is used and it adds the source port and destination port. How does the Transport layer get the information about the ports? Does the Application layer send that to the transport layer? When I say transport layer, I am referring to the OS which does the job.
  3. Because if it does, I haven't seen the HTTP GET request add that info.
  4. Similarly, how does the Network Layer get the source and destination IP? Is all the information there in the application layer data? Or is there a header that I am not aware of that the Application layer sends to the Transport layer which has Source port, Destination port, Source IP and Destination IP?
  5. Then finally, how does DataLink Layer get to know about the Source and Destination MAC?
  6. Each layer ought to be getting the info from somewhere to attach the header correct? How does it get the info?

I know it might sound very basic, but I dont have proper answers to these questions.

  • Basically, destination IP and port need to be supplied by the application. Any MAC addresses used in the path need to be discovered by the network layer.
    – Zac67
    Apr 9 at 17:47


Browse other questions tagged or ask your own question.