1

Network layer is responsible for defining the route a message takes from the sending host to the destination host. In particular, network layer decides what will be the target of the next hop on the way to the destination.

Data link layer is only concerned with transferring data between two nodes in the network. As I understand, data link layer must somehow get information from network layer - to which next node to forward the data.

My question is - how does data link layer get this information from network layer?

IP-header contains IPs of the source and the destination hosts. But what I am looking for is some field "IP of the next direct neighbour to forward data to"

Tata
  • 11
  • 2

3 Answers3

1

Machines receive packets if the link layer address matches their hardware address. Usually the mac address is used at the link layer. The adapters will receive packets if the link layer is addressed to them. On receiving such a packet the network layer header of the packet is read by the system(O.S) to get the destination ip. From the destination ip, if the machine is an intelligent router, it will try to calculate the easiest path to the target(or sends to some default router), once this is found the link layer header is changed and will be set to match the hardware address of the next node in the path. However, the network layer header will not be changed.

"IP of the next direct neighbour to forward data to"

That is exactly what the link layer does, instead of ip it uses the mac address. And it is set by the operating system after reading the network layer.

Sunny
  • 517
  • 5
  • 17
0

You are looking for the Address Resolution Protocol (ARP).

  1. First, your computer determines the IP of the next computer on the path (for example your local gateway (e.g. your DSL-Router)).
  2. Your computer uses the ARP to identify the mac address corresponding to the IP.
  3. The IP packet is sent to this mac address.
edisON
  • 86
  • 8
0

The Transport Layer sends segments of data to the network layer and the network layer creates a path to a destination based on the IP addresses and divides data into packets now data link layer makes frames based on these packets and the data is transferred now physically transferred from one destination to other based on MAC address