0

Whether IP addresses will be visible to layer 2 (data link layer) devices. If not, then how come those layers use ARP protocols to convert IP address to MAC address without knowing IP address.

Thank You.

user207421
  • 305,947
  • 44
  • 307
  • 483
Ahamed Yasir
  • 189
  • 1
  • 13
  • Layer-2 has no clue if it is carrying any particular layer-3 protocol, and the layer-3 protocol has no idea which layer-2 protocol carries it. For example, and ethernet network can have IPv4, IPX, IPv6, AppleTalk, etc. all at the same time, and it doesn't know or care. Layer-2 has no concept of the layer-3 addresses. – Ron Maupin Jan 29 '19 at 17:51
  • Is it possible to know the IP addresses by looking into the frame alone and without using a network layer? – Ahamed Yasir Jan 29 '19 at 17:54
  • 1
    The frame doesn't have IP addresses because the frame can carry any layer-3 protocol as its payload without even knowing what it is. Ethernet has no idea what IP is. – Ron Maupin Jan 29 '19 at 17:56
  • Can you please elaborate your answer? – Ahamed Yasir Jan 29 '19 at 18:01
  • 1
    Just look up what an ethernet frame looks like. There is no field for an IP address. – Ron Maupin Jan 29 '19 at 18:07
  • Frame has data field in which IP datagram is present....why can't it look into it and get the IP address? – Ahamed Yasir Jan 29 '19 at 18:10
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/187511/discussion-between-ahamed-yasir-and-ron-maupin). – Ahamed Yasir Jan 29 '19 at 18:12
  • 1
    You are talking about the payload. Layer-2 doesn't know what is in the payload. What if the payload is IPX? Trying to read it as IPv4 would not work. Ethernet does not even know what IP is. Ethernet and IPv4 were developed around the same time, but by completely different people for completely different purposes, and neither knew the other would become dominant. – Ron Maupin Jan 29 '19 at 18:12
  • I have a doubt...is it possible to determine the type of IP version used by using type field of ethernet frame?.... – Ahamed Yasir Jan 30 '19 at 05:50
  • what does this question have to do with "tcp"? – Effie Oct 12 '21 at 17:36

2 Answers2

0

From thread here

ARP has always been a Layer 2 protocol. The reason: The highest layer addresses carried within ARP are Layer2 MAC addresses for typical ARP operation. The IP addresses in the ARP packets are protocol payload, no addressing information of the ARP packet itself.

ARP is a protocol that does not fit too well into the 7 layer OSI model or the ancient DoD layer model. These models were defined for end user applications like HTTP or FTP and they still define, how traffic is sent from application to application through a network stack (L3+L4) and a network interface (L2 + L1) down on the wire.

ARP is a service protocol that glues together layer 2 and layer 3 protocols. It solves the problem that you need to add a layer 2 (MAC) destination address over a shared media like Ethernet or Wireless LAN using IP packets. But ARP is a separate process with separate packets. You will find no ARP protocol information within an IP packet. This is the reason, why ARP is definitely not a layer 2.5 protocol.

Santhosh Kumar
  • 543
  • 8
  • 22
  • Is it possible to know the IP addresses by looking into the frame alone and without using a network layer? – Ahamed Yasir Jan 29 '19 at 17:53
  • "_ARP has always been a Layer 2 protocol._" No, not at all. ARP is the _payload_ of a layer-2 protocol, making it a layer-3 protocol. The layer-2 protocol has no idea if it is carrying ARP or any other layer-3 protocol. Not all protocols have addresses. – Ron Maupin Jan 29 '19 at 17:54
0

Whether IP addresses will be visible to layer 2 (data link layer) devices.

generally speaking no. Ethernet header has ethertype field, which speficies next header format after the current ethernet header. There are a couple of values that are still at layer 2, like VLAN tags, spanning tree BPDUs, and similar. If Ethertype is anything else, layer 2 device is not supposed to look into it. (And a device that does should not really be called layer 2 device)

On end-hosts, ethertype will determine how packet is processes, after layer 2 processing is done. But this is no longer layer 2 processing.

If not, then how come those layers use ARP protocols to convert IP address to MAC address without knowing IP address.

I think you think of it backwards. ARP protocol is used by IP layer to find MAC address of a device with a given IP address on a local network. It is not used by layer 2 to map IPs.

For example, let's say your home network has two devices, your laptop which has IP 192.168.0.10 and your phone, which has IP 192.168.0.20. The network mask is /24. Now you want to send a packet from your laptop to your phone, for example ping 192.168.0.20.

First, an ICMP packet is created. Next, layer 3 determines where to send the packet. It has determined that the other host is connected to the same local network (based on first 24 bits of both addresses).

Next, this packet needs to be sent to local network. However, local network is layer 2, and layer 2 can only forward MAC addresses. Thus layer 3 signals layer 2 to do "MAC address lookup" for the IP address. Approximatelly, your laptop will send a broadcast packet to all connected devices saying that it looks for MAC address of a device that has IP address 192.168.0.20. Since your phone currently has this address, it replies, with its own MAC address. When the laptop receives the reply, it can send a frame with destination MAC to your phone. Note: laptop will usually also save an entry in its APR cache.

Effie
  • 758
  • 5
  • 15