19

I am preparing for ICND1 exams and recently started to learn about different Cisco devices. I have just come to know how the packet is generated to be transmitted over a network, or outside the network.

For example, When the packet is generated, it adds source IP address, Destination IP address, Source Mac address, destination mac address, and other data.

Since Switch is a layer 2 device, and it uses MAC addresses to interact with other Hosts within the Network, then why do we use IP addresses within our local networks ?

What if someone do not need to connect to any host or network outside its own network, Why do he still needs to have an IP address, isn't MAC address is enough ?

3

6 Answers 6

23

Since Switch is a layer 2 device, and it uses MAC addresses to interact with other Hosts within the Network, then why do we use IP addresses within our local networks?

Well let's start with what traffic you're sending.

If you use a strictly layer-2 protocol inside your own LAN with no HTTP, SSL, NFS, CIFS, iSCSI, H.323, SIP, DNS, ICMP, databases, or websockets, then your proposal works just fine. In fact, FCoE does not rely on an IP layer... so if that's what you want, knock yourself out :-)

The problem is that you just crippled 95% of the utility of most networks by removing those IP-based services. Networks exist to share information; all operating systems on the planet share information by binding services to, and encapsulating inside IP. That information is usually wrapped inside TCP as well.

  • Rhetorical question: Could a bunch of determined people implement TCP and UDP services directly on top of ethernet in all the major operating systems?
  • Pedantic Answer: Yes, but that's a collosal waste of time and resources for insignificant gain. Let's start with the basics... there is no DNS name-service for ethernet mac-addresses. That means unless you build it, how would you resolve URLs without IP addresses? I doubt that anyone really wants to type http://00c0.9b4a.fb2c/ just so they can avoid 20 extra bytes in each packet. This is just an example of the work required.

What if someone do not need to connect to any host or network outside its own network, Why do he still needs to have an IP address, isn't MAC address is enough?

Technically, yes. In the real world... it's a pretty boring network without IP.

10

(not this again)

Layer 2 vs. Layer 3

IP works at layer 3. It is carried over ethernet (layer 2) which uses MACs to identify nodes. Use a different layer 2 (say, ATM) and you won’t have MACs. (Or use a different layer 3, say IPX, and you won’t have IP.)

2
  • 3
    Feels like a circular answer. "Why use IP if we already have MAC? Because you need IP to use IP." Granted, the initial question is begging the question "What does Layer 3 do for us that layer 2 can't?" or something.
    – Smithers
    Dec 2, 2014 at 19:41
  • 1
    No, it's like asking "why drive a car when I have TV" They're completely different things. Ethernet (L2) uses MACs. IP (L3) uses IP Addresses. IP can be carried over Ethernet, but that's just one of a long list of L2's one could use.
    – Ricky
    Dec 2, 2014 at 21:07
3

MAC identifies which device. IP identifies where that device is located.

I know your name, but not where you live, so I can't send you that 100 dollar bill I promised to send to you using the postal service.

You are correct about that within only 1 LAN you know exactly where each device is. So technically, only a Mac addres table would be enough to get your data wrapped in a frame across the LAN.

But there is a catch. All networking devices and PCs are build using the TCP/IP networking model. 1 model to rule them all. That model requires you to wrap an IP address inside a frame. So without an IP address you can't send frames. Without frames you cant use the MAC addresses to get your data across.

Technically we could build a second networking model, solely for within LANs that ommit the IP address requirement. But that takes ages. Then you need to convince the IT industry to make hardware and software that takes your model as their own. Its just too much hassle.

Your question is like asking why do we need cars to travel over the highway? Why not walk, its close by. Well its against the rules to walk on the highway. And you end up in jail.

Technically you could push for a change of law. But you need to write that law. Taking into consideration every other law that is connected to it. Also the entire highway grid is designed with the idea in mind that no pedestrian makes use of it. You got to convince the public, get elected, get enought votes, get your bill pass congress and the senate. Its just too much of a hassle.

0

Without IP, you would have broadcast traffic all around the world for each unknown/aged out MAC address in the system (unknown unicast).

Also IP helps you to logically plan your network in an efficient way (for example: using summarization of IP addresses) so that routers can utilize less memory for routing tables and forwarding information.

0

The internet has a large number of nodes. The vast majority of the traffic between those nodes is not of interest, and would needlessly slow down your computer if you tried to look at it all. So Ethernet cards come with a hardware function called MAC address filtering which gets rid of traffic which it knows you will not be interested in. (You can override this filter with the so-called promiscuous mode).

The only packets you will see will be:

  1. Packets sent explicitly to your MAC address
  2. Broadcast packets
  3. Multicast MAC address ranges

But these MAC addresses are not globally unique and typically are not seen beyond the nearest router. It is the job of the DHCP server to allocate an IP address to each MAC address, and when it sees an incoming TCP/UDP packet, to route it to the correct MAC address. Each host and router will have an ARP table that maps one to the other. You can print out these tables with the arp command.

Originally these IP address were globally unique, to ensure any computer could talk globally to any other computer. When these addresses ran out, one (minimum) addresses were allocated per organization, and external packets appeared to come from just one IP address. This forces connections in this case to be initiated from inside the organisation.

-3

simply assume that we have 2 connected devices and each one has a network card. now, if there was only one service( not exactly service, anything like an osm software,...) in each device, you are right, no need to IP, but consider there are many services in each device and these services should communicate with each other without any conflict. so in addition to mac address to identify the device, we need something else( we call it IP) for each service.

1
  • 1
    To differentiate different services on one device, TCP or UDP ports are used.
    – Gerben
    May 2, 2017 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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