Doubt in networklayer

Guys

just one doubt

How network layer adds destination IP address to its header , the transport protocol header does NOT contain anything about the IP address (or host name). So, from where does the layer 3 brings the destination IP address?

Which layers are you talking about? Layer 3 definitely contains the IPs. They're not computed from other layers, they're given to it by the computer on transmission.

If the underlying link is Ethernet, and the traffic is restricted to the local subnet, layer 2 can communicate without layer 3's help, because it gets help from ARP instead to convert IP addresses into ethernet addresses (i.e. MAC address).

Exactly , how IP layer getting the destination Ip address ..?

It's given to it by the computer before it's even sent. If the computer doesn't know the IP's, it can't send it.

can u be more specific , my understanding in TCP/IP layer is

1: Data---> Transport layer [App layer to transport layer]
2:TCPheader+ data --> Network layer [transport to network layer]

In third stage , IP header is attaching to data , and the IP address of destinaion is putting in to IP header

but my doubt in from where the network layer, is getting the destination address...?

OK, a program is running and it was to open a TCP connect to, say, port 75 on the computer with an IP address of 1.2.3.4. So the program invokes a socket() system call to obtain a TCP socket. Then the program issues a connect() system call. Lots of important data is included in the call to connect() including the IP address and the port.

Because of the connect() system call the TCP code knows that it wants to connect to 1.2.3.4. So the TCP layer calls the IP layer to actually make the connection. How does the IP layer know that the desired destination address is 1.2.3.4? Because the TCP layer provides the IP layer this information. Now why is that mysterious?

1 Like

great , now i am getting to it ..

but my understanding was , from transport to network layer , the only data that passing is TCPheader+data , and in this IP address is not available though.

The layers are inside each other, like a Matryoshka. The data link layer doesn't understand the Transport Layer data, but it's there nonetheless.

You might consider a packet to be a wad of data which looks like this:

It usually gets passed around whole. OSI might speak of peeling layers but that's a metaphor; if it's a signal going over a wire, it's going to be transmitted whole.