Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that data packets sent over the internet carry the source and destination IP address, so that the protocol can route the data to the correct destination and keep track of the source address of the packet.

But what about the network card address? As far as I know, each network card has a unique identification number. Is this also transmitted with a TCP/IP packet? And when a packet is received at its destination, how is the IP address mapped to a network card number?

In other words.

On the sender part: does the sender store the sender network card number in the IP packets that it is sending?

On the receiver part: which component maps the IP address to the receiver's network card number when a packet is received? E.g., in a home network, does the modem / router map the destination IP address of an incoming packet to a network card number and deliver the packet directly to that network card?

A link to documentation on these topics would be of great help.

share|improve this question
up vote 4 down vote accepted

Each layer of the ISO stack are separately implemented (at least in theory), such that no layer requires knowledge of the layers above or below.

The NIC address is called the MAC and is at layer 2, whereas an IP address is at layer 3. Layer 2 addresses are only meaningful on the local network - the broadcast domain. As such, they are not transmitted beyond the local network.

As you have probably gathered, an IP packet is routed across the internet based on an IP address. When the packet arrives on a router that doesn't have the destination IP network attached to one of its interfaces, the routing table is inspected, and the packet is forwarded in the direction of a router "in the right direction".

Ultimately the packet will arrive at your router, and the destination IP network will be one that is attached to an interface.

At this point, routing is finished, we are at the right network - so layer 3 is complete, and now the packet needs to be transmitted at layer 2 on the local network.

So the router needs to find out the MAC address of the nic which has the corresponding IP address that the packet is destined for. To do this, it issues an arp request, saying "who has IP address x.x.x.x". This is broadcast across the local network, and whomever has the IP address will answer "it is me". As the reply packet comes from the MAC address of the NIC in question, the router can then forward the packet to the correct MAC address.

share|improve this answer
Thanks a lot for a very concise and clear answer. +1 – Giorgio Nov 25 '12 at 12:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .