This question already has an answer here:
We have opened a web browser and searched for www.example.com. Now, As far as I know, the Application layer appends a header of HTTPS GET request to example.com, resolves IP address using DNS. That means, the IP address is known at this layer itself, but why is the IP address appended at the Network layer and not at the Application layer?. And how does it resolve the IP address of google.com? Does it follow the same 7-layer model to resolve IP addresses or it is a separate task and follows different scenario.
Okay... now the application layer passed the PDU to the presentation layer. Here it translates, encrypts and compresses the PDU. Does it always perform these three function at physical layer.?
Well, now the PDU gets passed to the session layer. I read somewhere that it create session between sender and receiver, maintains session, authenticates, authorizes and synchronizes. what do you mean by creating a session, how come it creates a session between sender and receiver without even getting to the next layers.
Ok, somehow the PDU got to the Transport layer. Here it divides the PDU into transmittable segments. And appends each segment with a sequence number, ACK number, port number etc. But, how does it know the port number of server (ie 443 for HTTPS request?) and what about client port numbers. And the main question here is how it handles TCP 3-way handshaking. Handshaking means it needs to send SYN packet to the destination via a route and must receive ACK through the same path. My query is, how it does 3-way handshaking without even getting to the lower layers
Now it appends IP addresses of sender and receiver to the PDU along with some other control information. Why it adds an IP address here, not at application layer. PDU is called a packet here in network layer.
Now it appends the MAC address of the next device the host is connected to along with some other information. My doubt is, does the data link layer append the MAC address of router to transmit the data to another router?
Now, the Frames become signal and transmitted over a channel (LAN cable) to the switch connected to the computer. It is a physical layer.
What happens next is my analogy. correct me if I'm wrong anywhere.
Now, at the switch, the signal become frames and changes the MAC address to next devices it connects, for example the switch is connected to a router. So, the switch appends MAC address of the router and make those frames as a signal and transmits over a channel connected to the switch.
Now, the router takes the data, removes the MAC addresses, so that it can look the IP addresses and forwards the data to the next node (probably router) by looking into the routing table based on the destination address. That means, does the router append the MAC address of the next router.
And continues till it reaches the server.
At the receiving side router (the last router), does the router append MAC address of the server while transmitting? Ok.. somehow the requested data gets to the server. Does the server itself remove the data link headers, network layer headers?
And finally request has reached to server's application layer by unwrapping the headers layer by layer in the server.
Now, does it follow the same steps to send the requested web page to the client?