11

On networks that use the TCP/IP protocol, why is the IP address translated into a MAC address?

I mean, when every device knows its IP, why further use the MAC address and not use the IP number as the address directly?

12 Answers 12

19

The main difference is that the IP address is used by IP which is a network protocol, and the MAC address is used by Ethernet a link layer ( 2 ) protocol. IP can run over different layer 2 protocols, so it doesn't include the "media access" functionality. You can run IP over Serial lines, Ethernet, DSl, ISDN, etc.

For example, DHCP provides dynamic IP addresses over Ethernet; the DHCP server needs the MAC address so it can assign an IP address to a PC.

2
  • 2
    +1 This is really the key issue. IP can run over different physical layers. Different physical layers require different physical addressing. MAC is the addressing used by Ethernet. And there are other Ethernet-based protocols that do not use IP including BootP, DUX, and IPX. The same physical Ethernet may also handle IPv4 and IPv6 simultaneously. But in the end, everything is delivered to a MAC on Ethernet.
    – Rob Napier
    May 24, 2010 at 16:35
  • Also important to understand that different times you will see different pieces. Your computer might get a packet from someone that it need to respond to and not know their MAC yet (the mac it see would be from the closest connecting device but that's not important) and need to arp or the reverse and Rarp. Or have the hostname but need the mac or ..... any number of different configs and protocol combos
    – PsychoData
    Jan 29, 2014 at 20:56
5

Because TCP/IP is used over Ethernet, which uses MAC addresses.

4

They are for different layers in the network stack. The MAC address is about the ethernet networking layer and the IP address is about, well the IP layer. You can use IP over different transports like SLIP where there is not MAC because there is not ethernet. You can also use protocol different than IP over ethernet if you wanted to.

If you think about it, if I dial in over a SLIP connection one IP packet could start with not MAC associated and then have a different MAC as it hops from one router to another as it is forwarded across the internet to the final IP destination.

4

I could answer your question with another question: You have a phone number, so why do you need a social security number/national identification number?

In other words, they serve different purposes. One is for identifying who you are (SSN, MAC), whereas the other is for defining how to reach you (phone number, IP address).

Further, it's possible to reach someone on the phone if they don't have a SSN (different country, for example) just like it's possible to reach someone on the Internet if they don't have a MAC (different type of link layer). Different link layers have different methods of identifying the destinations and sources of data packets.

4

Another way to look at this is to ask the reverse question: Why do we need IP addresses when we already have MAC addresses assigned to the hardware?

This was discussed in episode #29 of the Security Now podcast (HTML transcript).

With MAC addresses, our computers can directly communicate to a single machine. But, in order to know how to get there, we need to have our packets routed to it. It's impractical to have a global MAC address lookup table on each of our computers.

IP addresses, on the other hand, are hierarchically organized. Our computers can determine which IP addresses are on the LAN and the rest get sent to the LAN's gateway (e.g. a home router). After leaving the LAN, successive routers look at the IP address and route the packets on to another router. Eventually, a router which has the destination IP address on its LAN can identify the MAC address and send the packet to the destination computer.

3
  • Why couldn't MAC addresses have been smart like the IP and have been implemented in such a way that it is hierarchically organized? Were they simply careless or is there a restriction which makes it impossible?
    – Pacerier
    Dec 31, 2011 at 19:37
  • 2
    MAC addresses are assigned by the hardware manufacturers and they have no idea where the network devices will be deployed nor in what configuration. There are lots of sites (such as this one) which allow you to identify the manufacturer of network cards by MAC address. Jan 1, 2012 at 0:02
  • Good argument (and explanation thx !)
    – Pacerier
    Jan 1, 2012 at 13:40
3

MAC addresses are guaranteed to be unique to the machine (the network card typically contains the MAC address) and unchanging, whereas you can redefine the IP address on any given machine.

Additionally, public IP addresses can be shared by a whole company using Network Address Translation, so public IP addresses are not guaranteed to have a one-to-one correspondence with a machine or person.

1

The IP is either defined in the OS or in the driver software for your network card, or given to you by your network, and can be changed dynamically. The MAC is an identifier for your network card, i.e. the hardware. There is not a 1-to-1 relationship between them.

1

Your question is a very legitimate one! The truth is that theoretically an IP only system can be created and function well without the need for MAC addressing system. The Data Link layer can be made to ignore any MAC filtering, leaving this functionality to the Network layer, to filter out according to its own IP address. Such systems existed in the past, such as networks based on linking devices through their UART (e.g. RS232) ports. Obviously, these networking interfaces did not carry MAC addresses or any other form of a unique, physical identity. However, it can make centrally assigning IP addresses, e.g. by a DHCP server, a nightmare, because there would be no way to make sure a device will not get more then the predetermined number of IP addresses allowed to each device. Also, it would be difficult to unambiguously and individually identify each device. The MAC address being unique, at least within a sub-network, serves as a unique identification token. Of course, individually assigning IP addresses to devices may solve the problem, but where large number of devices are present on a network, it becomes impractical to establish and maintain such a scheme.

0

You don't know the MAC address of stackoverflow.com because it's not in your local network. MAC addresses are used as an identifier to the next hop in the chain. The "IP" is just used in a protocol that has a hint of in what direction it should send your packet (which gateway to use next).

0

Because MAC addresses are needed for communication on the Link Layer (IP addresses are used one layer up on the IP layer).

0

Lets take a example

If you apply for job in company.. will they give you that without knowing your identity? certainly not.... so your actual identity proof is Mac address

and when you join the company they will give another employee ID to communicate among that company employees.. this is IP address.

your employee ID can be modified if you change company but your actual info about you can never be changed (age,name,etc)....

1
  • Soooo I can change my actual Identity? :P But this is not really an answer, just a metaphor thats kind of weird and wrong
    – PsychoData
    Jan 29, 2014 at 20:51
-3

IP address are like ZIP codes or like country codes or an ISD codes, wchich simplifies the location address otherwise its is very difficult to sort all the MAC address or to identify the exact location else the computer will take hell of time identifying the address or keeping huge database of MAC address on local computer.

You must log in to answer this question.

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