3

Framing is done in Data-Link layer. We give physical addresses there. Destination address, source address and MAC.

If two PCs in different networks, we try to sent data from one another, we specify the IP address of the destination PC in the Network layer for each packet. What do we do in Data-Link layer? What about the physical address? Whose addresses are they? How come the sender PC for another network knows the MAC address of receiver PC?

3

The MAC addresses are the physical addresses for protocols that use MAC addresses, e.g. ethernet. The source and destination MAC addresses are used in the Data-Link frame header for protocols that use MAC addresses.

IP (both IPv4 and IPv6) addresses are Network Layer addresses that are used in the Network Layer packet header.

When a layer-3 packet is being sent, it must be encapsulated by a layer-2 frame. If the layer-2 protocol uses MAC addresses, it uses something like ARP (Address Resolution Protocol) to resolve the layer-3 address to a layer-2 address.

If the destination host is on the same network as the source host, then the source host will use ARP to get the destination layer-2 address. If the destination host is on a different network, the source host will use ARP to get the layer-2 address of its configured gateway. The layer-2 frame will be addressed with the destination layer-2 address of either the destination host (same network) or the source host's configured gateway (different network).

ARP basically sends a LAN broadcast asking every host on the LAN, "Who has the layer-2 address for this layer-3 address?" The host with the layer-3 address will reply with its layer-2 address. The host asking this will then save the layer-3 to layer-2 resolution in an ARP cache so that it doesn't need to ask the next time. Entries in the ARP cache will eventually time out and be purged. They can also change based on traffic the host sees.

How come the sender PC for another network knows the MAC address of receiver PC?

A layer-2 (MAC) address is only relevant, or even seen, in the local LAN, so a PC on another network does not know, or even care, what the MAC address of a host on another network is. A host sending to a host in a different LAN uses the MAC address of its configured gateway. The gateway strips the layer-2 frame off the layer-3 packet to forward the layer-3 packet toward its destination network, and the router will build a new layer-2 frame for the next interface.

0

The two addressing systems are independent of one another.

Internet Protocol, including it's addressing, is implemented as a software stack that must be installed on the endpoint in order for it to work.

Ethernet functionality, and it's addressing, is implemented via firmware/drivers which must be installed for it to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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